1
POST /webservice/mobilepayment.asmx HTTP/1.1
Host: portal.mobilaidat.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/MPaymentBasic"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<MPaymentBasic xmlns="http://tempuri.org/">
<token>
<FirmWebCode>string</FirmWebCode>
<UserName>string</UserName>
<Password>string</Password>
</token>
<input>
<GsmNo>string</GsmNo>
<ProductCode>string</ProductCode>
<ProductPrice>decimal</ProductPrice>
<SendTransactionResult>boolean</SendTransactionResult>
<ServiceTypeID>int</ServiceTypeID>
<PaymentTypeID>int</PaymentTypeID>
<FirmMPaymentRefID>string</FirmMPaymentRefID>
<WebUrl>string</WebUrl>
<ClientIP>string</ClientIP>
</input>
</MPaymentBasic>
</soap:Body>
</soap:Envelope>
和響應肥皂方法就是這樣
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<MPaymentBasicResponse xmlns="http://tempuri.org/">
<MPaymentBasicResult>
<TransactionID>long</TransactionID>
<StatusCode>int</StatusCode>
<ErrorCode>string</ErrorCode>
<ErrorDesc>string</ErrorDesc>
</MPaymentBasicResult>
</MPaymentBasicResponse>
</soap:Body>
</soap:Envelope>
我連接到WSDL和創建的SOAP客戶端
$client = new SoapClient($wsdl_url);
$params = array('FirmWebCode' =>'234234234234232342','UserName' =>'YYASASASd','Password' =>'4PHPY3','GsmNo' =>'5424444444','ProductPrice' =>'1','SendTransactionResult' =>True,'ServiceTypeID' =>0,'PaymentTypeID' =>0,'FirmMPaymentRefID' =>234234);
$response=$client->MPaymentBasic('MPaymentBasic', array('parameters' => $params));
print_r($response);
而結果就是這樣
stdClass Object ([MPaymentBasicResult] => stdClass Object ([TransactionID] => 0 [StatusCode] => 1 [ErrorCode] => Object reference not set to an instance of an object. [ErrorDesc] => Object reference not set to an instance of an object.))
問題是我不是很確定什麼是用php調用這個方法的正確方法。我認爲令牌和輸入參數必須用內部數組發送?但我該怎麼做?
謝謝。從PHP