但是,我想要的是能够获得响应请求并填充PHP
我已经使用soapUI进行了此操作,并获得了XML格式的响应,如
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://bsestarmfdemo.bseindia.com/2016/01/IMFUploadService/MFAPIResponse</a:Action>
<a:RelatesTo>uuid:804ed18e-630f-4b16-86ee-6f97ee71743e</a:RelatesTo>
</s:Header>
<s:Body>
<MFAPIResponse xmlns="http://bsestarmfdemo.bseindia.com/2016/01/">
<MFAPIResult>100|PAYMENT NOT INITIATED FOR GIVEN ORDER</MFAPIResult>
</MFAPIResponse>
</s:Body>
</s:Envelope>
MY PHP代码
我在SOAP方面没有太多经验,但是需要为我的工作构建验证器并使用特定的SOAP wsdl。
我已经建立了连接
<?php
$url= "http://bsestarmfdemo.bseindia.com/StarMFFileUploadService/StarMFFileUploadService.svc?wsdl";
$method = "MFAPI";
$error=0;
$fault=0;
$client = new SoapClient($url, array('soap_version' => SOAP_1_2 , 'SoapAction'=>'http://tempuri.org/IStarMFFileUploadService/MFAPI'));
$actionHeader= array();
$actionHeader[] = new SoapHeader('http://www.w3.org/2005/08/addressing',
'Action',
'http://tempuri.org/IStarMFFileUploadService/MFAPI');
$actionHeader[] = new SoapHeader('http://www.w3.org/2005/08/addressing',
'To',
'http://bsestarmfdemo.bseindia.com/MFUploadService/MFUploadService.svc/Basic');
$client->__setSoapHeaders($actionHeader);
$featchData = array('Param' => array('UserId' => 'xxxxx', 'Flag' => 'xxxx', 'EncryptedPassword' => 'xxxx', 'param' => 'xxxx') );
try{
$resultData = $client->__call($method, array($featchData));
}
catch (SoapFault $resultData) {
$error = 1;
}
if($error==1) {
$result=$fault;
}else{
$result = $resultData;
var_dump($result);
}
// echo $result;
?>