SoapClient调用webservice

时间:2013-06-14 11:08:08

标签: php soap wsdl soap-client

我正在尝试调用基于SOAP的Web服务。以下是我的webservice的WSDL

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:var="some_namespace">
    <soapenv:Header/>
    <soapenv:Body>
        <var:SomeServiceRequest name="xxx" school="yyy" format="pdf" senderName1="aaa" />
    </soapenv:Body>
</soapenv:Envelope>

现在我已尝试使用PHP中的SoapClient类调用此Web服务的所有可能性。我总是得到“无效的XML”作为回应。

以下是最明显的方式,但我不明白为什么它不起作用:

$soapclient = new SoapClient($this->getWSDLUrl(), array('trace' =>true,
                                                        'soap_version'   => SOAP_1_2,
                                                       ));

$headerbody = array('UsernameToken'=>array('Username'=>'someusername', 
                                            Password'=>'somepassword'));


$header = new SoapHeader('https://xxx/SoapConnector','Security',$headerbody);
$soapclient->__setSoapHeaders($header);
$oResponse = $soapclient->SomeService(array('name'=>'asd', 'school'=>'sdf','format'=>'asdf'));

0 个答案:

没有答案