我正在尝试使用PHP调用SOAP方法。
<soap:Envelope xmlns:bpm="http://bpmellat.co/" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<wsse:Security soap:mustUnderstand="true" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsu:Timestamp wsu:Id="Timestamp-8" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Created>2014-05-08T16:02:38.053Z</wsu:Created>
<wsu:Expires>2020-05-07T16:03:38.053Z</wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-7" 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">D5L5sjDemfkf/bq5zn7DMA==</wsse:Nonce>
<wsu:Created>2014-05-08T16:02:34.714Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soap:Header>
<soap:Body>
<bpm:getTransactionByDate>
<bpm:TerminalId>1461389</bpm:TerminalId>
<bpm:FromDate>20130101</bpm:FromDate>
<bpm:ToDate>20140808</bpm:ToDate>
</bpm:getTransactionByDate>
</soap:Body>
</soap:Envelope>
我的代码是:
$client = new SoapClient("http://bos.bpm.bankmellat.ir/backoffice/Services/bpm/TransactionService.asmx?wsdl",array("trace"=> 1, "exceptions" => 0));
$sh_param = array(
'Username' => 'username',
'Password' => 'password');
$headers = new SoapHeader('http://soapserver.example.com/webservices', 'UserCredentials', $sh_param);
$parameters = array('TerminalId'=>'124124','FromDate'=>'20140508','ToDate'=>'20140508');
$client->__soapCall("getTransactionByDate", $parameters, null,
new SoapHeader('http://bpmellat.co/',
'Security',
$sh_param));
//...code goes here...
echo $client->getTransactionByDate($parameters)->getTransactionByDateResult;
//output debug info
var_dump($client->__getLastRequestHeaders());
print "<pre>";
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "</pre>";
但它不起作用,请求xml文本在soap ui中工作但不能使用php :( 请帮助我:(我可以用cURL建立这个请求,但我想用SoapClient来实现它