Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
具有多命名空间的PHP SOAP客户端_Php_Soap - Fatal编程技术网

具有多命名空间的PHP SOAP客户端

具有多命名空间的PHP SOAP客户端,php,soap,Php,Soap,我的php soapclient项目有问题。 从现在起,我使用curl发送soap请求,但出于不同的原因,我不得不使用PHP的集成soap客户端 我用于CURL的(工作)请求如下所示: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:asc="http://asc.ws.ideal.com" xmlns:xsd="http://getserviceeventstatus.info.asc.w

我的php soapclient项目有问题。 从现在起,我使用curl发送soap请求,但出于不同的原因,我不得不使用PHP的集成soap客户端

我用于CURL的(工作)请求如下所示:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:asc="http://asc.ws.ideal.com" xmlns:xsd="http://getserviceeventstatus.info.asc.ws.ideal.com/xsd">
   <soap:Header/>
   <soap:Body>
      <asc:getServiceEventStatus>        
         <asc:param>       
            <xsd:info>               
               <xsd:includePreviousEventsInfo>true</xsd:includePreviousEventsInfo>               
               <xsd:mainAscReferenceId>16111294</xsd:mainAscReferenceId>        
            </xsd:info>           
          <xsd:password>xxx</xsd:password>            
          <xsd:userId>xxx</xsd:userId>
         </asc:param>
      </asc:getServiceEventStatus>
   </soap:Body>
</soap:Envelope>

真的
16111294
xxx
xxx
我实际的php脚本看起来是这样的

     <?php
error_reporting(E_ALL);

$wsdl = '/services/AscServiceSync?wsdl';
$location = '/services/AscServiceSync.AscServiceSyncHttpSoap11Endpoint/';

$options = array(
'uri'=>'http://schemas.xmlsoap.org/soap/envelope/',
'style'=>SOAP_RPC,
'use'=>SOAP_ENCODED,
'soap_version'=>SOAP_1_1,
'cache_wsdl'=>WSDL_CACHE_NONE,
'connection_timeout'=>15,
'trace'=>true,
'encoding'=>'UTF-8',
'exceptions'=>true,
"location"=>$location
);

$client = new SoapClient($wsdl, $options);
$result = $client->getServiceEventStatus(array('userId' => 'xxx', 'password' => 'xxx', 'mainAscReferenceId' => '16111294'));
var_dump ($result);
print '<br />';
print $result->success;
print '<br />';

?> 

服务器返回“param”或“info”数据丢失的错误消息

希望有人能帮助我
谢谢大家!

一个错误可能是您没有将includePreviousEventsInfo=>设置为true

fiddler跟踪将显示任何其他差异,比如需要做一些事情将其和MainAsReferenceID放置在“info”节点中。通过一些HTTPS站点,FIDDLE将提供一个假的证书,用于中间解码流量的人。
您还可以将请求发送到任何其他接受HTTP的站点,以查看发送的内容。

一个错误可能是您没有将includePreviousEventsInfo设置为true

fiddler跟踪将显示任何其他差异,比如需要做一些事情将其和MainAsReferenceID放置在“info”节点中。通过一些HTTPS站点,FIDDLE将提供一个假的证书,用于中间解码流量的人。
您也可以将请求发送到任何其他接受HTTP的站点,以查看发送的内容。

我将请求发送到自己的服务器,并使用wireshark检查了包

这就是发送到服务器的内容:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://asc.ws.ideal.com"><SOAP-ENV:Body><ns1:getServiceEventStatus/></SOAP-ENV:Body></SOAP-ENV:Envelope>

我还添加了“includePreviousEventsInfo”值,但它根本没有帮助。
我发现,当我将“param”改为“userId”时,服务器错误消息变为“info”missing,而当我将userId改为“info”时,错误消息变为“param”missing…

我将请求发送到自己的服务器,并使用wireshark检查包

这就是发送到服务器的内容:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://asc.ws.ideal.com"><SOAP-ENV:Body><ns1:getServiceEventStatus/></SOAP-ENV:Body></SOAP-ENV:Envelope>

我还添加了“includePreviousEventsInfo”值,但它根本没有帮助。
我发现,当我将“param”改为“userId”时,服务器错误消息变为“info”missing,当我将userId改为“info”时,错误消息变为“param”missing…

从wireshark xml响应中可以看出,soapClient没有发送您在问题中提到的确切的xml请求。您还可以使用下面的行检查最后生成的XML并对其进行调试

$res = $client->__getLastRequest();
您的SOAP服务器需要一个多嵌套XML请求,您可以通过传递多维数组来生成该请求

$reqArr = [
    'info' => [
        'includePreviousEventsInfo' => true,
        'mainAscReferenceId' => 16111294
    ],
    'password' => 'xxxxxx',
    'userId' => 'xxxxxx',
];

$res = $client->__soapCall('getServiceEventStatus', $reqArr);
如果仍然出现错误,则检查来自上述方法的最后一个请求XML


希望有帮助。

从wireshark xml响应中可以看出,soapClient没有发送您在问题中提到的确切的xml请求。您还可以使用下面的行检查最后生成的XML并对其进行调试

$res = $client->__getLastRequest();
您的SOAP服务器需要一个多嵌套XML请求,您可以通过传递多维数组来生成该请求

$reqArr = [
    'info' => [
        'includePreviousEventsInfo' => true,
        'mainAscReferenceId' => 16111294
    ],
    'password' => 'xxxxxx',
    'userId' => 'xxxxxx',
];

$res = $client->__soapCall('getServiceEventStatus', $reqArr);
如果仍然出现错误,则检查来自上述方法的最后一个请求XML


希望有帮助。

您能使用Fiddler2或其他数据包嗅探器查看您发送的内容吗?这将向您显示差异。您可以使用Fiddler2或其他数据包嗅探器查看您发送的内容吗?这将向你展示不同之处。