PHP SOAP В сообщении нет заголовка с именем UserName и пространством имен

Я пытаюсь подключиться к wcf soap сервису через php, но он продолжает говорить: возникла исключительная ситуация: исключение SoapFault: [a: InternalServiceFault] В сообщении нет заголовка с именем UserName и пространством имен ..

try {
$wsdl_url = 'TargetURL/CRM.ServiceHost.CRMService.svc?wsdl';
$options = array(
"soap_version" => SOAP_1_1,
"trace"=>1,
'exceptions'=>true,
'UserName'=>'',
'Password'=>'',
);
$client = new SOAPClient($wsdl_url,$options);
$params = array(
'TelephonNo' => "8334444444",
);

$header = new SoapHeader('http://www.w3.org/2005/08/addressing', 'Action', 'http://tempuri.org/ICRMService/GetTelephoneInfo');
$output_header = $client->__setSoapHeaders($header);

$return = $client->__soapCall('GetTelephoneInfo', array($params),$security);
var_dump($return);
} catch (Exception $e) {
echo "Exception occured: " . $e;
}

это описание моего сервиса:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="CRMService" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://win-b9fh3h3afju:83/CRM.ServiceHost.CRMService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://win-b9fh3h3afju:83/CRM.ServiceHost.CRMService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="http://win-b9fh3h3afju:83/CRM.ServiceHost.CRMService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/CRM.Data.ServiceHost"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ICRMService_GetTelephoneInfo_InputMessage">
<wsdl:part name="parameters" element="tns:GetTelephoneInfo"/>
</wsdl:message>
<wsdl:message name="ICRMService_GetTelephoneInfo_OutputMessage">
<wsdl:part name="parameters" element="tns:GetTelephoneInfoResponse"/>
</wsdl:message>
<wsdl:portType name="ICRMService">
<wsdl:operation name="GetTelephoneInfo">
<wsdl:input wsaw:Action="http://tempuri.org/ICRMService/GetTelephoneInfo" message="tns:ICRMService_GetTelephoneInfo_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ICRMService/GetTelephoneInfoResponse" message="tns:ICRMService_GetTelephoneInfo_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_ICRMService" type="tns:ICRMService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetTelephoneInfo">
<soap:operation soapAction="http://tempuri.org/ICRMService/GetTelephoneInfo" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CRMService">
<wsdl:port name="BasicHttpBinding_ICRMService" binding="tns:BasicHttpBinding_ICRMService">
<soap:address location="http://win-b9fh3h3afju:83/CRM.ServiceHost.CRMService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]