Ben, I'm not that familiar with the CXF BC codebase myself, but from looking at the code that just might be it. Definitely feel free to provide a patch for solving the issue. You can take a look at the other unit tests in there to add a test as well, that way you should be able to make the change without breaking the other code (and we can make changes afterwards without breaking your fix ;). Thanks for volunteering to take a stab at this...
Regards, Gert Vanthienen ------------------------ Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/5/11 Brown, Ben <[email protected]>: > Thanks Gert > > I've taken a look at the following class: > > org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor > > in the handleMessage method there is the following code at line 80. > > Element bodyElement = (Element) element.getElementsByTagNameNS( > element.getNamespaceURI(), > soapVersion.getBody().getLocalPart()).item(0); > > Correct me if I'm wrong - but this appears to look for an element named > "Body" in the namespace of the root node of the message - and it assumes that > this element is the body. Looking at the comments in the code, this is > expected to pick up CXF-BC Consumer elements NOT provider elements that I am > using. > > If this is indeed what the code is doing then this would appear to be a bug > as a provider with a node named Body in the message will match this element. > Is it possible to use the "useSOAPEnvelope" parameter to determine if we > should look for this bodyElement or not? As it would seem that a provider > that has useSOAPEnvelope="false" will not need to look for the root element, > as it will be element passed into this method. This also appears to only be > an issue when the useJBIWrapper is set to false. I will (as a short-term > workaround), try putting a JBI Wrapper around the message and unsetting that > property. > > Hope that makes some sense - I am happy to help work on a patch if necessary, > although I don't really understand the full implications on any change such > as this. > > Thanks in advance > > Ben > > > -----Original Message----- > From: Gert Vanthienen [mailto:[email protected]] > Sent: 11 May 2009 15:51 > To: [email protected] > Subject: Re: Problem with CXF-BC Web Service and node called "Body" > > Ben, > > That class is part of the CXF-BC component and can be found in the > https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk > project. > You can view it as > http://svn.eu.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiOutWsdl1Interceptor.java?view=log > > Regards, > > Gert Vanthienen > ------------------------ > Open Source SOA: http://fusesource.com > Blog: http://gertvanthienen.blogspot.com/ > > > > 2009/5/11 <[email protected]>: >> Hi Gert >> >> Unfortunately that is the only error message / stack trace visible - this >> is partly why I'm so stuck as I'm not sure on where the error is coming >> from. >> >> I have just managed to turn on extra logging for CXF which gives me the >> following in my log4j file. This seems to suggest the error is thrown from >> the following class: >> org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor. I'm >> currently trying to find this in SVN, but haven't managed to find it with >> the intention of setting up remote debugging in Eclipse to see if I can >> track down some more information. >> >> Thanks >> >> Ben Brown >> >> -------------------------------------- >> >> >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleMessage on >> interceptor >> org.apache.cxf.binding.soap.interceptor.soappreprotocoloutintercep...@643b04 >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleMessage on >> interceptor >> org.apache.cxf.binding.soap.interceptor.soapactionoutintercep...@b3bb6b >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleMessage on >> interceptor >> org.apache.servicemix.cxfbc.interceptors.jbioutintercep...@165f6e3 >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleMessage on >> interceptor org.apache.cxf.interceptor.staxoutintercep...@1d5aaaf >> DEBUG - cxf.phase.PhaseInterceptorChain - Adding interceptor >> org.apache.cxf.interceptor.staxoutinterceptor$staxoutendingintercep...@152ee1e >> to phase pre-stream-ending >> DEBUG - cxf.phase.PhaseInterceptorChain - Chain >> org.apache.cxf.phase.phaseinterceptorch...@d96a88 was modified. Current >> flow: >> post-logical [SoapPreProtocolOutInterceptor, SoapActionOutInterceptor] >> pre-stream [JbiOutInterceptor, StaxOutInterceptor] >> write [SoapOutInterceptor] >> marshal [JbiOutWsdl1Interceptor] >> pre-stream-ending [StaxOutEndingInterceptor] >> >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleMessage on >> interceptor >> org.apache.cxf.binding.soap.interceptor.soapoutintercep...@5e89f7 >> DEBUG - cxf.phase.PhaseInterceptorChain - Adding interceptor >> org.apache.cxf.binding.soap.interceptor.soapoutinterceptor$soapoutendingintercep...@1c30e39 >> to phase write-ending >> DEBUG - cxf.phase.PhaseInterceptorChain - Chain >> org.apache.cxf.phase.phaseinterceptorch...@d96a88 was modified. Current >> flow: >> post-logical [SoapPreProtocolOutInterceptor, SoapActionOutInterceptor] >> pre-stream [JbiOutInterceptor, StaxOutInterceptor] >> write [SoapOutInterceptor] >> marshal [JbiOutWsdl1Interceptor] >> write-ending [SoapOutEndingInterceptor] >> pre-stream-ending [StaxOutEndingInterceptor] >> >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleMessage on >> interceptor >> org.apache.servicemix.cxfbc.interceptors.jbioutwsdl1intercep...@133c757 >> INFO - cxf.phase.PhaseInterceptorChain - Interceptor has thrown exception, >> unwinding now org.apache.xerces.dom.DeferredTextImpl cannot be cast to >> org.w3c.dom.Element >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleFault on >> interceptor >> org.apache.servicemix.cxfbc.interceptors.jbioutwsdl1intercep...@133c757 >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleFault on >> interceptor >> org.apache.cxf.binding.soap.interceptor.soapoutintercep...@5e89f7 >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleFault on >> interceptor org.apache.cxf.interceptor.staxoutintercep...@1d5aaaf >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleFault on >> interceptor >> org.apache.servicemix.cxfbc.interceptors.jbioutintercep...@165f6e3 >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleFault on >> interceptor >> org.apache.cxf.binding.soap.interceptor.soapactionoutintercep...@b3bb6b >> DEBUG - cxf.phase.PhaseInterceptorChain - Invoking handleFault on >> interceptor >> org.apache.cxf.binding.soap.interceptor.soappreprotocoloutintercep...@643b04 >> DEBUG - jbi.messaging.DeliveryChannelImpl - Send >> ID:140.140.144.118-1212ffce63b-10:0 in DeliveryChannel{servicemix-cxf-bc} >> DEBUG - jbi.security.SecuredBroker - send exchange with secure broker >> DEBUG - flow.seda.SedaFlow - Called Flow send >> DEBUG - flow.seda.SedaQueue - >> org.apache.servicemix.jbi.nmr.flow.seda.sedaqueu...@85e7b4 dequeued >> exchange: InOut[ >> id: ID:140.140.144.118-1212ffce63b-10:0 >> status: Active >> role: consumer >> service: {http://ws.textanywhere.net/TA_WS}TextAnywhere_SMS >> endpoint: TextAnywhere_SMSSoap >> operation: {http://ws.textanywhere.net/TA_WS}SendSMSEx >> in: <?xml version="1.0" encoding="UTF-8"?><ta:SendSMSEx >> xmlns:ta="http://ws.textanywhere.net/TA_WS"> >> <ta:Client_ID>xxxxxx</ta:Client_ID> >> <ta:Client_Pass>xxxxxx</ta:Client_Pass> >> <ta:Client_Ref>1</ta:Client_Ref> >> <ta:Billing_Ref>ACTIVATION</ta:Billing_Ref> >> <ta:Connection>1</ta:Connection> >> <ta:Originator>Bluefin</ta:Originator> >> <ta:OType>1</ta:OType> >> <ta:DestinationEx>+4470000000</ta:DestinationEx> >> <ta:Body>test</ta:Body> >> <ta:SMS_Type>0</ta:SMS_Type> >> <ta:Reply_Type>0</ta:Reply_Type> >> <ta:Reply_Data/> >> </ta:SendSMSEx> >> fault: <?xml version="1.0" encoding="UTF-8"?><JBIFault >> xmlns="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"><detail >> xmlns="">org.apache.xerces.dom.DeferredTextImpl cannot be cast to >> org.w3c.dom.Element</detail></JBIFault> >> ] >> DEBUG - jbi.messaging.DeliveryChannelImpl - Send >> ID:140.140.144.118-1212ffce63b-10:0 in DeliveryChannel{servicemix-camel} >> DEBUG - jbi.security.SecuredBroker - send exchange with secure broker >> DEBUG - flow.seda.SedaFlow - Called Flow send >> DEBUG - flow.seda.SedaQueue - >> org.apache.servicemix.jbi.nmr.flow.seda.sedaqueu...@1e2ac3b dequeued >> exchange: InOut[ >> id: ID:140.140.144.118-1212ffce63b-10:0 >> status: Done >> role: provider >> service: {http://ws.textanywhere.net/TA_WS}TextAnywhere_SMS >> endpoint: TextAnywhere_SMSSoap >> operation: {http://ws.textanywhere.net/TA_WS}SendSMSEx >> in: <?xml version="1.0" encoding="UTF-8"?><ta:SendSMSEx >> xmlns:ta="http://ws.textanywhere.net/TA_WS"> >> <ta:Client_ID>xxxxx</ta:Client_ID> >> <ta:Client_Pass>xxxxx</ta:Client_Pass> >> <ta:Client_Ref>1</ta:Client_Ref> >> <ta:Billing_Ref>ACTIVATION</ta:Billing_Ref> >> <ta:Connection>1</ta:Connection> >> <ta:Originator>Bluefin</ta:Originator> >> <ta:OType>1</ta:OType> >> <ta:DestinationEx>+440000000</ta:DestinationEx> >> <ta:Body>test</ta:Body> >> <ta:SMS_Type>0</ta:SMS_Type> >> <ta:Reply_Type>0</ta:Reply_Type> >> <ta:Reply_Data/> >> </ta:SendSMSEx> >> fault: <?xml version="1.0" encoding="UTF-8"?><JBIFault >> xmlns="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"><detail >> xmlns="">org.apache.xerces.dom.DeferredTextImpl cannot be cast to >> org.w3c.dom.Element</detail></JBIFault> >> ] >> DEBUG - servicemix.cxfbc.CxfBcComponent - Received exchange: status: Done, >> role: provider >> DEBUG - servicemix.cxfbc.CxfBcComponent - Retrieved correlation id: >> ID:140.140.144.118-1212ffce63b-10:0 >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> On Mon, 11 May 2009 16:18:49 +0200, Gert Vanthienen >> <[email protected]> wrote: >>> Ben, >>> >>> Do you have a more complete stacktrace for this exception? That might >>> help us find out what the root cause of the problem is. >>> >>> Regards, >>> >>> Gert Vanthienen >>> ------------------------ >>> Open Source SOA: http://fusesource.com >>> Blog: http://gertvanthienen.blogspot.com/ >>> >>> >>> >>> 2009/5/11 Brown, Ben <[email protected]>: >>>> I am using the CXF-BC component in Servicemix 3.3 to connect to an >>>> external web service for sending SMS messages. The configuration of my >>>> xbean.xml is shown below: >>>> >>>> <cxfbc:provider >>>> wsdl="http://ws.textanywhere.net/TA_SMS.asmx?wsdl" >>>> service="text:TextAnywhere_SMS" >>>> endpoint="TextAnywhere_SMSSoap" >>>> useJBIWrapper="false" >>>> useSOAPEnvelope="false"/> >>>> >>>> I am using SoapUI to generate a sample request message for testing. >>>> This sample request is placed onto a JMS queue in JConsole with a Camel >>>> route using the JBI component sending the message to the CXF endpoint >>>> above. Route shown below: >>>> >>>> from("activemq:queue.sms.request") >>>> // Send to TextAnywhere Web Service >>>> >>>> .to("jbi:service:http://ws.textanywhere.net/TA_WS/TextAnywhere_SMS?opera >>>> tion={http://ws.textanywhere.net/TA_WS}SendSMSEx&mep=in-out").convertBod >>>> yTo(String.class) >>>> >>>> The sample request (shown below) contains a parameter called "Body", >>>> however this seems to break the parser and prevents the webservice from >>>> being called with the following error: fault: <?xml version="1.0" >>>> encoding="UTF-8"?><JBIFault >>>> xmlns="http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper"><detail >>>> xmlns="">org.apache.xerces.dom.DeferredTextImpl cannot be cast to >>>> org.w3c.dom.Element</detail></JBIFault> >>>> >>>> Sample Message (client_id and client_pass values removed): >>>> >>>> <ta:SendSMSEx xmlns:ta="http://ws.textanywhere.net/TA_WS"> >>>> <!--Optional:--> >>>> <ta:Client_ID>xxxxxx</ta:Client_ID> >>>> <!--Optional:--> >>>> <ta:Client_Pass>xxxxxx</ta:Client_Pass> >>>> <!--Optional:--> >>>> <ta:Client_Ref>TEST</ta:Client_Ref> >>>> <!--Optional:--> >>>> <ta:Billing_Ref>TEST</ta:Billing_Ref> >>>> <ta:Connection>1</ta:Connection> >>>> <!--Optional:--> >>>> <ta:Originator>Bluefin</ta:Originator> >>>> <ta:OType>1</ta:OType> >>>> <!--Optional:--> >>>> <ta:DestinationEx>+4470000000</ta:DestinationEx> >>>> <!--Optional:--> >>>> <ta:Body>Test</ta:Body> >>>> <ta:SMS_Type>0</ta:SMS_Type> >>>> <ta:Reply_Type>0</ta:Reply_Type> >>>> <!--Optional:--> >>>> <ta:Reply_Data></ta:Reply_Data> >>>> </ta:SendSMSEx> >>>> >>>> >>>> This error only occurs when the Body element is present in the message. >>>> If I remove this then I get the error "Server was unable to process >>>> request. --> Object reference not set to an instance of an object" in >>>> the fault response message - which is normally seen when the message is >>>> malformed (as it's missing the body element). >>>> >>>> I'm not sure which classes are actually throwing this JBI error above >>>> and so I am unable to provide further debugging information, however I >>>> am certain that no message is sent to the web service (none appears in >>>> Wireshark). >>>> >>>> Thanks in advance for your time and help. >>>> >>>> Ben Brown >>>> >>>> This email and any files or information it contains are confidential and >>>> may be privileged. It is for the intended addressee(s) only. The >>>> unauthorised use, disclosure or copying of this email or any information >>>> it contains, is prohibited and could, in certain circumstances be a >>>> criminal offence. If you are not the intended recipient you should not >>>> disseminate or copy this email. Please notify the sender immediately >>>> and delete this message from your system. >>>> >>>> Please note that any opinions presented in this email are solely those >> of >>>> the author (or those of a third party whose statement is forwarded) and >>>> do not necessarily represent those of any company within the Bluefin >>>> Group Limited group of companies. >>>> >>>> Email transmission cannot be guaranteed to be secure or error free as >>>> information could be intercepted, corrupted, lost, destroyed, late in >>>> arriving or incomplete as a result of the transmission process. The >>>> sender therefore does not accept liability for any errors or omissions >> in >>>> the contents of this message which arise as a result of email >>>> transmission. >>>> >>>> WARNING: Computer viruses can be transmitted by email. The recipient >>>> should check this email and any attachments for the presence of viruses. >>>> The Bluefin Group Limited group of companies accepts no liability for >>>> any damage caused by any virus transmitted by this email. >>>> >> > -------------------------------------------------------------- > Protection | Management | Compliance - scanned for viruses and unwanted > content by emailsystems > > Why use a managed email service? Click here to find out > This email and any files or information it contains are confidential and may > be privileged. It is for the intended addressee(s) only. The unauthorised > use, disclosure or copying of this email or any information it contains, is > prohibited and could, in certain circumstances be a criminal offence. If you > are not the intended recipient you should not disseminate or copy this email. > Please notify the sender immediately and delete this message from your > system. > > Please note that any opinions presented in this email are solely those of the > author (or those of a third party whose statement is forwarded) and do not > necessarily represent those of any company within the Bluefin Group Limited > group of companies. > > Email transmission cannot be guaranteed to be secure or error free as > information could be intercepted, corrupted, lost, destroyed, late in > arriving or incomplete as a result of the transmission process. The sender > therefore does not accept liability for any errors or omissions in the > contents of this message which arise as a result of email transmission. > > WARNING: Computer viruses can be transmitted by email. The recipient should > check this email and any attachments for the presence of viruses. The > Bluefin Group Limited group of companies accepts no liability for any damage > caused by any virus transmitted by this email. >
