axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patc <pat.consid...@fineos.com>
Subject Re: Axis2 Namespace lookup error throw when I access the MessageContext in handler on client service request (JAXB RI databinding)
Date Wed, 09 Jan 2008 10:16:04 GMT


Hi there

I think this issue is caused by the following bug (in the JAXB RI generated
stub code):
https://issues.apache.org/jira/browse/AXIS2-3232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Going to try the suggested code workaround, and will close if it fixes
problem

Pat



patc wrote:
> 
> 
> 
> Hi there
> 
> I have encountered a problem when accessing the MessageContext on a client
> request handler.  What I am attempting to do is log the payload when the
> client makes a service request.  The client is an Axis2 stub, generated by
> the WSDLtoJava utility with JAXB RI as the databinding.
> 
> The client request works fine (reaches endpoint) when my custom module is
> not engaged.  The problem occurs when I add my own custom handler which
> just logs the payload:
> 
> public class ProcessRequestHandler extends AbstractHandler implements
> Handler {
>     ….
>     public InvocationResponse invoke(MessageContext msgContext) throws
> AxisFault {
>     	System.out.println("Payload " + msgContext.getEnvelope().toString());    	
>         return InvocationResponse.CONTINUE;        
>     }
> }
> 
> The client_axis2.xml configures the handler as follows:
> 
>     <phaseOrder type="OutFlow">
>         <!--      user can add his own phases to this area  -->
>         <phase name="soapmonitorPhase"/>
>         <phase name="OperationOutPhase"/>
>         <!--system predefined phase-->
>         <!--these phase will run irrespective of the service-->
>         <phase name="RMPhase"/>
>         <phase name="PolicyDetermination"/>
>         <phase name="MessageOut"/>		
>         <phase name="Security"/>
>         <phase name="ProcessRequestPhase"/>		
>     </phaseOrder>
> 
> When the client makes a request with the custom module engaged, the
> following error occurs:
> 
> com.fineos.ta.test.functests.AnyTest.AnyTest_0001java.lang.RuntimeException:
> Element namespace from data source is
> http://servicetypes.garageservices.test.ta.fineos.com, not the expected 
> 	at
> org.apache.axiom.om.impl.llom.OMSourcedElementImpl.forceExpand(OMSourcedElementImpl.java:184)
> 	at
> org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:568)
> 	at
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:772)
> 	at
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:756)
> 	at
> org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:210)
> 	at
> org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:756)
> 	at
> org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:345)
> 	at
> org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:913)
> 	at
> com.fineos.ta.test.garageservices.handlers.ProcessRequestHandler.invoke(ProcessRequestHandler.java:54)
> 	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.send(AxisEngine.java:377)
> 	at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
> 	at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
> 	at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
> 	at
> com.fineos.ta.test.garageservices.soap.GarageServicesStub.createGarageCompany(GarageServicesStub.java:174)
> 
> I had a look at the Axiom 1.2.5 source and found the following method in
> org.apache.axiom.om.impl.llom.OMSourceElementImpl, which throws the
> exception:
> 
> private void forceExpand() {
> 		…
> 		…
>             String readerURI = readerFromDS.getNamespaceURI();
>             readerURI = (readerURI == null) ? "" : readerURI;
>             String uri = getNamespace().getNamespaceURI();
>             if (!readerURI.equals(uri)) {
>                 log.error("forceExpand: expected element namespace " +
>                         getLocalName() + ", found " + uri);
>                 throw new RuntimeException("Element namespace from data
> source is " +
>                         readerURI + ", not the expected " + uri);
>             }
> }
> 
> The above code segment would suggest namespace lookups are not working
> correctly.  I did think maybe it was my namespaces in the WSDL or the JAXB
> RI binding types were the problem, but if my namespaces were incorrect, I
> would not expect the normal (non custom handler) client invocation to
> succeed.
> 
> From debugging the code I have found that the above method only gets
> called when my custom handler is configured on.  I guess my real question
> is why when I access the MessageContext in a handler does it behave
> differently?  The MessageContext surely gets accessed at some stage in the
> normal (no custom handler) client invocation, so is there something I am
> missing, or am I accessing the MessageContext too early, or am I just
> doing something wrong?  I originally encountered the problem when trying
> to enable WS-Security (using rampart), but the above is the simplest
> scenario I could come up with.
> 
> Any help greatly appreciated…
> 
> Pat
> 

-- 
View this message in context: http://www.nabble.com/Axis2-Namespace-lookup-error-throw-when-I-access-the-MessageContext-in-handler-on-client-service-request-%28JAXB-RI-databinding%29-tp14697730p14708073.html
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