You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Freeman Fang <fr...@gmail.com> on 2008/01/01 06:54:42 UTC

Re: Asynchronous CXF-BC consumer

Hi Wilson,
cxf-bc will detect the mep for an invocation based on the service model
which is built from the wsdl automatically , so you needn't specify it
explicitly yourself.

Best Regards
Freeman

On Dec 31, 2007 6:09 AM, Wilson Freitas <wi...@gmail.com> wrote:

> Hi,
>
> I think this is a simple question, but I was unable to find an answer in
> Servicemix docs and forum archives.
>
> I need to configure a CXF-BC consumer using in-only MEP for Asynchronous
> messages consuming. Other components like JMS provides the "defaultMep"
> parameter, but it is not available for cxf-bc components.
>
> Thank you,
>
> Wilson
>

Re: Asynchronous CXF-BC consumer

Posted by Wilson Freitas <wi...@gmail.com>.
Hi Freeman,

There was an exception related to InOut exchange but I figured out that was
not related to the cxf component, but to a wrongly configured JMS SU. The
CXF-BC component was working as you said. Sorry about that :(
Thank you very much for your help!

Best regards,

Wilson
On Jan 7, 2008 5:13 AM, Freeman Fang <fr...@iona.com> wrote:

> Hi Wilson,
>
> If you just want to use asyn webservice invocation, maybe you can use
> asyn invocation defined in jaxws, since cxf is an implementation of
> jaxws, so cxf can help you do this
> your flow should be looks like
>
> [External client using asyn api]--------->[CXF-BC
> consumer]---[CXF-BC provider]----->[External web service]
>
> You can get more about jaxws asyn from the jaxws specification and
> testAsyn* method in [1]
>
>
> [1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
>
> Best Regards
> Freeman
>
>

Re: Asynchronous CXF-BC consumer

Posted by Freeman Fang <fr...@iona.com>.
Hi Wilson,

If you just want to use asyn webservice invocation, maybe you can use 
asyn invocation defined in jaxws, since cxf is an implementation of 
jaxws, so cxf can help you do this
your flow should be looks like

[External client using asyn api]--------->[CXF-BC
consumer]---[CXF-BC provider]----->[External web service]

You can get more about jaxws asyn from the jaxws specification and testAsyn* method in [1]

[1]https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

Best Regards
Freeman

Wilson Freitas wrote:
> Hi Freeman,
>
> Thank you very much for your answer!
>
> I changed the WSDL but looks like the CXF-BC component still understands the
> message exchange like "in-out".
>
> What I want to do is:
>
> [External client]-----SOAP(in-only)---->[CXF-BC
> consumer]---(in-only)--->[JMS provider]--->(JMS queue)
> (JMS queue)--->[CXF-BC provider]----SOAP--->[External web service]
>
> I want to use the JMS queue to provide asyncronous behavior to the service.
> Is there a better way to achieve this? Maybe the JMS flow?
>
> I am a newbie on the WSDL field. I've found that the way to configure an
> operation as one-way in WSDL is to create the operation with no "output"
> elements.
>
> If you have an example of a WSDL that works as in-only please send it to me.
>
> Follow the WSDL code i am using:
> ==================================================
> *
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/http"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:tns="
> http://DefaultNamespace <http://defaultnamespace/>" xmlns:wsdl="
> http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> name="PedidoService"
> targetNamespace="http://DefaultNamespace<http://defaultnamespace/>
> ">
>
> <wsdl:types>
>
> <xsd:schema attributeFormDefault="unqualified"
> elementFormDefault="qualified"
> targetNamespace="http://DefaultNamespace<http://defaultnamespace/>
> ">
>
> <xsd:element name="enviarPedido" type="tns:enviarPedido"/>
>
> <xsd:complexType name="enviarPedido">
>
> <xsd:sequence>
>
> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> <xsd:element name="enviarPedidoResponse" type="tns:enviarPedidoResponse"/>
>
> <xsd:complexType name="enviarPedidoResponse">
>
> <xsd:sequence/>
>
> </xsd:complexType>
>
> </xsd:schema>
>
> </wsdl:types>
>
> <wsdl:message name="enviarPedido">
>
> <wsdl:part element="tns:enviarPedido" name="parameters">
>
> </wsdl:part>
>
> </wsdl:message>
>
> <wsdl:message name="enviarPedidoResponse">
>
> <wsdl:part element="tns:enviarPedidoResponse" name="parameters">
>
> </wsdl:part>
>
> </wsdl:message>
>
> <wsdl:portType name="PedidoServicePortType">
>
> <wsdl:operation name="enviarPedido">
>
> <wsdl:input message="tns:enviarPedido" name="enviarPedido">
>
> </wsdl:input>
>
> </wsdl:operation>
>
> </wsdl:portType>
>
> <wsdl:binding name="PedidoServiceSoapBinding"
> type="tns:PedidoServicePortType">
>
> <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
>
> <wsdl:operation name="enviarPedido">
>
> <soap:operation soapAction="enviarPedido" style="document"/>
>
> <wsdl:input name="enviarPedido">
>
> <soap:body use="literal"/>
>
> </wsdl:input>
>
> </wsdl:operation>
>
> </wsdl:binding>
>
> <wsdl:service name="PedidoService">
>
> <wsdl:port binding="tns:PedidoServiceSoapBinding" name="PedidoServicePort">
>
> <soap:address location="http://localhost:6981/PedidoService"/>
>
> </wsdl:port>
>
> </wsdl:service>
>
> </wsdl:definitions>
>
> *==================================================
> I have two SU´s:
>
> SU 01:
> ==================================================
> *
>
> <beans
>
> xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>
> xmlns:pedidos="http://DefaultNamespace <http://defaultnamespace/>">
>
> <cxfbc:consumer
>
> wsdl="classpath:pedidos.wsdl"
>
> targetService="pedidos:PedidoFilaProvider"
>
> endpoint="PedidoPort"
>
> />
>
> <cxfbc:provider
>
> wsdl="classpath:pedidos.wsdl"
>
> locationURI="http://localhost:6980/PedidoService"
>
> service="pedidos:PedidoService">
>
> </cxfbc:provider>
>
> </beans>
> *
>  ==================================================
>
> SU 02:
>  ==================================================
> *
>
> <beans
>
> xmlns:jms="http://servicemix.apache.org/jms/1.0"
>
> xmlns:pedidos="http://DefaultNamespace <http://defaultnamespace/>">
>
> <!--
>
> Read data from NMR and sends to jms:queue/pedidoFila
>
> -->
>
> <jms:endpoint
>
> service="pedidos:PedidoFilaProvider"
>
> endpoint="PedidoFilaProvider"
>
> role="provider"
>
> destinationStyle="queue"
>
> jmsProviderDestinationName="queue/pedidoFila"
>
> connectionFactory="#connectionFactory"
>
> interfaceName="pedidos:PedidoFila"
>
> />
>
> <jms:endpoint
>
> service="pedidos:PedidoFilaConsumer"
>
> endpoint="PedidoFilaConsumer"
>
> targetService="pedidos:PedidoService"
>
> role="consumer"
>
> destinationStyle="queue"
>
> jmsProviderDestinationName="queue/pedidoFila"
>
> connectionFactory="#connectionFactory"
>
> />
>
> <bean
>
> id="connectionFactory"
>
> class="org.apache.activemq.ActiveMQConnectionFactory">
>
> <property
>
> name="brokerURL"
>
> value="tcp://localhost:61616"
>
> />
>
> </bean>
>
> </beans>
> *
> Best regards,
>
> Wilson
>
> ==================================================
>
> On Jan 1, 2008 3:54 AM, Freeman Fang <fr...@gmail.com> wrote:
>
>   
>> Hi Wilson,
>> cxf-bc will detect the mep for an invocation based on the service model
>> which is built from the wsdl automatically , so you needn't specify it
>> explicitly yourself.
>>
>> Best Regards
>> Freeman
>>
>>
>>
>>     
>
>   

Re: Asynchronous CXF-BC consumer

Posted by Freeman Fang <fr...@gmail.com>.
Hi Wilson,
Please refer to the greetMeOneWay method defined in [1].
Why you say "CXF-BC component still understands the message exchange 
like "in-out"?
"
I just go through the code, if there is no output defined in the wsdl, 
we just create InOnlyImpl as MessageExchange, you can get more details 
from the createExchange() method in [2]

[1]http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/ws/addressing/hello_world.wsdl
[2]http://svn.apache.org/repos/asf/servicemix/smx3/trunk/deployables/bindingcomponents/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/interceptors/JbiInInterceptor.java

Best  Regards

Freeman

Wilson Freitas wrote:
> Hi Freeman,
>
> Thank you very much for your answer!
>
> I changed the WSDL but looks like the CXF-BC component still understands the
> message exchange like "in-out".
>
> What I want to do is:
>
> [External client]-----SOAP(in-only)---->[CXF-BC
> consumer]---(in-only)--->[JMS provider]--->(JMS queue)
> (JMS queue)--->[CXF-BC provider]----SOAP--->[External web service]
>
> I want to use the JMS queue to provide asyncronous behavior to the service.
> Is there a better way to achieve this? Maybe the JMS flow?
>
> I am a newbie on the WSDL field. I've found that the way to configure an
> operation as one-way in WSDL is to create the operation with no "output"
> elements.
>
> If you have an example of a WSDL that works as in-only please send it to me.
>
> Follow the WSDL code i am using:
> ==================================================
> *
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/http"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:tns="
> http://DefaultNamespace <http://defaultnamespace/>" xmlns:wsdl="
> http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> name="PedidoService"
> targetNamespace="http://DefaultNamespace<http://defaultnamespace/>
> ">
>
> <wsdl:types>
>
> <xsd:schema attributeFormDefault="unqualified"
> elementFormDefault="qualified"
> targetNamespace="http://DefaultNamespace<http://defaultnamespace/>
> ">
>
> <xsd:element name="enviarPedido" type="tns:enviarPedido"/>
>
> <xsd:complexType name="enviarPedido">
>
> <xsd:sequence>
>
> <xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> <xsd:element name="enviarPedidoResponse" type="tns:enviarPedidoResponse"/>
>
> <xsd:complexType name="enviarPedidoResponse">
>
> <xsd:sequence/>
>
> </xsd:complexType>
>
> </xsd:schema>
>
> </wsdl:types>
>
> <wsdl:message name="enviarPedido">
>
> <wsdl:part element="tns:enviarPedido" name="parameters">
>
> </wsdl:part>
>
> </wsdl:message>
>
> <wsdl:message name="enviarPedidoResponse">
>
> <wsdl:part element="tns:enviarPedidoResponse" name="parameters">
>
> </wsdl:part>
>
> </wsdl:message>
>
> <wsdl:portType name="PedidoServicePortType">
>
> <wsdl:operation name="enviarPedido">
>
> <wsdl:input message="tns:enviarPedido" name="enviarPedido">
>
> </wsdl:input>
>
> </wsdl:operation>
>
> </wsdl:portType>
>
> <wsdl:binding name="PedidoServiceSoapBinding"
> type="tns:PedidoServicePortType">
>
> <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
>
> <wsdl:operation name="enviarPedido">
>
> <soap:operation soapAction="enviarPedido" style="document"/>
>
> <wsdl:input name="enviarPedido">
>
> <soap:body use="literal"/>
>
> </wsdl:input>
>
> </wsdl:operation>
>
> </wsdl:binding>
>
> <wsdl:service name="PedidoService">
>
> <wsdl:port binding="tns:PedidoServiceSoapBinding" name="PedidoServicePort">
>
> <soap:address location="http://localhost:6981/PedidoService"/>
>
> </wsdl:port>
>
> </wsdl:service>
>
> </wsdl:definitions>
>
> *==================================================
> I have two SU´s:
>
> SU 01:
> ==================================================
> *
>
> <beans
>
> xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>
> xmlns:pedidos="http://DefaultNamespace <http://defaultnamespace/>">
>
> <cxfbc:consumer
>
> wsdl="classpath:pedidos.wsdl"
>
> targetService="pedidos:PedidoFilaProvider"
>
> endpoint="PedidoPort"
>
> />
>
> <cxfbc:provider
>
> wsdl="classpath:pedidos.wsdl"
>
> locationURI="http://localhost:6980/PedidoService"
>
> service="pedidos:PedidoService">
>
> </cxfbc:provider>
>
> </beans>
> *
>  ==================================================
>
> SU 02:
>  ==================================================
> *
>
> <beans
>
> xmlns:jms="http://servicemix.apache.org/jms/1.0"
>
> xmlns:pedidos="http://DefaultNamespace <http://defaultnamespace/>">
>
> <!--
>
> Read data from NMR and sends to jms:queue/pedidoFila
>
> -->
>
> <jms:endpoint
>
> service="pedidos:PedidoFilaProvider"
>
> endpoint="PedidoFilaProvider"
>
> role="provider"
>
> destinationStyle="queue"
>
> jmsProviderDestinationName="queue/pedidoFila"
>
> connectionFactory="#connectionFactory"
>
> interfaceName="pedidos:PedidoFila"
>
> />
>
> <jms:endpoint
>
> service="pedidos:PedidoFilaConsumer"
>
> endpoint="PedidoFilaConsumer"
>
> targetService="pedidos:PedidoService"
>
> role="consumer"
>
> destinationStyle="queue"
>
> jmsProviderDestinationName="queue/pedidoFila"
>
> connectionFactory="#connectionFactory"
>
> />
>
> <bean
>
> id="connectionFactory"
>
> class="org.apache.activemq.ActiveMQConnectionFactory">
>
> <property
>
> name="brokerURL"
>
> value="tcp://localhost:61616"
>
> />
>
> </bean>
>
> </beans>
> *
> Best regards,
>
> Wilson
>
> ==================================================
>
> On Jan 1, 2008 3:54 AM, Freeman Fang <fr...@gmail.com> wrote:
>
>   
>> Hi Wilson,
>> cxf-bc will detect the mep for an invocation based on the service model
>> which is built from the wsdl automatically , so you needn't specify it
>> explicitly yourself.
>>
>> Best Regards
>> Freeman
>>
>>
>>
>>     
>
>   

Re: Asynchronous CXF-BC consumer

Posted by Wilson Freitas <wi...@gmail.com>.
Hi Freeman,

Thank you very much for your answer!

I changed the WSDL but looks like the CXF-BC component still understands the
message exchange like "in-out".

What I want to do is:

[External client]-----SOAP(in-only)---->[CXF-BC
consumer]---(in-only)--->[JMS provider]--->(JMS queue)
(JMS queue)--->[CXF-BC provider]----SOAP--->[External web service]

I want to use the JMS queue to provide asyncronous behavior to the service.
Is there a better way to achieve this? Maybe the JMS flow?

I am a newbie on the WSDL field. I've found that the way to configure an
operation as one-way in WSDL is to create the operation with no "output"
elements.

If you have an example of a WSDL that works as in-only please send it to me.

Follow the WSDL code i am using:
==================================================
*

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:tns="
http://DefaultNamespace <http://defaultnamespace/>" xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="PedidoService"
targetNamespace="http://DefaultNamespace<http://defaultnamespace/>
">

<wsdl:types>

<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://DefaultNamespace<http://defaultnamespace/>
">

<xsd:element name="enviarPedido" type="tns:enviarPedido"/>

<xsd:complexType name="enviarPedido">

<xsd:sequence>

<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>

</xsd:sequence>

</xsd:complexType>

<xsd:element name="enviarPedidoResponse" type="tns:enviarPedidoResponse"/>

<xsd:complexType name="enviarPedidoResponse">

<xsd:sequence/>

</xsd:complexType>

</xsd:schema>

</wsdl:types>

<wsdl:message name="enviarPedido">

<wsdl:part element="tns:enviarPedido" name="parameters">

</wsdl:part>

</wsdl:message>

<wsdl:message name="enviarPedidoResponse">

<wsdl:part element="tns:enviarPedidoResponse" name="parameters">

</wsdl:part>

</wsdl:message>

<wsdl:portType name="PedidoServicePortType">

<wsdl:operation name="enviarPedido">

<wsdl:input message="tns:enviarPedido" name="enviarPedido">

</wsdl:input>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="PedidoServiceSoapBinding"
type="tns:PedidoServicePortType">

<soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="enviarPedido">

<soap:operation soapAction="enviarPedido" style="document"/>

<wsdl:input name="enviarPedido">

<soap:body use="literal"/>

</wsdl:input>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="PedidoService">

<wsdl:port binding="tns:PedidoServiceSoapBinding" name="PedidoServicePort">

<soap:address location="http://localhost:6981/PedidoService"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

*==================================================
I have two SU´s:

SU 01:
==================================================
*

<beans

xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"

xmlns:pedidos="http://DefaultNamespace <http://defaultnamespace/>">

<cxfbc:consumer

wsdl="classpath:pedidos.wsdl"

targetService="pedidos:PedidoFilaProvider"

endpoint="PedidoPort"

/>

<cxfbc:provider

wsdl="classpath:pedidos.wsdl"

locationURI="http://localhost:6980/PedidoService"

service="pedidos:PedidoService">

</cxfbc:provider>

</beans>
*
 ==================================================

SU 02:
 ==================================================
*

<beans

xmlns:jms="http://servicemix.apache.org/jms/1.0"

xmlns:pedidos="http://DefaultNamespace <http://defaultnamespace/>">

<!--

Read data from NMR and sends to jms:queue/pedidoFila

-->

<jms:endpoint

service="pedidos:PedidoFilaProvider"

endpoint="PedidoFilaProvider"

role="provider"

destinationStyle="queue"

jmsProviderDestinationName="queue/pedidoFila"

connectionFactory="#connectionFactory"

interfaceName="pedidos:PedidoFila"

/>

<jms:endpoint

service="pedidos:PedidoFilaConsumer"

endpoint="PedidoFilaConsumer"

targetService="pedidos:PedidoService"

role="consumer"

destinationStyle="queue"

jmsProviderDestinationName="queue/pedidoFila"

connectionFactory="#connectionFactory"

/>

<bean

id="connectionFactory"

class="org.apache.activemq.ActiveMQConnectionFactory">

<property

name="brokerURL"

value="tcp://localhost:61616"

/>

</bean>

</beans>
*
Best regards,

Wilson

==================================================

On Jan 1, 2008 3:54 AM, Freeman Fang <fr...@gmail.com> wrote:

> Hi Wilson,
> cxf-bc will detect the mep for an invocation based on the service model
> which is built from the wsdl automatically , so you needn't specify it
> explicitly yourself.
>
> Best Regards
> Freeman
>
>
>