下儎 nusoap-0.9.5
http://sourceforge.net/projects/nusoap/
include(‘nusoap-0.9.5/lib/nusoap.php’);
// 顯示錯誤
ini_set(“display_errors”, “On”);
error_reporting(E_ALL & ~E_NOTICE);
$xml = <<<XML
<?xml version=”1.0″ encoding=”utf-8″ ?>
<ORDER_DOC>
<ORDER>
<ECNO>263</ECNO>
<ODNO>00000000038</ODNO>
<STNO>F001558</STNO>
<AMT>500</AMT>
</ORDER>
<ORDERCOUNT>
<TOTALS>1</TOTALS>
</ORDERCOUNT>
</ORDER_DOC>
XML;
//<?
// 創建一個soapclient對象,參數是server的WSDL
$client = new soapclient(‘https://www.yourdomain.com/webservice/service.asmx?wsdl’, ‘wsdl’);
// 設定utf-8編碼
$client->soap_defencoding = ‘UTF-8’;
$client->decode_utf8 = false;
$client->encode_utf8 = true;
//錯誤訊息
if ($err=$client->getError()) {
print “ERROR: $err”;
}
// 呼叫遠端函數
$result = $client->call(‘ORDERS_ADD’,array(‘xmlStr’=>$xml));
// 接收回應
if ($client->fault)
{
echo ‘<h2>Fault</h2><pre>’;
print_r($result);
echo ‘</pre>’;
}
else
{
// Check for errors
$err = $client->getError();
if ($err)
{
// Display the error
echo ‘<h2>Error</h2><pre>’ . $err . ‘</pre>’;
}
else
{
// Display the result
echo ‘<h2>Result</h2><pre>’;
print_r($result);
echo ‘</pre>’;
}
}
SAMPLE
https://drive.google.com/file/d/0B0WjmRBDYP2fM1FhaFNSb3hYbUE/edit?usp=sharing
[……]