4.1 use PowerBuilder to call
For version 8.0, download Bulletin Web Services Toolkit 4.1
4.2 Use java to call
Download apache soap. : Http://xml.apache.org/soap/index.html
Import:
Import org. apache. soap .*;
Import org. apache. soap. rpc .*;
Routine:
Import java. io .*;
Import java. util .*;
Import java.net .*;
Import org. w3c. dom .*;
Import org. apache. soap. util. xml .*;
Import org. apache. soap .*;
Import org. apache. soap. encoding .*;
Import org. apache. soap. encoding. soapenc .*;
Import org. apache. soap. rpc .*;
Import org. apache. soap. transport. http. SOAPHTTPConnection;
Public class testClient {
Public static void main (String [] args) throws Exception {
URL url = new URL ("http: // 192.168.0.4/yundan/service1.wsdl ");
// Change it to your address
SOAPMappingRegistry smr = new SOAPMappingRegistry ();
StringDeserializer sd = new StringDeserializer ();
Smr. mapTypes (Constants. NS_URI_SOAP_ENC, new QName ("", "Result"), null, null, sd );
// Create the transmission path and Parameters
SOAPHTTPConnection st = new SOAPHTTPConnection ();
// Create a call
Call call = new Call ();
Call. setSOAPTransport (st );
Call. setSOAPMappingRegistry (smr );
Call. setTargetObjectURI ("http://tempuri.org/message ");
Call. setMethodName ("addNumbers ");
Call. setEncodingStyleURI ("http://schemas.xmlsoap.org/soap/encoding ");
Vector params = new Vector ();
Params. addElement (new Parameter ("NumberOne", Double. class, "10", null ));
Params. addElement (new Parameter ("NumberTwo", Double. class, "25", null ));
Call. setParams (params );
Response resp = null;
Try {
Resp = call. invoke (url, "http://tempuri.org/action/Hello2.addNumbers ");
}
Catch (SOAPException e ){
System. err. println ("Caught SOAPException (" + e. getFaultCode () + "):" + e. getMessage ());
Return;
}
// Check the return value
If (resp! = Null &&! Resp. generatedFault ()){
Parameter ret = resp. getReturnValue ();
Object value = ret. getValue ();
System. out. println ("Answer -->" + value );
}
Else {
Fault fault = resp. getFault ();
System. err. println ("Generated fault :");
System. out. println ("Fault Code =" + fault. getFaultCode ());
System. out. println ("Fault String =" + fault. getFaultString ());
}
}
}