PHP中的SOAP端口类型错误

时间:2016-05-13 12:46:40

标签: php xml soap wsdl

您好我正在尝试使用soap实现基于文档的Web服务,但却遇到了错误。帮助赞赏。

未捕获的SoapFault异常:[WSDL] SOAP-ERROR:解析WSDL:缺少名称' ProcessAssessmentOrder_Binding



$url = 'https://hatstest.harrisonassessments.com/HrXML/org_hr-xml/3_1/Services/Web_Services/WSDL/ProcessAssessmentOrder.wsdl';

$username = 'xxxxx';
$password = 'xxxxxxx';

$xml = '<?xml version="1.0"?>
        <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
           <SOAP-ENV:Header>
              <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                 <wsse:UsernameToken wsu:Id="UsernameToken-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                    <wsse:Username>' . $username . '</wsse:Username>
                    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $password . '</wsse:Password>
                    <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">Dw/vWrB4CuO4wrORCpAXeA==</wsse:Nonce>
                    <wsu:Created>' .gmdate('Y-m-d\TH:i:s\Z'). '</wsu:Created>
                 </wsse:UsernameToken>
              </wsse:Security>
              <message name="MyFaultName"/>
              <portType>
                  <!-- ... -->
                  <fault name="MyFaultName">
                      <soap:fault name="MyFaultName" use="literal"/>
                  <fault>
              </portType>
           </SOAP-ENV:Header>
           <SOAP-ENV:Body>
              <!-- XML message here -->
           </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>';

function getSoapClientWS($url)
{
    $client = new SoapClient($url);
   
    $securityTags = new SoapVar($xml, XSD_ANYXML);

    //$header=new SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security",$securityTags,true);

    //$client->__setSoapHeaders(array($header));

    $result = $client->__soapCall("abc", array($a, $b, $c), NULL,
                    new SoapHeader($url,
            'Security',
            new SoapVar($xml, XSD_ANYXML), 
            true
        ), $output_headers);

    var_dump($result); exit;
    return $client;
}

getSoapClientWS($url);
&#13;
&#13;
&#13;

0 个答案:

没有答案