PHPSOAPClient总是返回NULL响应,即使我得到了有效的XML调试
我一直在尝试使用PHPSOAPClient从SOAP服务获取数据。 如果我在一个名为soapui的著名工具上使用正确的参数(显然我不能公开正确的参数)远离PHP,我会得到正确的响应。但是在PHP中,即使使用了正确的参数和东西,我的响应也总是为NULL 这是我的代码:PHPSOAPClient总是返回NULL响应,即使我得到了有效的XML调试,php,xml,web-services,soap,wsdl,Php,Xml,Web Services,Soap,Wsdl,我一直在尝试使用PHPSOAPClient从SOAP服务获取数据。 如果我在一个名为soapui的著名工具上使用正确的参数(显然我不能公开正确的参数)远离PHP,我会得到正确的响应。但是在PHP中,即使使用了正确的参数和东西,我的响应也总是为NULL 这是我的代码: <?php $client = new SoapClient('http://my-service?WSDL', array('trace'=>true
<?php
$client = new SoapClient('http://my-service?WSDL',
array('trace'=>true, 'exceptions'=>true));
$params= ['EBMHeader'=> ['EBMID'=> 'anyvalue'],
'DataArea'=> ['Ip'=> '127.0.0.1', 'RequestId'=> '12345']];
try {
$response= $client->MySoapFunction($params);
var_dump($response); // returns always NULL
echo $client->__getLastResponse(); //Returns a valid XML with the proper data
} catch (Exception $exception) {
echo $exception;
}
这是我的回答$client->\uu getlastress()
:
我遇到了一个类似的问题,但是使用了
$client->\uuuSOAPCall('MySoapFunction',$params,null)
而不是调用的实际方法导致返回带有正确数据的stdClass
)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/">
<SOAP-ENV:Body>
<ns2:ConsultarProductoABM>
<ns1:EBMHeader>
<ns1:EBMID>whatever</ns1:EBMID>
</ns1:EBMHeader>
<ns2:DataArea>
<ns2:Ip>127.0.0.1</ns2:Ip>
<ns2:RequestId>12345</ns2:RequestId>
</ns2:DataArea>
</ns2:ConsultarProductoABM>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<v1:ConsultarProductoResponseEBM xmlns:v1="http://url.com/EnterpriseObjects/Core/EBM/Producto/V1/">
<v11:EBMHeader xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/">
<v11:EBMID>anything</v11:EBMID>
<v11:CreationDateTime>2015-10-16T19:09:54.962-03:00</v11:CreationDateTime>
<v11:Sender>ATG</v11:Sender>
<v11:Target>SMFLX</v11:Target>
<v11:BusinessScope>SIN_CONFIGURACION</v11:BusinessScope>
<v11:BusinessScope>SIN_CONFIGURACION</v11:BusinessScope>
<v11:BusinessScope>SIN_CONFIGURACION</v11:BusinessScope>
<v11:BusinessScope>e6e00a83-ce05-4e2a-bdb6-d7bfbd14d84a</v11:BusinessScope>
<v11:EBMTracking>ConsultarProductoAutogestionReqABCS (V1).ConsultarProducto_+++_ConsultarProductoProvisioningProvABCS (V1).ConsultarProducto_+++_ValidarRespuestaEBS (V1).ValidarRespuesta_+++_ConsultarProductoOpenSmartFlexProvABCS (V1).ConsultarProducto_+++_ValidarRespuestaEBS (V1).ValidarRespuesta</v11:EBMTracking>
<v11:FaultNotification>
<ns1:FaultMessage xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"/>
<ns1:FaultingService xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"/>
<ns1:Destination xmlns:ns2="http://url.com/EnterpriseObjects/Autogestion/Producto/ABM/V1/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"/>
</v11:FaultNotification>
</v11:EBMHeader>
<v11:ReturnCode xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/">0</v11:ReturnCode>
<v11:ReturnMessage xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/"/>
<v11:ErrorCode xmlns:v11="http://url.com/EnterpriseObjects/Common/EBM/Ebm/V1/">0</v11:ErrorCode>
<v1:DataArea>
<v1:InstalledProduct>
<v11:Hub xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">BON</v11:Hub>
<v11:Node xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">BON076A</v11:Node>
<v11:CustomerParty xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">
<v12:Id xmlns:v12="http://url.com/EnterpriseObjects/Core/EBO/CustomerParty/V1/">7889679</v12:Id>
<v12:PartyHuman xmlns:v12="http://url.com/EnterpriseObjects/Core/EBO/CustomerParty/V1/">
<v13:FirstName xmlns:v13="http://url.com/EnterpriseObjects/Core/EBO/Common/V1/">JOHN</v13:FirstName>
<v13:LastName xmlns:v13="http://url.com/EnterpriseObjects/Core/EBO/Common/V1/">DOE</v13:LastName>
</v12:PartyHuman>
<v12:Location xmlns:v12="http://url.com/EnterpriseObjects/Core/EBO/CustomerParty/V1/">
<v13:Address xmlns:v13="http://url.com/EnterpriseObjects/Core/EBO/Common/V1/">
<v13:ProvinceName>LACATION</v13:ProvinceName>
<v13:StateName>LACATION</v13:StateName>
<v13:CityName>LACATION</v13:CityName>
</v13:Address>
</v12:Location>
</v11:CustomerParty>
<v11:ContractID xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">123456</v11:ContractID>
<v11:Service xmlns:v11="http://url.com/EnterpriseObjects/Core/EBO/InstalledProduct/V1/">
<v11:ClassId>52</v11:ClassId>
</v11:Service>
</v1:InstalledProduct>
</v1:DataArea>
</v1:ConsultarProductoResponseEBM>
</soap-env:Body>
</soapenv:Envelope>
$response= $client->MySoapFunction($params);
var_dump($response);