Intereting Posts
TCPDF / FPDF – проблема разрыва страницы Разделить массив с массивом array_chunk динамически на основе другого массива PHP Foreach на MySQLi Результат набора как отображать – 03d 01h 10m в php? Как предотвратить дублирование имен пользователей при регистрации? PHP / MySQL Отображение всех ошибок и предупреждений PHP – Фильтрация по значению поля MySQL Проблема с настройкой регистрации пользователя joomla 1.7 использование jquery для публикации данных в zend framework JQuery, чтение переменных JSON, полученных из PHP Развертывание на Laravel Forge бросание фейкера не найдено Исключение Google Appengine 1.9.3 / 4 и WordPress 3.9. Пользователь-администратор не работает полностью на локальном хосте Модуль Magento Fatal error: Class 'Mage_Cashondelivery_Helper_Data' не найден в \ xampp \ htdocs \ magento \ app \ Mage.php в строке 516 Заполнение объекта из массива данных без формы / запроса 0x80040400: QuickBooks обнаружил ошибку при анализе предоставленного текстового потока XML

Как использовать защищенный веб-сервис с WS-Security через SOAP ?

Я пытаюсь подключиться к защищенной веб-службе (HTTPS – TLS v3), но я получаю эту ошибку:

Непринятое исключение SoapFault: [WSDL] SOAP-ERROR: анализ WSDL: не удалось загрузить с ' https://integrationdev.momentum.co.za/sales/CRMService/CRMLeadService_v1_0 ': не удалось загрузить внешнюю сущность " https: // integrationdev .momentum.co.za / sales / CRMService / CRMLeadService_v1_0 "

Вот код, который я использовал:

$momurl = "integrationdev.momentum.co.za/sales/CRMService/CRMLeadService_v1_0"; //Perform Request $client = new SoapClient( "https://" . urlencode($username) . ":" . urlencode($password) . "@$momurl", array( 'login' => $username, 'password' => $password ) ); $params = new stdClass(); $params->LeadSourceId = $lsid; $params->AffiliateLeadReference = $alref; $params->Title = $title; $params->Initials = $initials; $params->PreferredName = $pname; $params->FirstName = $username; $params->LastName = $userlname; $params->PreferredCorrespondenceLanguage = $lang; $params->PreferredCommunicationMethod = $comm; $params->Campaign = $camp; $params->HomePhoneNumber = $phonesubmit; $params->BusinessPhoneNumber = $phonesubmit; $params->MobilePhoneNumber = $phonesubmit; $params->EmailAddress = $useremail; $params->Notes = $u_script; $params->ProductCategories = $prodcat; try { $result = $client->createLead($params); } catch (Exception $e) { $msgs = $e->getMessage(); if($debug) echo "Error: $msgs"; } 

