我想从我的 Soap 请求中删除 ns:1 和 ns:2。
实际上我在生成时得到了这个:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="*********" xmlns:ns2="**************"><SOAP-ENV:Header><ns2:shp:sc><user>***</user><password>*******</password><companyName>******</companyName><autoCommit>***</autoCommit></ns2:shp:sc></SOAP-ENV:Header><SOAP-ENV:Body><ns1:p_put_order><put_orderRequest><shop_order>TEST2</shop_order><shop_account>100000</shop_account><order_comment>test</order_comment></put_orderRequest></ns1:p_put_order></SOAP-ENV:Body></SOAP-ENV:Envelope>
然后在我的 php 文件中,我得到了:
$options = array("soap_version" => SOAP_1_1,
"encoding" => "UTF-8",
"trace" => true,
"exceptions" => true,
'cache_wsdl' => WSDL_CACHE_NONE,
);
$client = new SoapClient($soapURL, $options);
$header = new SoapHeader($soapURL,'shp:sc',$auth, false);
$headerSoap = $client->__setSoapHeaders($header);
我尝试使用 SoapVar()、__doRequest() 但这些都不起作用......
你对此有什么想法吗?
谢谢您的帮助
最佳答案
$header = new SoapHeader($soapURL,'shp:sc',$auth, false);
请从这里删除 $soapURL。第一个参数假设是命名空间。请在此处查看文档:http://php.net/manual/en/class.soapheader.php .如果失败,请发布 WSDL 文件。
关于PHP SOAP 请求,删除 ns1 : et ns:2 from request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53541527/