StaxOMBuilder Elements Attributes

2008-03-03 Thread Inman, Peter
Can someone help - 

 

For the past few days I've been looking into a problem with a WS built
from WSDL using WSDL2Java, XMLBeans databindings and Axis2 deployed on
Weblogic 8.1.

 

I've been receiving SOAP messages, creating the response xmlbeans
object, and returning that to the client - this is where the problem has
been happening.

 

I've been getting the exception below from the StAXOMBuilder class and
specifically the next() method.

 

I've taken the AXIOM source code and modified it to add some debugging
code. What I found was that the data coming into the next() method was
actually an ATTRIBUTE and not one of the options that is included in the
case statement in the next() method. The exception below was coming from
the default part of the case statement which simply threw an
OMException.

 

I'm not that familiar with the AXIOM code, so I simply added in an extra
case statement to pick up an attribute - my code now works, and my SOAP
response is correctly formatted.

 

All I did to the next() method was add the following

 

Case XMLStreamConstants.ATTRIBUTE:

  System.out.println..

  Break;

 

If I display the attributeLocalName, it's shown as nil

 

I've written some test code outside WebLogic to simulate what my web
service is doing and I can't recreate it which made me thing that it's
server specific, so I tried on tomcat, and the problem is the same, so
it's not app server specific.

 

Have I done something wrong, or have I for some reason found a bug??

 

org.apache.axis2.AxisFault

  at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)

  at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.in
vokeBusinessLogic(EXTSYS2CERSServiceTxMessageReceiverInOut.java:601)

  at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusine
ssLogic(AbstractInOutSyncMessageReceiver.java:42)

  at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:96)

  at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)

  at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(HTTPTransportUtils.java:275)

  at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)

  at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

  at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

  at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Se
rvletStubImpl.java:1077)

  at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:465)

  at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:348)

  at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:7047)

  at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)

  at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121
)

  at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:3902)

  at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:2773)

  at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)

  at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

Caused by: org.apache.axiom.om.OMException#xd;

  at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:2
33)

  at
org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocu
mentImpl.java:130)

  at
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOM
Builder.java:359)

  at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.to
OM(EXTSYS2CERSServiceTxMessageReceiverInOut.java:960)

  at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.to
Envelope(EXTSYS2CERSServiceTxMessageReceiverInOut.java:1545)

  at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.in
vokeBusinessLogic(EXTSYS2CERSServiceTxMessageReceiverInOut.java:210)

  ... 17 more



XMLBeans AXIS2 Responses

2008-02-29 Thread Inman, Peter
I'm working with a web service that someone else has designed and I have
to host one or two operations.

 

I'm using AXIS2  XMLBeans databindings.

 

I've got one operation in my *skeleton class which returns a complex
type. 

 

I've set the object up correctly in my skeleton class, and if you invoke
the .xmlText method, you get correctly formatted XML and I can also get
values correctly from the XMLBeans objects.

 

The problem comes though when this is returned through AXIS to the
client - the XML that gets returned has no data in it and simply
contains the text unknown - but looking closer, it's an AxisFault
that's returned not the response I expect.

 

I've done some digging and found some options in the axis2.xml which
gives me more details on the exception I'm getting.

 

Would anyone be able to suggest what I need to do to fix this?

 

Dumping the XML just prior to this exception shows and it all looks ok.

 

xml-fragment xsi:nil=true
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;typ:CERS2EXTSYS_H
azmat_Request_Ack xmlns:typ=urn:hazreq/typestyp:ack_msg
CERSRefId=12736383783 StatusCode=Ok

 StatusMessage=Message Processed
Succesfully!//typ:CERS2EXTSYS_Hazmat_Request_Ack/xml-fragment

 

?xml version='1.0' encoding='utf-8'?soapenv:Envelope
xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/;soapenv:Body
soapenv:Faultfaultcodesoapenv:Server/faultcodefaultstringunknown

/faultstringdetailExceptionorg.apache.axis2.AxisFault#xd;

at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)#xd;

at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.in
vokeBusinessLogic(EXTSYS2CERSServiceTxMessageReceiverInOut.java:599)#xd
;

at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusine
ssLogic(AbstractInOutSyncMessageReceiver.java:42)#xd;

at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessa
geReceiver.java:96)#xd;

at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)#xd;

at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(HTTPTransportUtils.java:275)#xd;

at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:120)
#xd;

at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)#xd;

at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)#xd;

at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Se
rvletStubImpl.java:1077)#xd;

at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:465)#xd;

at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.
java:348)#xd;

at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.r
un(WebAppServletContext.java:7047)#xd;

at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)#xd;

at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121
)#xd;

at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServl
etContext.java:3902)#xd;

at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.
java:2773)#xd;

at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)#xd;

at
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)#xd;

