在PHP中为SOAP设置参数

在PHP中为SOAP设置参数,php,soap,Php,Soap,我是全新的whis 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/">

我是全新的whis 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>
但我在服务器上设置类时遇到了一个致命错误。。。不知道这个。。。因此,我的问题是:


如何设置_SID?

我不确定您使用的是什么库,但您可能对阅读PHP5中已经包含的SOAP客户端感兴趣

例如,要使用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客户机的改进

试着用像这样的东西

$client->__setSoapHeaders($headers);
$client->getInfo(...)
最后,为什么要调用$client->getInfo。。。?在SOAP主体中,我看到您只有GetSessionParameters操作。我想你应该打电话给谁

$client->GetSessionParameters(...)

是的,我确实使用php本机客户端,对于其他请求,它工作正常,这是我获取会话ID的地方,但是对于下一个请求,我需要发送会话ID…我得到以下错误:对象引用未设置为对象实例
$client->GetSessionParameters(...)