0
我有以下肥皂字符串。如何將soap作爲字符串傳遞給php soapclient
$str = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">';
$str .= '<soapenv:Header/>';
$str .= '<soapenv:Body>';
$str .= '<Username>uname1</Username>';
$str .= '<Password>upassword1</Password>';
$str .= '<RequestType>GetDiamonds</RequestType>';
$str .= '<ClientId>51</ClientId>';
$str .= '<MySoapReq>';
$str .= '<Params>';
$str .= '<Diamond_ID>%18112%</Diamond_ID>';
$str .= '<Diamond_ID>%1625%</Diamond_ID>';
$str .= '<Diamond_ID>%18625%</Diamond_ID>';
$str .= '</Params>';
$str .= '</MySoapReq>';
$str .= '</soapenv:Body>';
$str .= '</soapenv:Envelope>';
我想以下面的方式調用它,但沒有得到如何將字符串傳遞給肥皂請求。
$client = new SoapClient(null, array('location' => 'http://localhost:8080/testsoap',
'uri'=>'http://localhost:8080/testsoap'
));
我也嘗試在這裏給用戶名和密碼,但它沒有工作,然後我試着下面。
$return = $client->__soapCall("GetDiamonds",
array(new SoapParam($str))
);
任何建議如何我可以傳遞上面的字符串在肥皂請求和獲得迴應?我是以正確的方式做還是應該有其他方法呢?