Meluncur Bos,  thanks



________________________________
Dari: Tsak <[email protected]>
Kepada: [email protected]
Terkirim: Kam, 13 Januari, 2011 09:42:27
Judul: Re: [indopb] Re: Web Service dengan Soap Connection

  
Alhamdulillah.. masalahnya sudah terpecahkan. Ternyata versi nusoapnya yang 
kadaluarsa dan script di PBnya yang harus di koreksi.   Untuk yang ingin nyoba 
buat web service di PHP dan fungsinya dipanggil oleh aplikasi PB, saya sharing 
contoh appnya.

Library nusoapnya bisa di download di:
http://sourceforge.net/projects/nusoap/files/nusoap/0.9.5/nusoap-0.9.5.zip/download


Script di PHP nya sbb:

<?php
require_once("libs/nusoap.php");
$ns="http://localhost/wsserver/";;
$server = new soap_server();
$server->configureWSDL('Calculator',$ns);
$server->wsdl->schemaTargetNamespace=$ns;
$server->register('ws_add',
array('int1' => 'xsd:integer','int2' => 'xsd:integer'), // input parameters
array('total' => 'xsd:integer'), // output parameter
$ns, // namespace
        "$ns#ws_add",                // soapaction
        'rpc',                             // style
        'encoded',                          // use
        'adds two integer values and returns the result'           // 
documentation
    );
//ws function
function ws_add($int1, $int2){
    $result = add($int1, $int2);
    return new soapval('total','xsd:integer', $result );
}
//function
function add($int1, $int2) {
return $int1 + $int2;
}
// service the methods
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : "";
$server->service($HTTP_RAW_POST_DATA);
?>

Script di PBnya:

SoapConnection conn 
test_calculatorport proxy_obj 
long rVal, lLog, ll_result
//the default endpoint inside proxystring str_endpoint
conn = create SoapConnection  
lLog = conn.SetOptions("SoapLog=~"C:\testSoapLog.log~"")
// Create proxy object
rVal = Conn.CreateInstance(proxy_obj,"test_calculatorport")
try
ll_result = proxy_obj.ws_add(70000,2003330)
messagebox("Web Service",string(ll_result))
catch ( SoapException e )
   messagebox ("Error", e.GetMessage()) 
end try
destroy conn


Ternyata simple. Thanks semuanya.

Salam,
TS
 

Kirim email ke