Код, похоже, не работает. Я не уверен в части аутентификации. Вот как выглядит WSDL:

 <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="CRMLeadService" targetNamespace="http://www.momentum.co.za/crm/service/application/CRMLeadService/v1.0" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.momentum.co.za/crm/service/application/CRMLeadService/v1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xsd:schema targetNamespace="http://www.momentum.co.za/crm/service/application/CRMLeadService/v1.0" xmlns:lead="http://www.momentum.co.za/crm/service/type/application/Lead/v1.0" xmlns:systemFault="http://www.momentum.co.za/crm/service/type/fault/SystemFault/v1.0"> <xsd:import namespace="http://www.momentum.co.za/crm/service/type/application/Lead/v1.0" schemaLocation="../xsd-src/Lead_1_0.xsd"/> <xsd:import namespace="http://www.momentum.co.za/crm/service/type/fault/SystemFault/v1.0" schemaLocation="../xsd-src/SystemFault_1_0.xsd"/> <xsd:element name="SystemFault_fault"> <xsd:complexType> <xsd:sequence> <xsd:element name="system_fault" type="systemFault:SystemFaultMessageType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="CreateLeadRequest"> <xsd:complexType> <xsd:sequence> <xsd:element name="createLead" type="lead:LeadType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="CreateLeadResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="leadReferenceNumber" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="SystemFault_faultMsg"> <wsdl:part element="tns:SystemFault_fault" name="parameters"/> </wsdl:message> <wsdl:message name="CreateLeadRequest"> <wsdl:part element="tns:CreateLeadRequest" name="parameters"/> </wsdl:message> <wsdl:message name="CreateLeadResponse"> <wsdl:part element="tns:CreateLeadResponse" name="parameters"/> </wsdl:message> <wsdl:portType name="CRMLeadService_v1_0"> <wsdl:operation name="createLead"> <wsdl:documentation>Creates lead on CRM</wsdl:documentation> <wsdl:input message="tns:CreateLeadRequest" name="CreateLeadRequest"/> <wsdl:output message="tns:CreateLeadResponse" name="CreateLeadResponse"/> <wsdl:fault message="tns:SystemFault_faultMsg" name="systemFault"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CRMLeadServiceSOAP_v1_0" type="tns:CRMLeadService_v1_0"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="createLead"> <soap:operation soapAction="http://www.momentum.co.za/crm/service/application/CRMLeadService/createLead"/> <wsdl:input name="CreateLeadRequest"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="CreateLeadResponse"> <soap:body use="literal"/> </wsdl:output> <wsdl:fault name="systemFault"> <soap:fault name="systemFault" use="literal"/> </wsdl:fault> </wsdl:operation> </wsdl:binding> <wsdl:service name="CRMLeadService_v1_0"> <wsdl:documentation>Provides operation that enables the creation of leads on CRM</wsdl:documentation> <wsdl:port binding="tns:CRMLeadServiceSOAP_v1_0" name="CRMLeadServiceSOAP_v1_0"> <soap:address location="http://localhost:9080/WebToLeadServiceSOAP/services/CRMLeadService_v1_0"/> </wsdl:port> </wsdl:service> </wsdl:definitions> пространство <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="CRMLeadService" targetNamespace="http://www.momentum.co.za/crm/service/application/CRMLeadService/v1.0" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.momentum.co.za/crm/service/application/CRMLeadService/v1.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xsd:schema targetNamespace="http://www.momentum.co.za/crm/service/application/CRMLeadService/v1.0" xmlns:lead="http://www.momentum.co.za/crm/service/type/application/Lead/v1.0" xmlns:systemFault="http://www.momentum.co.za/crm/service/type/fault/SystemFault/v1.0"> <xsd:import namespace="http://www.momentum.co.za/crm/service/type/application/Lead/v1.0" schemaLocation="../xsd-src/Lead_1_0.xsd"/> <xsd:import namespace="http://www.momentum.co.za/crm/service/type/fault/SystemFault/v1.0" schemaLocation="../xsd-src/SystemFault_1_0.xsd"/> <xsd:element name="SystemFault_fault"> <xsd:complexType> <xsd:sequence> <xsd:element name="system_fault" type="systemFault:SystemFaultMessageType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="CreateLeadRequest"> <xsd:complexType> <xsd:sequence> <xsd:element name="createLead" type="lead:LeadType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="CreateLeadResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="leadReferenceNumber" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="SystemFault_faultMsg"> <wsdl:part element="tns:SystemFault_fault" name="parameters"/> </wsdl:message> <wsdl:message name="CreateLeadRequest"> <wsdl:part element="tns:CreateLeadRequest" name="parameters"/> </wsdl:message> <wsdl:message name="CreateLeadResponse"> <wsdl:part element="tns:CreateLeadResponse" name="parameters"/> </wsdl:message> <wsdl:portType name="CRMLeadService_v1_0"> <wsdl:operation name="createLead"> <wsdl:documentation>Creates lead on CRM</wsdl:documentation> <wsdl:input message="tns:CreateLeadRequest" name="CreateLeadRequest"/> <wsdl:output message="tns:CreateLeadResponse" name="CreateLeadResponse"/> <wsdl:fault message="tns:SystemFault_faultMsg" name="systemFault"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="CRMLeadServiceSOAP_v1_0" type="tns:CRMLeadService_v1_0"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="createLead"> <soap:operation soapAction="http://www.momentum.co.za/crm/service/application/CRMLeadService/createLead"/> <wsdl:input name="CreateLeadRequest"> <soap:body use="literal"/> </wsdl:input> <wsdl:output name="CreateLeadResponse"> <soap:body use="literal"/> </wsdl:output> <wsdl:fault name="systemFault"> <soap:fault name="systemFault" use="literal"/> </wsdl:fault> </wsdl:operation> </wsdl:binding> <wsdl:service name="CRMLeadService_v1_0"> <wsdl:documentation>Provides operation that enables the creation of leads on CRM</wsdl:documentation> <wsdl:port binding="tns:CRMLeadServiceSOAP_v1_0" name="CRMLeadServiceSOAP_v1_0"> <soap:address location="http://localhost:9080/WebToLeadServiceSOAP/services/CRMLeadService_v1_0"/> </wsdl:port> </wsdl:service> </wsdl:definitions> 

Правильно ли я это делаю? Любая помощь будет очень высоко ценится. Благодаря!

Solutions Collecting From Web of "Как использовать защищенный веб-сервис с WS-Security через SOAP ?"