在 PHP 中设置 SOAP 参数

发布于 2024-12-10 02:32:31 字数 857 浏览 0 评论 0原文

我真的是 SOAP 新手,所以请帮助我设置发送请求的参数:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ManagedSoapHeader xmlns="http://tempuri.org/">
      <_SID>string</_SID>
    </ManagedSoapHeader>
  </soap:Header>
  <soap:Body>
    <GetSessionParameters xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>

这是我的代码

   $client->getInfo(array("Header" => array("ManagedSoapHeader" => array("_SID" => $sessionID)))); //->ManagedSoapHeader(array("_SID" => $sessionID));

但是我在服务器上设置类时遇到了致命错误...不知道这一点...所以我的问题:

如何设置_SID?

I am realy new whis SOAP, so please help me to set parameters for sending a request:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <ManagedSoapHeader xmlns="http://tempuri.org/">
      <_SID>string</_SID>
    </ManagedSoapHeader>
  </soap:Header>
  <soap:Body>
    <GetSessionParameters xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>

this is my code

   $client->getInfo(array("Header" => array("ManagedSoapHeader" => array("_SID" => $sessionID)))); //->ManagedSoapHeader(array("_SID" => $sessionID));

But I getting an fatal error about setting a class on server... no idea about this... so my question:

How to set _SID?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

携君以终年 2024-12-17 02:32:31

我不太确定您正在使用哪个库,但您可能有兴趣阅读 PHP 5 中已包含的 SOAP 客户端

。 Soapclient.php" rel="nofollow">http://www.php.net/manual/en/soapclient.soapclient.php

例如,要使用 PHP SoapClient 设置 SOAP 参数,您只需为此:

$client = new SoapClient("some.wsdl", array('proxy_host'     => "localhost",
                                            'proxy_port'     => 8080,
                                            'proxy_login'    => "some_name",
                                            'proxy_password' => "some_password"));

您可以还想研究其他第三方客户端,例如 NuSOAP,它是对本机 PHP 客户端的改进。

http://sourceforge.net/projects/nusoap/

I'm not really sure what library you are using but you may be interested in reading the SOAP Client that is already included with PHP 5.

http://www.php.net/manual/en/soapclient.soapclient.php

For instance, to set the parameters for SOAP using the PHP SoapClient you would simply need to do this:

$client = new SoapClient("some.wsdl", array('proxy_host'     => "localhost",
                                            'proxy_port'     => 8080,
                                            'proxy_login'    => "some_name",
                                            'proxy_password' => "some_password"));

You may also want to research other third party clients such as NuSOAP which is meant to be an improvement on the native PHP client.

http://sourceforge.net/projects/nusoap/

灼疼热情 2024-12-17 02:32:31

尝试使用 http://php.net/manual/en/soapclient.setsoapheaders.php< /a> 类似

$client->__setSoapHeaders($headers);
$client->getInfo(...)

最后,为什么要调用 $client->getInfo(...)?在 SOAP Body 中,我看到您只有 GetSessionParameters 操作。恕我直言,你应该打电话

$client->GetSessionParameters(...)

Try to use http://php.net/manual/en/soapclient.setsoapheaders.php Something like

$client->__setSoapHeaders($headers);
$client->getInfo(...)

Finally, why do you call $client->getInfo(...)? In the SOAP Body I see you have just GetSessionParameters operation. IMHO you should call

$client->GetSessionParameters(...)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文