0
我正在使用PHP創建一個SOAP客戶端,並且遇到了使用問題。當我使用soapui測試請求直接XML時,它響應良好並且可以正常工作,但是使用SoapClient類的PHP可以告訴我在soapui中使用的憑據是不正確的。通過soapui通過soapui處理XML但不通過PHP的SOAP
不知道我在這裏失蹤。我下面 代碼下面是我的XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pric="http://upshot.co.uk/pricing_request_ws">
<soapenv:Header/>
<soapenv:Body>
<pric:retrieveProductsPricing>
<username>apiuser</username>
<password>pword</password>
<postcode>EC2R 7HP</postcode>
</pric:retrieveProductsPricing>
</soapenv:Body>
</soapenv:Envelope>
下面是我的PHP
$wsdl = "http://URL?wsdl";
$client = new SoapClient($wsdl, array('trace'=>1));
try
{
$options = array(
'soap_version'=>SOAP_1_2,
'exceptions'=>true,
'trace'=>1,
'cache_wsdl'=>WSDL_CACHE_NONE
);
$params = array(
'User name' => 'apiuser',
'Password' => 'pword',
'Postcode' => 'EC2R 7HP'
);
$response = $client->retrieveProductsPricing($params);
print_r($response);
}
catch(SoapFault $e)
{
print_r($e);
這是我第一次配置SOAP客戶端,所以我敢肯定,我在這都可能犯了一個錯誤。
是'用戶name'意思是'用戶名'或'用戶名'? – Yolo