Hi Amitesh,
Can you try the same service without Sandesha and see that you get the fault
correctly.
Let us know.
Thanks,
-Jaliya
----- Original Message -----
From: "Amitesh Pandya" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, June 30, 2006 7:25 AM
Subject: SOAP-FAULT PROBLEM .. please help....
Hi there,
I can't believe no one has yet hit this problem or NO ONE has yet tried
it.
I'm sure there is a Solution to this problem. OR it is not a problem
(It's just me who is not using it properly :(
The problem is regarding sending a SOAPFault to the client from a
reliable service:
Description: Axis2 v1.0 + Sandesha2 v1.0
1) I have an IN-OUT HelloWorldECHO service.
2) I've generated this service from a WSDL using WSDL2JAVA script.
3) I've a Reliable client which invokes this service.
NORMAL invocation works perfect :)
NOW: I want to throw an exception from my service and want to see it
as a SOAPFAULT in my client.
In order to achive this I do the following things:
1) I throw an Exception from the Generated SKELETON class:
public class ReliableHelloWorldServiceSkeleton{
/**
* Auto generated method signature
*/
public HelloWorldDocument
helloWorld(HelloWorldDocument param0 ){
System.out.println("Message received in the ECHO Service
is == " + param0);
OMFactory fac = OMAbstractFactory.getOMFactory();
HelloWorldDocument hwDoc =
HelloWorldDocument.Factory.newInstance();
hwDoc.addNewHelloWorld().setInput("ECHO RESPONSE FROM
CLIENT.....");
throw new NullPointerException();
}
}
2) In the generated "InOut" class
(HelloWorldServiceMessageReceiverInOut.java) I don't do a lot but the
code of the "invokeBusinessLogic()" method is below:
public void invokeBusinessLogic(MessageContext msgContext,
MessageContext newMsgContext)throws AxisFault{
try {
// get the implementation class for the Web Service
Object obj = getTheImplementationObject(msgContext);
//Inject the Message Context if it is asked for
org.apache.axis2.engine.DependencyManager.configureBusinessLogicProvider(obj,
msgContext.getOperationContext());
ReliableHelloWorldServiceSkeleton skel =
(ReliableHelloWorldServiceSkeleton)obj;
//Out Envelop
org.apache.axiom.soap.SOAPEnvelope envelope = null;
//Find the axisOperation that has been set by the Dispatch
phase.
org.apache.axis2.description.AxisOperation op =
msgContext.getOperationContext().getAxisOperation();
if (op == null) {
throw new org.apache.axis2.AxisFault("Operation is
not
located, if this is doclit style the SOAP-ACTION should specified via
the SOAP Action to use the RawXMLProvider");
}
String methodName;
if(op.getName() != null & (methodName =
op.getName().getLocalPart()) != null){
if("helloWorld".equals(methodName)){
examples.webservices.reliable.HelloWorldDocument param3 = null;
//doc style
param3 =skel.helloWorld(
(examples.webservices.reliable.HelloWorldDocument)fromOM(
msgContext.getEnvelope().getBody().getFirstElement(),
examples.webservices.reliable.HelloWorldDocument.class,
getEnvelopeNamespaces(msgContext.getEnvelope())));
envelope =
toEnvelope(getSOAPFactory(msgContext), param3, false);
}
newMsgContext.setEnvelope(envelope);
}
}catch (Exception e) {
System.out.println("Reached the CATCH block of the INOUT");
System.out.println("NOW Throwing the Axis Exception");
throw org.apache.axis2.AxisFault.makeFault(e);
}
}
3) All I expect after this is to see that the "onError()" message get
invoked on my "callback"
at the client side. But I get this on the server side CONTINUOUSLEY:
[07/06/06 11:22:55:210 BST] 00000039 SystemOut O Message received
in the ECHO Service is ==
<helloWorld xmlns="http://examples/webservices/reliable"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<input>THIS IS A TEST MESSAGE FOR ===> ECHO</input>
</helloWorld>
[07/06/06 11:22:55:210 BST] 00000039 SystemOut O Reached the CATCH
block of the INOUT
[07/06/06 11:22:55:210 BST] 00000039 SystemOut O NOW Throwing the
Axis Exception
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R
org.apache.sandesha2.SandeshaException: reasonOFFault; nested
exception is:
java.lang.NullPointerException; nested exception is:
org.apache.axis2.AxisFault: reasonOFFault; nested exception is:
java.lang.NullPointerException
at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:199)
Caused by: org.apache.axis2.AxisFault: reasonOFFault; nested exception is:
java.lang.NullPointerException
at
my.test.serv.schemas.ReliableHelloWorldServiceMessageReceiverInOut.invokeBusinessLogic(ReliableHelloWorldServiceMessageReceiverInOut.java:71)
at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
at
org.apache.axis2.engine.AxisEngine.resumeReceive(AxisEngine.java:497)
at org.apache.axis2.engine.AxisEngine.resume(AxisEngine.java:543)
at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:189)
Caused by: java.lang.NullPointerException
at
my.test.serv.schemas.ReliableHelloWorldServiceSkeleton.helloWorld(ReliableHelloWorldServiceSkeleton.java:22)
at
my.test.serv.schemas.ReliableHelloWorldServiceMessageReceiverInOut.invokeBusinessLogic(ReliableHelloWorldServiceMessageReceiverInOut.java:56)
... 4 more
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:199)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R Caused by:
org.apache.axis2.AxisFault: reasonOFFault; nested exception is:
java.lang.NullPointerException
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
my.test.serv.schemas.ReliableHelloWorldServiceMessageReceiverInOut.invokeBusinessLogic(ReliableHelloWorldServiceMessageReceiverInOut.java:71)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
org.apache.axis2.engine.AxisEngine.resumeReceive(AxisEngine.java:497)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
org.apache.axis2.engine.AxisEngine.resume(AxisEngine.java:543)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:189)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R Caused by:
java.lang.NullPointerException
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
my.test.serv.schemas.ReliableHelloWorldServiceSkeleton.helloWorld(ReliableHelloWorldServiceSkeleton.java:22)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R at
my.test.serv.schemas.ReliableHelloWorldServiceMessageReceiverInOut.invokeBusinessLogic(ReliableHelloWorldServiceMessageReceiverInOut.java:56)
[07/06/06 11:22:55:225 BST] 00000039 SystemErr R ... 4 more
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R
org.apache.sandesha2.SandeshaException: Invalid message addition ,
operation context completed; nested exception is:
org.apache.axis2.AxisFault: Invalid message addition , operation
context completed
at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:199)
Caused by: org.apache.axis2.AxisFault: Invalid message addition ,
operation context completed
at
org.apache.axis2.description.InOutAxisOperation.addMessageContext(InOutAxisOperation.java:63)
at
org.apache.axis2.context.OperationContext.addMessageContext(OperationContext.java:85)
at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:35)
at
org.apache.axis2.engine.AxisEngine.resumeReceive(AxisEngine.java:497)
at org.apache.axis2.engine.AxisEngine.resume(AxisEngine.java:543)
at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:189)
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:199)
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R Caused by:
org.apache.axis2.AxisFault: Invalid message addition , operation
context completed
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R at
org.apache.axis2.description.InOutAxisOperation.addMessageContext(InOutAxisOperation.java:63)
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R at
org.apache.axis2.context.OperationContext.addMessageContext(OperationContext.java:85)
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:35)
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R at
org.apache.axis2.engine.AxisEngine.resumeReceive(AxisEngine.java:497)
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R at
org.apache.axis2.engine.AxisEngine.resume(AxisEngine.java:543)
[07/06/06 11:22:56:228 BST] 00000039 SystemErr R at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:189)
[07/06/06 11:22:57:247 BST] 00000039 SystemErr R
org.apache.sandesha2.SandeshaException: Invalid message addition ,
operation context completed; nested exception is:
org.apache.axis2.AxisFault: Invalid message addition , operation
context completed
at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:199)
Caused by: org.apache.axis2.AxisFault: Invalid message addition ,
operation context completed
at
org.apache.axis2.description.InOutAxisOperation.addMessageContext(InOutAxisOperation.java:63)
at
org.apache.axis2.context.OperationContext.addMessageContext(OperationContext.java:85)
at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:35)
at
org.apache.axis2.engine.AxisEngine.resumeReceive(AxisEngine.java:497)
at org.apache.axis2.engine.AxisEngine.resume(AxisEngine.java:543)
at
org.apache.sandesha2.workers.InOrderInvoker.run(InOrderInvoker.java:189)
QUESTIONS:
1) Is this the right way of throwing exception and receiveng SOAP Fault ?
2) If it is not then could you please suggest what should I do to get
the SOAPFault at the client side??
Thanks and Kind Regards
your help is greatly appreciated
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]