You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Johan Edstrom <jo...@opennms.org> on 2009/09/29 17:28:38 UTC

Re: Sending messages via a file poller into a cxf-bc provider endpoint

By default, poller endpoints expect the content of the file to be in xml
format. The filepoller can be provided a custom marshaller to
provide binary transport as well, but yes it will deliver the XML as is, so
an xslt or some sort of content enricher is what you'd need to generate the
JBI message. If the file you deliver is a valid soap message, you can turn
off the JBIWrapper in the other end, it'll then accept a soap message.

On Tue, Sep 29, 2009 at 9:07 AM, jweathers777 <jo...@gmail.com>wrote:

>
> I'm afraid that doesn't solve the problem. To simply things, I've replaced
> my
> ServiceMix written service with a truly external web service written in
> .NET.
>
> Here's the WSDL:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:wsu="
> http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
> "
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
> xmlns:tns="http://tempuri.org/"
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
> xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
> xmlns:wsa10="http://www.w3.org/2005/08/addressing"
> xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" name="HowdyWorld"
> targetNamespace="http://tempuri.org/">
>  <wsdl:types>
>    <xsd:schema targetNamespace="http://tempuri.org/Imports">
>      <xsd:import
> schemaLocation="http://localhost:1234/HowdyWorld.svc?xsd=xsd0"
> namespace="http://tempuri.org/"/>
>      <xsd:import
> schemaLocation="http://localhost:1234/HowdyWorld.svc?xsd=xsd1"
> namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
>    </xsd:schema>
>  </wsdl:types>
>  <wsdl:message name="IHowdyWorld_Howdy_InputMessage">
>    <wsdl:part name="parameters" element="tns:Howdy"/>
>  </wsdl:message>
>  <wsdl:message name="IHowdyWorld_Howdy_OutputMessage">
>    <wsdl:part name="parameters" element="tns:HowdyResponse"/>
>  </wsdl:message>
>  <wsdl:portType name="IHowdyWorld">
>    <wsdl:operation name="Howdy">
>      <wsdl:input wsaw:Action="http://tempuri.org/IHowdyWorld/Howdy"
> message="tns:IHowdyWorld_Howdy_InputMessage"/>
>      <wsdl:output
> wsaw:Action="http://tempuri.org/IHowdyWorld/HowdyResponse"
> message="tns:IHowdyWorld_Howdy_OutputMessage"/>
>    </wsdl:operation>
>  </wsdl:portType>
>  <wsdl:binding name="BasicHttpBinding_IHowdyWorld" type="tns:IHowdyWorld">
>    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
>    <wsdl:operation name="Howdy">
>      <soap:operation soapAction="http://tempuri.org/IHowdyWorld/Howdy"
> style="document"/>
>      <wsdl:input>
>        <soap:body use="literal"/>
>      </wsdl:input>
>      <wsdl:output>
>        <soap:body use="literal"/>
>      </wsdl:output>
>    </wsdl:operation>
>  </wsdl:binding>
>  <wsdl:service name="HowdyWorld">
>    <wsdl:port name="BasicHttpBinding_IHowdyWorld"
> binding="tns:BasicHttpBinding_IHowdyWorld">
>      <soap:address location="http://localhost:1234/HowdyWorld.svc"/>
>    </wsdl:port>
>  </wsdl:service>
> </wsdl:definitions>
>
> When I use a cxf-bc consumer component to consume incoming responses via
> SOAP and forward them on to a cxf-bc provider component that references
> this
> external web service, it works when I test via SoapUI.
>
> However, when I replace the cxf-bc consumer with a file poller and send
> messages in via copying them to my directory it fails.
>
> Here are my latest configurations:
> <cxfbc:provider wsdl="http://localhost:1234/HowdyWorld.svc?wsdl"
>      service="howdy:HowdyWorld"
>      endpoint="howdy:BasicHttpBinding_IHowdyWorld"
>      locationURI="http://localhost:1234/HowdyWorld.svc"
>      useJBIWrapper="false" />
>
> <file:poller service="mock:TestMessageService"
>      endpoint="FilePoller"
>       targetService="howdy:HowdyWorld"
>      targetEndpoint="howdy:BasicHttpBinding_IHowdyWorld"
>      targetInterface="howdy:Howdy"
>      file="${mock.inbound}" />
>
> I'm using a file with this content:
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
> "
> xmlns:tem="http://tempuri.org/">
>   <soapenv:Header/>
>   <soapenv:Body>
>      <tem:Howdy>
>         <!--Optional:-->
>         <tem:value>John Doe</tem:value>
>      </tem:Howdy>
>   </soapenv:Body>
> </soapenv:Envelope>
>
> I get this result in the log file:
> InOnly[
>  id: ID:172.17.165.202-124062c87e0-6:6
>  status: Active
>  role: provider
>  interface: {http://tempuri.org/}Howdy <http://tempuri.org/%7DHowdy>
>  service: {http://tempuri.org/}HowdyWorld<http://tempuri.org/%7DHowdyWorld>
>  endpoint: howdy:BasicHttpBinding_IHowdyWorld
>   in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:tem="http://tempuri.org/">
>   <soapenv:Header/>
>   <soapenv:Body>
>      <tem:Howdy>
>         <tem:value>John Doe</tem:value>
>      </tem:Howdy>
>   </soapenv:Body>
> </soapenv:Envelope>
> ]
>
> 10:59:08,570 | INFO  | pool-flow.seda.servicemix-cxf-bc-thread-14 |
> PhaseInterceptorChain    | he.cxf.common.logging.LogUtils  345 |
> Interceptor
> has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: org.apache.xerces.dom.DeferredTextImpl
> cannot be cast to org.w3c.dom.Element at
>
> org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMessage(JbiOutWsdl1Interceptor.java:149)
> at
>
> org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMessage(JbiOutWsdl1Interceptor.java:56)
> ...
>
> My understanding was that an XML file that is fed to a file poller will get
> normalized and then passed on to its target JBI service and endpoint.
>
> Since I've hooked my file poller up to my cxf-bc provider, it should then
> receive normalized JBI messages and unwrap them and send the remaining SOAP
> message on to my external web service.
>
> Is my understanding incorrect?
>
> Thanks.
>
>
> Freeman Fang wrote:
> >
> > Just as Johan point out, add useJBIWrapper="false" attribute for your
> > cxf bc provider endpoint configuration.
> > Freeman
> > On 2009-9-29, at 上午8:03, Johan Edstrom wrote:
> >
> >> Either create a JBI message or set JBIWrapper to false on the
> >> binding component.
> >>
> >>
> > --
> > Freeman Fang
> > ------------------------
> > Open Source SOA: http://fusesource.com
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Sending-messages-via-a-file-poller-into-a-cxf-bc-provider-endpoint-tp25654650p25664884.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: Sending messages via a file poller into a cxf-bc provider endpoint

Posted by jweathers777 <jo...@gmail.com>.

Johan Edstrom-3 wrote:
> 
> By default, poller endpoints expect the content of the file to be in xml
> format. The filepoller can be provided a custom marshaller to
> provide binary transport as well, but yes it will deliver the XML as is,
> so
> an xslt or some sort of content enricher is what you'd need to generate
> the
> JBI message. If the file you deliver is a valid soap message, you can turn
> off the JBIWrapper in the other end, it'll then accept a soap message.
> 

But I have working example where I use a file poller to send a message to a
eip:wiretap which then sends the message to a jms provider endpoint and also
to an auditor. Wouldn't the jms provider be expecting a normalized message?
Would the wiretap expect to receive a normalized message? If so, then what
transforms it into a normalized message if not the file poller?

BTW, thanks for the assistance. It is helpful even if I haven't yet resolved
the issue.

In regards to my problem, I did set the useJBIWrapper to false in my
cxfbc:provider:

<cxfbc:provider wsdl="http://localhost:1234/HowdyWorld.svc?wsdl"
      service="howdy:HowdyWorld"
      endpoint="howdy:BasicHttpBinding_IHowdyWorld"
      locationURI="http://localhost:1234/HowdyWorld.svc"
      useJBIWrapper="false" />

And the result was:

  status: Active
  role: provider
  interface: {http://tempuri.org/}Howdy
  service: {http://tempuri.org/}HowdyWorld
  endpoint: howdy:BasicHttpBinding_IHowdyWorld
  in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:Howdy>
         
         <tem:value>John Doe</tem:value>
      </tem:Howdy>
   </soapenv:Body>
</soapenv:Envelope>
]
10:59:08,570 | INFO  | pool-flow.seda.servicemix-cxf-bc-thread-14 |
PhaseInterceptorChain    | he.cxf.common.logging.LogUtils  345 | Interceptor
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: org.apache.xerces.dom.DeferredTextImpl
cannot be cast to org.w3c.dom.Element
	at
org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMessage(JbiOutWsdl1Interceptor.java:149)
	at
org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMessage(JbiOutWsdl1Interceptor.java:56)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
	at
org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:245)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)
	at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException:
org.apache.xerces.dom.DeferredTextImpl cannot be cast to org.w3c.dom.Element
	at
org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor.handleMessage(JbiOutWsdl1Interceptor.java:84)
	... 14 more
10:59:08,570 | ERROR | pool-flow.seda.servicemix-cxf-bc-thread-14 |
CxfBcComponent           | emix.common.AsyncBaseLifeCycle  537 | Error
processing exchange InOnly[
  id: ID:172.17.165.202-124062c87e0-6:6
  status: Active
  role: provider
  interface: {http://tempuri.org/}Howdy
  service: {http://tempuri.org/}HowdyWorld
  endpoint: howdy:BasicHttpBinding_IHowdyWorld
  in: <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:Howdy>
         
         <tem:value>John Doe</tem:value>
      </tem:Howdy>
   </soapenv:Body>
</soapenv:Envelope>
]
javax.jbi.messaging.MessagingException: Fault not supported
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setMessage(MessageExchangeImpl.java:366)
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.setFault(MessageExchangeImpl.java:290)
	at
org.apache.servicemix.cxfbc.CxfBcProvider.faultProcess(CxfBcProvider.java:277)
	at
org.apache.servicemix.cxfbc.CxfBcProvider.process(CxfBcProvider.java:261)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)
	at
org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
	at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

-- 
View this message in context: http://www.nabble.com/Sending-messages-via-a-file-poller-into-a-cxf-bc-provider-endpoint-tp25654650p25665998.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.