1
首先,我是肥皂的初學者。如何使這個確切的肥皂呼叫?
我正在嘗試對服務進行一次soap調用,並給出了一個來自talend的工作示例。我需要的是在PHP中進行類似的調用。
從拓藍的輸出如下,(從HTTP請求中提取)
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<root>
<request>
<username>[email protected]</username>
<password>md5sumlookalike</password>
<webservice>GetCust</webservice>
<refid>12343321</refid>
<message>reserv#123</message>
</request>
</root>
</soap:Body>
</soap:Envelope>
所以我寫PHP的一點點,因爲它可以作爲一種腳本語言,以及爲在那裏將來自被稱爲。試圖瞭解如何製作肥皂電話,我想出了這一點。
<?php
// Yes I know about the diffrent port issue here. So I wgeted and stored it for use next to script
# $soapClient = new SoapClient("http://123.123.123.123:8088/services", array("trace" => true));
$soapClient = new SoapClient("wsdl", array("trace" => true));
$error = 0;
try {
$info = $soapClient->__soapCall("invoke",
array
(
new SoapParam("[email protected]", "username"),
new SoapParam("md5sumish", "password"),
new SoapParam("GetCust", "webservice"),
new SoapParam("1234321", "refid"),
new SoapParam("reserv#123", "message")
)
);
} catch (SoapFault $fault) {
$error = 1;
echo 'ERROR: '.$fault->faultcode.'-'.$fault->faultstring;
}
if ($error == 0) {
print_r($output_headers);
echo 'maybe it worked\n';
unset($soapClient);
}
?>
我最終通過wireshark在HTTP請求中看到以下內容。服務器只是不知道該怎麼做,並沒有迴應。我不確定我需要從哪裏出發。
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://talend.org/esb/service/job">
<SOAP-ENV:Body>
<ns1:invokeInput>[email protected]</ns1:invokeInput>
<password>md5sumish</password>
<webservice>GetCust</webservice>
<refid>1234321</refid>
<message>reserv#123</message>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
所以我不得不問的是如何擺脫ns1:invokeInput並使其用戶名。隨着格式的其餘部分變成一行,請求看起來像talend的輸出?