Hi,
this simple
code:
public static
void main( String[] args) {
try
{
//URL url = new URL(http://localhost/csp/demos/WS.Calc.cls);
URL url = new URL("http://localhost:8080/csp/demos/WS.Calc.cls");
String urn = "";
//URL url = new URL(http://localhost/csp/demos/WS.Calc.cls);
URL url = new URL("http://localhost:8080/csp/demos/WS.Calc.cls");
String urn = "";
// Build the call.
Call call = new Call();
Call call = new Call();
call.setTargetObjectURI("http://tempuri.org/webservices/WS.Calc.Add");
call.setMethodName ("Add");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector ();
params.addElement (new Parameter("a", Float.class, new Float(1), null));
params.addElement (new Parameter("b", Float.class, new Float(2), null));
call.setParams (params);
call.setMethodName ("Add");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector ();
params.addElement (new Parameter("a", Float.class, new Float(1), null));
params.addElement (new Parameter("b", Float.class, new Float(2), null));
call.setParams (params);
// make the call: note that the
action URI is empty because the
// XML-SOAP rpc router does not need this. This may change in the
// future.
Response resp = call.invoke (/* router URL */ url, /* actionURI */ urn );
// XML-SOAP rpc router does not need this. This may change in the
// future.
Response resp = call.invoke (/* router URL */ url, /* actionURI */ urn );
// Check the
response.
if (resp.generatedFault ()) {
Fault fault = resp.getFault ();
System.out.println ("Ouch, the call failed: ");
System.out.println (" Fault Code = " + fault.getFaultCode ());
System.out.println (" Fault String = " + fault.getFaultString ());
} else {
Parameter result = resp.getReturnValue ();
System.out.println (result.getValue ());
}
if (resp.generatedFault ()) {
Fault fault = resp.getFault ();
System.out.println ("Ouch, the call failed: ");
System.out.println (" Fault Code = " + fault.getFaultCode ());
System.out.println (" Fault String = " + fault.getFaultString ());
} else {
Parameter result = resp.getReturnValue ();
System.out.println (result.getValue ());
}
} catch (Exception e)
{
e.printStackTrace();
}
e.printStackTrace();
}
puts
<SOAP-ENV:encodingStyle ..> tag into envelope's body.
<?xml version="1.0" encoding="UTF-8"
?>
- <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
Why? Is this a bug
or do I miss something?
Thanks a lot for any
help
Dan