[英]How to set this SOAP header in PHP
我尝试像这样设置SOAP标头:
<tns:Authentication xmlns:tns="iSklep3">
<ApiKey xsi:type="xsd:string">abc</ApiKey>
</tns:Authentication>
我这样做:
//...
$client = new SoapClient($wsdlServer);
$headerBody = array("ApiKey" => "abc");
$header = new SoapHeader("iSklep3", "Authentication", $headerBody);
$client->__setSoapHeaders($header);
//...
//calling soap methods
...
当我调用方法时,它返回的Api键是错误的,但是应该是正确的。 知道有人SOAP标头的问题在哪里吗?
设置标题后,您尚未调用调用函数。
<?php
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
'uri' => "http://test-uri/"));
$header = new SoapHeader('http://soapinterop.org/echoheader/',
'echoMeStringRequest',
'hello world');
$client->__setSoapHeaders($header);
$client->__soapCall("echoVoid", null);
?>
资料来源:RTM http://php.net/manual/en/soapclient.setsoapheaders.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.