Caused by: org.apache.axiom.om.OMException#xd;

at
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:2
33)#xd;

at
org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocu
mentImpl.java:130)#xd;

at
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOM
Builder.java:359)#xd;

at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.to
OM(EXTSYS2CERSServiceTxMessageReceiverInOut.java:947)#xd;

at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.to
Envelope(EXTSYS2CERSServiceTxMessageReceiverInOut.java:1522)#xd;

at
com.mcpplc.destin8.cers.soap.EXTSYS2CERSServiceTxMessageReceiverInOut.in
vokeBusinessLogic(EXTSYS2CERSServiceTxMessageReceiverInOut.java:208)#xd
;

... 17 more#xd;

/Exception/detail/soapenv:Fault/soapenv:Body/soapenv:Envelope

]



RE: newbie confusion

2008-02-28 Thread Inman, Peter
Thanks very much for your help, which makes perfect sense.

 

In the WSDL I'm working with, I have soap faults defined like

 

wsdl:fault name=CERSErrorErr

   soap:fault name=CERSErrorErr
use=literal/

/wsdl:fault

 

When I create and return one of those objects, it gets turned into the
correct exception and works beautifully. I do that by a throw
CERSErrorErr statement in my skeleton code and I don't have to do
anything else apart from set the properties. The 

 

If I try and move the validation into the handler which is the best
place for it, I'm not able to do a throw CERSErrorErr as the handler
will only throw AxisFaults and the CERSErrorErr class extends
java.lang.Exception. 

 

I realise I'm missing something pretty obvious - but can anyone suggest
what I need to do look at, to be able to throw my correct exceptions.

 

Thanks

 

 

 

 

 

 



From: Amila Suriarachchi [mailto:[EMAIL PROTECTED] 
Sent: 28 February 2008 11:35
To: axis-user@ws.apache.org
Subject: Re: newbie confusion

 

 

On Thu, Feb 28, 2008 at 5:19 AM, Inman, Peter [EMAIL PROTECTED]
wrote:

I'm new to AXIS2, and I have to develop a web service which someone else
has supplied the WSDL, We also have to host a couple of operations as
well as make calls to them.

 

I have used WSDL2Java to generate the client code and service skeleton
and I have also deployed a service and put some debugging code in the
skeleton to verify that the methods can be called. SO far, all seems to
work ok.

 

With one particular operation, I have to validate the incoming SOAP
message against the schema using XMLBeand and either return a
CERSErrorDocument or a SOAPFaultException with details of the
exception in it. This is where my confusion starts.

 

I thought I would build a module (handler) and validate the SOAP message
here. This works fine and seems quite a tidy way of doing things.

 

The problem I'm having is - how do exceptions get out of the handler and
back to the client? Do I just throw them out of the handler?

you can throw AxisFaults from handlers. set the AxisFault details
element correctly. this will added to the soap fault details element. 

 

Also - if the SOAP message is valid, I return an acknowledge
document, if it's invalid I return a SOAPFaultException - do I return
those out of the handler too?


No you can do this at the Skelton and send the throw an Exception. Here
set the exception message element correctly.

 

Where is the best place to handle this kind of thing? The
module(handler) seems quite tidy, but I'm obviously missing the bit of
information which tells me how exceptions are handled from modules.

 

Or - should I modify the MyServiceSkeleton.java class and put
the validation and logic in that.

 

Any advice would be appreciated.

 

Thanks,

Pete

 

 




-- 
Amila Suriarachchi,
WSO2 Inc. 



newbie confusion

2008-02-27 Thread Inman, Peter
I'm new to AXIS2, and I have to develop a web service which someone else
has supplied the WSDL, We also have to host a couple of operations as
well as make calls to them.

 

I have used WSDL2Java to generate the client code and service skeleton
and I have also deployed a service and put some debugging code in the
skeleton to verify that the methods can be called. SO far, all seems to
work ok.

 

With one particular operation, I have to validate the incoming SOAP
message against the schema using XMLBeand and either return a
CERSErrorDocument or a SOAPFaultException with details of the
exception in it. This is where my confusion starts.

 

I thought I would build a module (handler) and validate the SOAP message
here. This works fine and seems quite a tidy way of doing things.

 

The problem I'm having is - how do exceptions get out of the handler and
back to the client? Do I just throw them out of the handler?

 

Also - if the SOAP message is valid, I return an acknowledge document,
if it's invalid I return a SOAPFaultException - do I return those out of
the handler too?

 

Where is the best place to handle this kind of thing? The
module(handler) seems quite tidy, but I'm obviously missing the bit of
information which tells me how exceptions are handled from modules.

 

Or - should I modify the MyServiceSkeleton.java class and put the
validation and logic in that.

 

Any advice would be appreciated.

 

Thanks,

Pete