axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shrish Mishra <shrish.mis...@gmail.com>
Subject [Axis2] Problem with client side exceptions
Date Tue, 13 Nov 2007 17:57:06 GMT

I have finally figured out a workaround.As described in the mail below we get
tag <soapenv:Detail /> as blank at client, so exceptions are not created at
client side, and they are thrown as axisfault. Looking back at the server
side generated code I figured out that to populate detail tag, it needs
information from the exception which could be string or a bean object, and
if it is present then it creates proper <detail> tag and at client side the
exception are regenerated.
So add following code to your exception class. Set message in exception
before throwing. It works fine, I tried that !!

	private String faultMessage;

	public void setFaultMessage(String faultMessage) {
		this.faultMessage = faultMessage;
	}

             public String getFaultMessage() {
		return faultMessage;
	}

Shrish Mishra wrote:
> 
> 
> 
> I also have the same problem. I could not get back the original exception
> at client side. I tried using sample/faulthandling code with the axis2
> distribution and it works fine. But now the problem is, this example
> generates client side and server side code from the wsdl ... but the
> source code (service code) from which  this wsdl was generated is not
> present with the distribution:
> 
> In the faulthandinling example it soap message has exception information
> in the <detail></detail> tag
> 
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> xmlns:soapenv="http://sc
> hemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapen
> v:Server</faultcode><faultstring>Account does not
> exist!</faultstring><detail><n
> s1:AccountNotExistFault
> xmlns:ns1="http://example"><ns1:account>13</ns1:account>
> </ns1:AccountNotExistFault></detail></soapenv:Fault></soapenv:Body></soapenv:Env
> elope>
> 
> So soap engine is able to read and regenerate the exception. but when I
> tried with my service implementaion this information does not come in the
> soap message rather it comes in the header of the http response as action
> but <detail></detail> tag is empty. Please See below
> 
> HTTP/1.1 500 Internal Server Error
> Server: Apache-Coyote/1.1
> Content-Type: application/soap+xml;
> action="urn:testExceptionMyCheckedException"
> ;charset=UTF-8
> Transfer-Encoding: chunked
> Date: Wed, 07 Nov 2007 01:46:49 GMT
> Connection: close
> 
> 187
> <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
> xmlns:soapenv="http://ww
> w.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault><soapenv:Code><soap
> env:Value>soapenv:Receiver</soapenv:Value></soapenv:Code><soapenv:Reason><soapen
> v:Text xml:lang="en-US">Checked Exception thrown
> !!</soapenv:Text></soapenv:Reas
> on><soapenv:Detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
> 0
> 
> Can someone please give me some pointer or at lease provide the source
> code for that faulthanding example.
> 
> Thanks !!
> 
> 
> 



-- 
View this message in context: http://www.nabble.com/Problem-with-client-side-exceptions-tf4384590.html#a13731091
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message