【问题标题】:PHP SOAP Request, remove ns1: et ns:2 from requestPHP SOAP 请求,从请求中删除 ns1: et ns:2
【发布时间】:2019-05-01 15:56:36
【问题描述】:

我想从我的 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(),但这些都不起作用... 你对此有什么想法吗? 谢谢你的帮助

【问题讨论】:

    标签: php soap namespaces xml-namespaces soap-client


    【解决方案1】:

    $header = new SoapHeader($soapURL,'shp:sc',$auth, false);

    请从这里删除 $soapURL。第一个参数假设是命名空间。请在此处查看文档:http://php.net/manual/en/class.soapheader.php。如果失败,请发布 WSDL 文件。

    【讨论】:

      猜你喜欢
      • 2022-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多