You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Tibeau Jacques <j_...@hotmail.com> on 2001/08/27 16:08:47 UTC
element must contain a: 'faultcode' element
Hi
I'm testing a very simple SOAP test program.
But the very same program that once worked perfectly on
SOAP 2.0 now returns the following error message with SOAP
2.2.
[Error message]
Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Client; msg=A 'htt
p://schemas.xmlsoap.org/soap/envelope/:Fault' element must contain a: 'faultcode
' element.; targetException=java.lang.IllegalArgumentException: A 'http://schema
s.xmlsoap.org/soap/envelope/:Fault' element must contain a: 'faultcode' element.
]
at org.apache.soap.rpc.Call.invoke(Call.java:181)
at TestClient.main(TestClient.java:20)
Is there any change I have to take into consideration in order to
migrate SOAP 2.0 source code to 2.2? Here's my test program.
/*******[My test web service]*********/
public class TestService {
public int add(int num1, int num2) {
return num1 + num2;
}
}
/*******[My test client]************/
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import java.net.URL;
import java.util.Vector;
public class TestClient {
public static void main(String[] args) throws Exception {
Call call = new Call ();
call.setTargetObjectURI("urn:testservice");
call.setMethodName ("add");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector ();
params.addElement (new Parameter("num1", Integer.class, args[1], null));
params.addElement (new Parameter("num2", Integer.class, args[2], null));
call.setParams (params);
Response resp = call.invoke (new URL(args[0]), "");
Parameter result = resp.getReturnValue ();
System.out.println (result.getValue ());
}
}
Any suggestion would be highly appreciated.
TIA,
j