axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhanu Pabreja" <pabr...@infigroup.com>
Subject RE: Message Style Service and Exception Handling
Date Tue, 15 Jul 2003 20:49:52 GMT
i am not returning but throwing the exception ...

I just coded a method and returned the exception in the main exception block
and threw it from there. Made a method cause my document could have muliple
conditions so did not want to write the same code everywhere ...

But yes I am throwing the exception and there is not SOAP response envelope
on the response side of the SOAP Monitor.

Bhanu Pabreja
  -----Original Message-----
  From: remko de knikker [mailto:remko.deknikker@yale.edu]
  Sent: Tuesday, July 15, 2003 3:43 PM
  To: axis-user@ws.apache.org
  Subject: Re: Message Style Service and Exception Handling


  Hmm, that's right, you don't see any Response on the TCPMonitor (I assume
that means you see a Request ofcourse).
  I see that you write

            return new RemoteException(ex.toString()what happens if you
throw the exception (ie what i did in my exception handling) instead of
returning it?

            throw ex;

  I am almost exhausted as far as suggestions...

  PS
  I am using Java, and call the invoke() method to call the web service,
this method throws an AxisFault/RemoteException, see API.
  There's an architecture manual on Axis on the apache.org site to see the
concept in abstraction.

  r


  Bhanu Pabreja wrote:

    but I dont see the response in the SOAPMonitor itself. I mean if there
was something like a exception alteast some response should have taken place
and should have shown in the monitor. I did not even see the response
envelope.

    Expalin the AxisFault scenario a littel bit more ... cause the invoke()
method is invoked at the cleint.

    and your client is on .NET so u dont even have the invoke() call.

    How is it working ...

    Bhanu Pabreja
      -----Original Message-----
      From: remko de knikker [mailto:remko.deknikker@yale.edu]
      Sent: Tuesday, July 15, 2003 3:02 PM
      To: axis-user@ws.apache.org
      Subject: Re: Message Style Service and Exception Handling


      Actually, it was on IIS/.NET I believe, where you can set priority to
exception handling either by the server or the application, so forget about
what I said about it, I don't know if Tomcat/Java can do the same.

      I checked on my Client, where I was just catching the Exception
instead of trying to get to the MessageContext's SOAPBody etc...
      and I guess you're right: you cannot access the MessageContext from
the client.
      I assume what happens is that Axis 'serializes' the fault
automatically and throws an AxisFault instead, which is what the invoke
method does according to the API (Axis 1.1).

      On the other hand all information is accessible through the AxisFault.
I agree that it would be nicer to be able to get the SOAPFault, while it's
easier to just catch the AxisFault.

      PS: for copying in the TCPMonitor I just use <ctrl>+C


      Bhanu Pabreja wrote:

        what do you mean my server is configured to override and handle the
exception. I mean if the response is with flow and no exception is thrown
then the SOAP response is perfectly norman but it is only on the event of an
exception that the SOAPMonitor shows the status as ACTIVE and nothing shows
up on the response text area.

        Well could you access the SOAPBody on the client end ...?? If you
see this response in your monitor there seems to be no problem to access the
SOAPBody and then eventually the SOAPFault element but then I dont see
anything in SOAPMonitor and eventually my SOAPBody also does not show up on
the client.

        Can you post your client also and which version of axis are you
using ...

        If you want I can send you the screen shot of my SOAPMonitor but
this is really buggy ... and I am stuck and writing my own exception and
sending it as a Document object.

        Thanx for the input ...

        dumdum420

          -----Original Message----[Bhanu Pabreja]  -
          From: remko de knikker [mailto:remko.deknikker@yale.edu]
          Sent: Tuesday, July 15, 2003 12:16 PM
          To: axis-user@ws.apache.org
          Subject: Re: Message Style Service and Exception Handling


          I don't seem to have a problem with it.

          here's my example which creates a SOAPResponse on the SOAPMonitor.
Could it be that your server is configured to override and handle the
exception, I remember that I once had that issue, although I am no expert on
this.

          import javax.xml.soap.SOAPBody;
          import javax.xml.soap.SOAPFault;

          public Document method2(Document request) throws Exception{
          try {
          ohno
          } catch (Exception e1) {
                      logGetUMLS.info(e1.getMessage());
                      String errormsg = e1.getMessage();
                      logGetUMLS.info( "Error: " + errormsg);
                      sb1 =
MessageContext.getCurrentContext().getResponseMessage().getSOAPPart().getEnv
elope().getBody();
                      SOAPFault fault = sb1.addFault();
                      fault.setFaultString("Exception: " + errormsg);
                      fault.setFaultCode("Server");
                      throw e1;
                  }
          return doc;
          }

          HTTP/1.1 500 Internal Server Error?
          Content-Type: text/xml; charset=utf-8?
          Date: Tue, 15 Jul 2003 16:10:48 GMT?
          Server: Apache Coyote HTTP/1.1 Connector [1.0]?
          Connection: close?
          ?
          <?xml version="1.0" encoding="UTF-8"?>
             <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <soapenv:Body>
                   <soapenv:Fault>
                      <faultcode>soapenv:Server.userException</faultcode>
                      <faultstring>java.lang.Exception: Test
Exception</faultstring>
                      <detail/>
                   </soapenv:Fault>
                </soapenv:Body>
             </soapenv:Envelope>



          Bhanu Pabreja wrote:

Posted:
http://nagoya.apache.org/bugzilla/long_list.cgi?buglist=21578

Bhanu

-----Original Message-----
From: Davanum Srinivas [mailto:dims@yahoo.com]
Sent: Monday, July 14, 2003 12:23 PM
To: Bhanu Pabreja; axis-user@ws.apache.org
Subject: RE: Message Style Service and Exception Handling


Please open a bug report - http://ws.apache.org/axis/bugs.html

-- dims

--- Bhanu Pabreja <pabreja@infigroup.com> wrote:
  Thanx for the input but this also does not work. Infact no SOAPResponse is
generated on the SOAPMonitor. Looks like in case of message style service
there are no capabilities to generate SOAPFault which is actually a MUST
element by w3c in case of a  exception.

These are my observations but if someone has a working example which is
MessageStyle based and which propgates exception back to the client using
the SOAPFault or AxisFault it will really help me since I am stuck with
    this
  grave issue.

Thanx in advance.

dumdum420

-----Original Message-----
From: Davanum Srinivas [mailto:dims@yahoo.com]
Sent: Monday, July 14, 2003 7:42 AM
To: axis-user@ws.apache.org
Subject: Re: Message Style Service and Exception Handling


Try this...

   AxisFault af = AxisFault.makeFault(ex);
   // Do whatever you want with AxisFault
   ....
   throw af;

-- dims

--- Bhanu Pabreja <pabreja@infigroup.com> wrote:
    Hello Everyone,

I have a MessageStyle service  which has the following signatures:

	Document sendData(Document doc) throws RemoteException{}

Everything works fine till I get an exception:

I wrote a method like this where I access the SOAPBody on the server
      side
  and set the faultString and errorCode and return it to the client.

public static RemoteException setSOAPFaultElement(Exception ex) throws
RemoteException{
		try{
		javax.xml.soap.SOAPBody   sb1 =  null;
		sb1 =


MessageContext.getCurrentContext().getResponseMessage().getSOAPPart().getEnv
  elope().getBody();
		System.out.println(sb1.getClass());
            javax.xml.soap.SOAPFault fault = sb1.addFault();
            fault.setFaultString("Exception " + ex.toString());
            System.out.println(fault.getFaultString());
            fault.setFaultCode("Server");
            System.out.println("Exception is being set in the fault
      body");
                return new RemoteException(ex.toString());
		}catch(SOAPException e){
            throw new RemoteException(ex.toString());
		}
	}


But on the client side when I get an exception and in the Exception
      block
  I
    try to access the exception from the SOAPBody object I get a
NullPointerExcption and the SOAPBody is empty.

Then probing further I turned on the SOAPMonitor and discovered that the
there was no response message in cases where there is exception.

Thus what I cannnot figure out it is how are exception handled in
      context
  of
    MessageStyle webservices.

Any pointers will really help.

Bhanu Pabreja.


      =====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com




=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com










Mime
View raw message