[ 
https://issues.apache.org/activemq/browse/SM-548?page=comments#action_36809 ] 
            
James Lorenzen commented on SM-548:
-----------------------------------

I have since created a simple Consumer who creates an InOut MessageExchange, 
sets the Content, and sends to the JSR181 component. Here is the code and my 
detailed findings.

I expect the following code to work when I set the content and operation name, 
but it doesn't.

InOut inout = 
context.getDeliveryChannel().createExchangeFactory().createInOutExchange();
NormalizedMessage message = inout.createMessage();
message.setContent(new StringSource(
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<e:Envelope 
xmlns:e=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
                "  <e:Body>\n" + "    " +
                        "<ping>\n" + "      " +
                        "<pingRequest>\n" +
                "        <request 
xmlns=\"http://pingpongws.nettoolkit.gestalt.com\";>hel lo</request>\n" +
                "         </pingRequest>\n" + "    " +
                        "</ping>\n" + 
                        "</e:Body>\n" +
                "</e:Envelope>"));
inout.setOperation(new QName("ping"));
inout.setInMessage(message);
context.getDeliveryChannel().sendSync(inout);

When the above code runs I get this error: org.codehaus.xfire.fault.XFireFault: 
Invalid operation: {http://schemasa.xmlsoap.org/soap/envelope/}Envelope

I believe I am getting this error because it is not seeing the Operation Name 
being set and consequently looks at the root namepace of the xml, which happens 
to be the soap namespace, which for obvious reasons won't work.

So I noticed in your tests for the JSR181 component, that none of the test 
Source contained a soap Envelope or Body tags. So I commented out those two 
tags and commented out the line where I set the Operation Name and it worked! 
Here is the code that works:

InOut inout = 
context.getDeliveryChannel().createExchangeFactory().createInOutExchange();
NormalizedMessage message = inout.createMessage();
message.setContent(new StringSource(
//                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
//                "<e:Envelope 
xmlns:e=\"http://schemas.xmlsoap.org/soap/envelope/\";>\n" +
//                "  <e:Body>\n" + "    " +
                        "<ping>\n" + "      " +
                        "<pingRequest>\n" +
                "        <request 
xmlns=\"http://pingpongws.nettoolkit.gestalt.com\";>hel lo</request>\n" +
                "      </pingRequest>\n" + "    " +
                        "</ping>\n"));
//                        "</e:Body>\n" +
//                "</e:Envelope>"));
//        inout.setOperation(new QName("ping"));
inout.setInMessage(message);
context.getDeliveryChannel().sendSync(inout);

So it would almost appear that the JSR181 component (XFire) can not handle SOAP 
properly in all instances. Because the soap-binding example uses SOAP and it 
works just fine.

> QName not being created
> -----------------------
>
>                 Key: SM-548
>                 URL: https://issues.apache.org/activemq/browse/SM-548
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-jsr181
>    Affects Versions: 3.0-M2
>            Reporter: Phillip Anderson
>            Priority: Blocker
>
> We are trying to invoke a Web Service through the JSR-181 component  and when 
> we do so using the code below we receive the error shown after the code.  
> This is related to the discussion 
> http://www.nabble.com/Problem-with-JSR181-Component-tf2128179.html
> Code:
>                 NormalizedMessage onm = me.getMessage("in");
>                 onm.setProperty("com.gestalt.nettoolkit.encoding.style",
>                     encodingStyle);
>                 onm.setContent(getDomSource(dataOut));
>                 me.setMessage(onm, "out");
> Error:
> java.lang.IllegalArgumentException: local part cannot be "null" when creating 
> a QName
>         at javax.xml.namespace.QName.(QName.java:214)
>         at 
> com.ctc.wstx.dom.DOMWrappingReader.constructQName(DOMWrappingReader.java:1284)
>         at 
> com.ctc.wstx.dom.DOMWrappingReader.getName(DOMWrappingReader.java:460)
>         at 
> org.codehaus.xfire.util.stax.DepthXMLStreamReader.getName(DepthXMLStreamReader.java:110)
>         at 
> org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:41)
>         at 
> org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
>         at 
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:110)
>         at 
> org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:61)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to