Я пытаюсь подключиться к защищенной веб-службе (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 "
- Безопасное соединение PHP с сеансами WSDL прерывается после обновления сертификата сервера
- Как решить ошибку: SOAP-ERROR: Кодировка: объект не имеет свойства «createLead»?
- Тип веб-службы PHP NuSOAP
- WSDL для PHP с использованием Basic Auth
- Perfect Soap (Wsdl) веб-сервис в php
- Запрос SOAP от PHP не работает
Вот код, который я использовал:
$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>
Правильно ли я это делаю? Любая помощь будет очень высоко ценится. Благодаря!