Hi all,
I am experiencing a problem when trying to call a web service from a
web service. Here is my example code:
public class CallbackService {
public RPCServiceClient client = null;
public void addClient(String url) throws AxisFault {
RPCServiceClient agentClient = new RPCServiceClient();
EndpointReference targetEPR = new EndpointReference(url);
Options options = agentClient.getOptions();
options.setTo(targetEPR);
client = agentClient;
System.out.println("Client added: "+url);
System.out.println("Testing echo");
try {
testWSCall();
} catch (Exception e) {
System.out.println("\nError making call:\n");
e.printStackTrace();
}
}
public void testWSCall(){
QName opCallback = new QName("http://question.axis","echo");
Object[] arg = new Object[] {"Direct Callback"};
try {
client.invokeRobust(opCallback,arg);
System.out.println("[direct] Called client back");
} catch (AxisFault e) {
System.out.println("Error sending call");
e.printStackTrace();
}
}
}
The class above is exposed as a web service using the POJO deployment.
The job of this class is to call the "client" web service:
package axis.question;
public class Client {
public void echo(String message){
System.out.println(message);
}
}
This is another very simple POJO service. The test runner:
public class TestRunner {
public static void main(String[] args) {
try {
RPCServiceClient serverClient = new RPCServiceClient();
EndpointReference targetEPR = new
EndpointReference("http://localhost:8080/axis/services/callbackService");
Options options = serverClient.getOptions();
options.setTo(targetEPR);
QName opRegister = new QName("http://question.axis",
"addClient");
Object[] arg = new Object[] {
"http://localhost:8080/axis/services/callbackClient" };
serverClient.invokeRobust(opRegister, arg);
System.out.println("Registered the client to the
server");
} catch (AxisFault e) {
e.printStackTrace();
}
}
}
Calls the callback service, which will make a web service call to the
client. However, the call fails and throws an exception:
Error sending call
org.apache.axis2.AxisFault: The server failed to process the
WS-Addressing header: wsa:Action [Reason]: A header representing a
Message Addressing Property is not valid and the message cannot be
processed
at
org.apache.axis2.handlers.addressing.AddressingInFaultHandler.invoke(AddressingInFaultHandler.java:114)
at org.apache.axis2.engine.Phase.invoke(Phase.java:292)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:212)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:132)
at
org.apache.axis2.description.RobustOutOnlyAxisOperation$RobustOutOnlyOperationClient.handleResponse(RobustOutOnlyAxisOperation.java:90)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at
org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:454)
at
org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:434)
at
org.apache.axis2.rpc.client.RPCServiceClient.invokeRobust(RPCServiceClient.java:157)
at axis.question.CallbackService.testWSCall(CallbackService.java:34)
at axis.question.CallbackService.addClient(CallbackService.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:98)
at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:96)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
So why is it that when the TestRunner makes a web service call it
succeeds, but when making a call from one web service to another a
failure occurs?
I have done some debugging with the Axis2 source, and it seems that
the SOAP header being passed is incorrect. My theory is that because
the call to the client service is done within Axis, some incorrect
context information is being passed somehow.
Any thoughts?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]