Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.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
SOAP客户端请求-->;错误的请求_Soap_Soap Client_Bad Request - Fatal编程技术网

SOAP客户端请求-->;错误的请求

SOAP客户端请求-->;错误的请求,soap,soap-client,bad-request,Soap,Soap Client,Bad Request,我被要求研究使用SOAP服务同步数据。我对SOAP真的不是很了解,我得到了一个错误的请求 我尝试调用的函数是一个测试回显函数: 公共字符串(字符串文本) 每次我打电话都会出错 我已经注释掉了用户名/密码设置,因为我现在不知道用户名和密码,而且我的联系人正在休假:(虽然现在我很高兴收到一条验证失败的消息,而不是一个错误 如果有人能给我指出正确的方向,请 谢谢 约翰 您可以尝试以下方法: ... $client = new SoapClient($apiUrl, $options); va

我被要求研究使用SOAP服务同步数据。我对SOAP真的不是很了解,我得到了一个错误的请求

我尝试调用的函数是一个测试回显函数:

公共字符串(字符串文本)

每次我打电话都会出错

我已经注释掉了用户名/密码设置,因为我现在不知道用户名和密码,而且我的联系人正在休假:(虽然现在我很高兴收到一条验证失败的消息,而不是一个错误

如果有人能给我指出正确的方向,请

谢谢

约翰


您可以尝试以下方法:

...
$client     = new SoapClient($apiUrl, $options);

var_dump($client->__getFunctions());

$auth = array("Username" => "John", "Password" => "secret", 
    "IsP24Credentials" => false);
$header = new SoapHeader("https://www.propctrl.com/", "CredentialsHeader", 
    $auth, FALSE);
$client->__setSoapHeaders($header);

print $client->EchoAuthenticated(array( 
    "text" => "My text to be echoed."
));
var_dump($client->__getLastRequest());
...
这将导致请求SOAP请求,如下所示:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="https://www.propctrl.com/v3" xmlns:ns2="https://www.propctrl.com/">
   <env:Header>
      <ns2:CredentialsHeader>
         <ns2:IsP24Credentials>false</ns2:IsP24Credentials>
         <ns2:Password>secret</ns2:Password>
         <ns2:Username>John</ns2:Username>
      </ns2:CredentialsHeader>
   </env:Header>
   <env:Body>
      <ns1:EchoAuthenticated>
         <ns1:text>My text to be echoed.</ns1:text>
      </ns1:EchoAuthenticated>
   </env:Body>
</env:Envelope>

假的
秘密
约翰
我的文字需要回应。

作为补充说明,您可以看看。这个工具对web服务开发有很大的帮助。

嘿,Marcellus,谢谢你的回复。我没有做到这一点,但是我将下载soapui并查看发送的内容。。。
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="https://www.propctrl.com/v3" xmlns:ns2="https://www.propctrl.com/">
   <env:Header>
      <ns2:CredentialsHeader>
         <ns2:IsP24Credentials>false</ns2:IsP24Credentials>
         <ns2:Password>secret</ns2:Password>
         <ns2:Username>John</ns2:Username>
      </ns2:CredentialsHeader>
   </env:Header>
   <env:Body>
      <ns1:EchoAuthenticated>
         <ns1:text>My text to be echoed.</ns1:text>
      </ns1:EchoAuthenticated>
   </env:Body>
</env:Envelope>