带有安全头的php新SoapClient

时间:2017-07-03 15:36:23

标签: php

我们有soapclient连接问题。请检查下面的xml和我的PHP代码并建议我们。当我们在肥皂ui中运行时,当试图在本地服务器上运行时,它运行良好。

使用SoapUI XML请求:

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Header>
        <wsse:Security
            xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Timestamp wsu:Id="TS-2">
                <wsu:Created>2017-07-03T09:38:05.550Z</wsu:Created>
                <wsu:Expires>2017-07-03T09:48:05.550Z</wsu:Expires>
            </wsu:Timestamp>
            <wsse:UsernameToken wsu:Id="UsernameToken-1">
                <wsse:Username>xxxxxxx</wsse:Username>
                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxxxxxxx</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns2:methodname
            xmlns:ns2="http://ws.oprs.xxxxx.com/">
            <arg0>
                <actualClientIP>xxxxxx</actualClientIP>
                <agentPanCard>xxxxxx</agentPanCard>
                <userAuthKey>xxxxx</userAuthKey>
                <userId>xxxxx</userId>
            </arg0>
        </ns2:methodname>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope> 

以上xml在soap ui工具中正常工作。

请检查我的PHP代码。

  private function apiMethodCall($url, $headerAuth, $className, $inputParams){
    $soapClient = new SoapClient($url, $headerAuth);
    $result     = $soapClient->__soapCall($className, array($inputParams));
    return $result;}




    public function funcationName(){
        $className = "methodname";
        $headerAuth = array("UsernameToken"=>array("Timestamp"=>array("Created"=>"2017-07-03T09:40:00.550Z","Expires"=>"2017-07-03T09:50:00.550Z"),"UsernameToken"=>array("Username"=>"XXXXXX", "Password"=>"xxxxxxx")));

        $inputParams =Array("arg0"=> Array("actualClientIP"=>"xxxxxx","agentPanCard"=>"xxxxxx","userAuthKey"=>"xxxxxxx","userId"=>"xxxxxx"));

        $arr_chart = $this->apiMethodCall("http://xxxxxxxxxxxxx?wsdl", $headerAuth, $className, $inputParams);
        print_r($arr_chart);
    }

低于错误

  

致命错误:未捕获的SoapFault异常:[客户端]看起来像我们得到的   

中没有XML文档      

SoapClient-&gt; __ soapCall('methodname',Array)

0 个答案:

没有答案
相关问题