You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Lorena A <la...@comcast.net> on 2010/01/28 05:49:48 UTC

How to call (send message) to jms bc from cxf-se

Hello,


The client will send a request via web service (the client does not want to
use JMS), then the request needs to go to a jms bc

How can I invoke jms bc from cfx-se? 

Any help will be greatly appreciate!

Thanks, Lorena
-- 
View this message in context: http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27351068.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to call (send message) to jms bc from cxf-se

Posted by Lorena A <la...@comcast.net>.
Hi Gert,

I defined the jms:provider and consumer as follows:

<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
       xmlns:test="http://test"
       xmlns:amq="http://activemq.org/config/1.0"
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://servicemix.apache.org/jms/1.0
http://servicemix.apache.org/schema/servicemix-jms-3.2.3.xsd
       http://activemq.org/config/1.0
http://activemq.apache.org/schema/core/activemq-core-4.1.1.xsd
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <jms:provider service="test:eventProviderService"
                  endpoint="provider" 
                  destinationName="queueA"
                  connectionFactory="#connectionFactory" />


    <jms:consumer service="test:eventConsumerService"
	     endpoint="consumer"
	     destinationName="queueA"
                  targetService="test:beanService"
                  targetEndpoint="endpoint"
                  marshaler="#marshaler"
	     connectionFactory="#connectionFactory" />


     <bean id="marshaler" class="test.myMarshaler">
       <property name="mep" value="http://www.w3.org/2004/08/wsdl/in-only"
/>
     </bean>

    <amq:connectionFactory id="connectionFactory"
brokerURL="tcp://localhost:61616" />

</beans>


Sending the InOnly exchange to put the message in the queue:


        serviceMixClient = new ServiceMixClientFacade(this.context);
 
        QName service = new QName("http://test", "eventProviderService");
        InOnly inOnlyExchange = serviceMixClient.createInOnlyExchange();
        inOnlyExchange.setService(service);
        NormalizedMessage message = inOnlyExchange.getInMessage();

        String xmlString = "<?xml version=\"1.0\"
encoding=\"UTF-8\"?><hello>world</hello>";
        message.setContent(new StringSource(xmlString));

        try
        {
            serviceMixClient.sendSync(inOnlyExchange);
            serviceMixClient.close();

        }
        catch (JBIException ex)
        {
            throw ex;
        }

It seems that the text message is null....
I am getting the exception:

INFO   | jvm 1    | 2010/01/31 04:39:59 | WARN  -
DefaultMessageListenerContainer - Execution of JMS message listener failed
INFO   | jvm 1    | 2010/01/31 04:39:59 | javax.jms.JMSException: Error
sending JBI exchange
INFO   | jvm 1    | 2010/01/31 04:39:59 | 	at
org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:569)
INFO   | jvm 1    | 2010/01/31 04:39:59 | 	at
org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint$1.onMessage(JmsConsumerEndpoint.java:446)



message is: ActiveMQTextMessage {commandId = 5, responseRequired = true,
messageId = ID:SUN-lortind620-1600-1264930595156-2:70:1:1:1,
originalDestination = null, originalTransactionId = null, producerId =
ID:SUN-lortind620-1600-1264930595156-2:70:1:1, destination = queue://queueA,
transactionId = null, expiration = 0, timestamp = 1264930798937, arrival =
0, brokerInTime = 1264930798937, brokerOutTime = 1264930798953,
correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@62ea85, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false, text =
null}


Any idea? It seems the text is null but I do not understand why?????

Any help greatly appreciate!!!

Thx Lorena


Gert Vanthienen wrote:
> 
> Lorena,
> 
> If you already managed to send a MessageExchange to another JBI
> endpoint from within your service, you could reuse the same approach
> for putting the message in a JMS queue.  If you create a
> <jms:provider/> endpoint, you can send an InOnly exchange to that
> endpoint to put the message in the queue.
> 
> For handling the asynchronous processing inside ServiceMix, you can
> start a new flow which starts with a <jms:consumer/> to receive the
> message asynchronously and then send it to any other type of endpoint
> in the ESB.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> On 28 January 2010 15:56, Lorena A <la...@comcast.net> wrote:
>>
>> Hi Freema,
>>
>> Thanks very much for your reply.
>>
>> I am new on this technology. So far this is what I have deployed on a sa:
>>
>> cxf-bc-su
>> <cxfbc:consumer wsdl="classpath:service.wsdl"
>>                      targetService="hello:HelloService"
>>                      targetInterface="hello:Hello"/>
>>
>>
>> cxf-se-su
>>    <cxfse:endpoint>
>>        <cxfse:pojo>
>>          <bean class="org.apache.servicemix.examples.HelloImpl">
>>                <property name="context" ref="context" />
>>          </bean>
>>        </cxfse:pojo>
>>    </cxfse:endpoint>
>>
>> With this config, I am hosting a web service in the bus. The web service
>> implementation (HelloImpl) does some processing and sends the message to
>> another JBI component in the bus by using ServiceMixClient.
>>
>> Got it to work (after some nights of no sleep :>).
>>
>> Now the issue is that the client app can not wait for the reply of the
>> web
>> service...the processing of the request may take some processing time. I
>> need to make it somehow async....so I thought about servicemix-jms
>>
>> All the examples I have found are based on a JMS Client app publishing
>> the
>> message on the queue.
>>
>> In my case the JMS Client is my web service impl (cxfse:endpoint)
>>
>> I looked on the links you sent...but they are little hard for me to
>> understand...so I started google about cxf with jms transport....
>>
>> I am using servicemix 3.2.3...I can not use an upgraded version...so I am
>> not sure if that feature is available....
>>
>>
>> Can I do something like that using smx 3.2.3?
>>
>> Can you point me to a more concrete example how to achieve it?
>>
>> Thanks a  lot!!!!
>>
>> Lorena
>>
>>
>>
>> Freeman Fang wrote:
>>>
>>> Hi,
>>>
>>> You can use a cxf bc provider endpoint with jms transport to send
>>> message to jms topic/queue. take a look at CxfBcJmsTest[1] to see how
>>> to configure cxf bc provider with jms transport.
>>>
>>> And you can inject the proxy of cxf bc provider into your cxf se
>>> endpoint, then invoke the cxf bc provider from your cxf-se just like
>>> normal java invocation, take a look at the "Proxies" part of [2]
>>>
>>> [1]https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTest.java
>>> [2]http://servicemix.apache.org/servicemix-cxf-se.html
>>>
>>> Freeman
>>> On 2010-1-28, at 下午12:49, Lorena A wrote:
>>>
>>>>
>>>> Hello,
>>>>
>>>>
>>>> The client will send a request via web service (the client does not
>>>> want to
>>>> use JMS), then the request needs to go to a jms bc
>>>>
>>>> How can I invoke jms bc from cfx-se?
>>>>
>>>> Any help will be greatly appreciate!
>>>>
>>>> Thanks, Lorena
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27351068.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>
>>>
>>> --
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27357271.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27391318.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to call (send message) to jms bc from cxf-se

Posted by Gert Vanthienen <ge...@gmail.com>.
Lorena,

If you already managed to send a MessageExchange to another JBI
endpoint from within your service, you could reuse the same approach
for putting the message in a JMS queue.  If you create a
<jms:provider/> endpoint, you can send an InOnly exchange to that
endpoint to put the message in the queue.

For handling the asynchronous processing inside ServiceMix, you can
start a new flow which starts with a <jms:consumer/> to receive the
message asynchronously and then send it to any other type of endpoint
in the ESB.

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



On 28 January 2010 15:56, Lorena A <la...@comcast.net> wrote:
>
> Hi Freema,
>
> Thanks very much for your reply.
>
> I am new on this technology. So far this is what I have deployed on a sa:
>
> cxf-bc-su
> <cxfbc:consumer wsdl="classpath:service.wsdl"
>                      targetService="hello:HelloService"
>                      targetInterface="hello:Hello"/>
>
>
> cxf-se-su
>    <cxfse:endpoint>
>        <cxfse:pojo>
>          <bean class="org.apache.servicemix.examples.HelloImpl">
>                <property name="context" ref="context" />
>          </bean>
>        </cxfse:pojo>
>    </cxfse:endpoint>
>
> With this config, I am hosting a web service in the bus. The web service
> implementation (HelloImpl) does some processing and sends the message to
> another JBI component in the bus by using ServiceMixClient.
>
> Got it to work (after some nights of no sleep :>).
>
> Now the issue is that the client app can not wait for the reply of the web
> service...the processing of the request may take some processing time. I
> need to make it somehow async....so I thought about servicemix-jms
>
> All the examples I have found are based on a JMS Client app publishing the
> message on the queue.
>
> In my case the JMS Client is my web service impl (cxfse:endpoint)
>
> I looked on the links you sent...but they are little hard for me to
> understand...so I started google about cxf with jms transport....
>
> I am using servicemix 3.2.3...I can not use an upgraded version...so I am
> not sure if that feature is available....
>
>
> Can I do something like that using smx 3.2.3?
>
> Can you point me to a more concrete example how to achieve it?
>
> Thanks a  lot!!!!
>
> Lorena
>
>
>
> Freeman Fang wrote:
>>
>> Hi,
>>
>> You can use a cxf bc provider endpoint with jms transport to send
>> message to jms topic/queue. take a look at CxfBcJmsTest[1] to see how
>> to configure cxf bc provider with jms transport.
>>
>> And you can inject the proxy of cxf bc provider into your cxf se
>> endpoint, then invoke the cxf bc provider from your cxf-se just like
>> normal java invocation, take a look at the "Proxies" part of [2]
>>
>> [1]https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTest.java
>> [2]http://servicemix.apache.org/servicemix-cxf-se.html
>>
>> Freeman
>> On 2010-1-28, at 下午12:49, Lorena A wrote:
>>
>>>
>>> Hello,
>>>
>>>
>>> The client will send a request via web service (the client does not
>>> want to
>>> use JMS), then the request needs to go to a jms bc
>>>
>>> How can I invoke jms bc from cfx-se?
>>>
>>> Any help will be greatly appreciate!
>>>
>>> Thanks, Lorena
>>> --
>>> View this message in context:
>>> http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27351068.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>
>>
>> --
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27357271.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: How to call (send message) to jms bc from cxf-se

Posted by Lorena A <la...@comcast.net>.
Hi Freema,

Thanks very much for your reply.

I am new on this technology. So far this is what I have deployed on a sa:

cxf-bc-su
<cxfbc:consumer wsdl="classpath:service.wsdl"
                      targetService="hello:HelloService"
                      targetInterface="hello:Hello"/>


cxf-se-su
    <cxfse:endpoint>
        <cxfse:pojo>
          <bean class="org.apache.servicemix.examples.HelloImpl">
                <property name="context" ref="context" />
	  </bean> 
        </cxfse:pojo>
    </cxfse:endpoint>

With this config, I am hosting a web service in the bus. The web service
implementation (HelloImpl) does some processing and sends the message to
another JBI component in the bus by using ServiceMixClient.

Got it to work (after some nights of no sleep :>).

Now the issue is that the client app can not wait for the reply of the web
service...the processing of the request may take some processing time. I
need to make it somehow async....so I thought about servicemix-jms

All the examples I have found are based on a JMS Client app publishing the
message on the queue. 

In my case the JMS Client is my web service impl (cxfse:endpoint)

I looked on the links you sent...but they are little hard for me to
understand...so I started google about cxf with jms transport....

I am using servicemix 3.2.3...I can not use an upgraded version...so I am
not sure if that feature is available....


Can I do something like that using smx 3.2.3?

Can you point me to a more concrete example how to achieve it?

Thanks a  lot!!!!

Lorena



Freeman Fang wrote:
> 
> Hi,
> 
> You can use a cxf bc provider endpoint with jms transport to send  
> message to jms topic/queue. take a look at CxfBcJmsTest[1] to see how  
> to configure cxf bc provider with jms transport.
> 
> And you can inject the proxy of cxf bc provider into your cxf se  
> endpoint, then invoke the cxf bc provider from your cxf-se just like  
> normal java invocation, take a look at the "Proxies" part of [2]
> 
> [1]https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTest.java
> [2]http://servicemix.apache.org/servicemix-cxf-se.html
> 
> Freeman
> On 2010-1-28, at 下午12:49, Lorena A wrote:
> 
>>
>> Hello,
>>
>>
>> The client will send a request via web service (the client does not  
>> want to
>> use JMS), then the request needs to go to a jms bc
>>
>> How can I invoke jms bc from cfx-se?
>>
>> Any help will be greatly appreciate!
>>
>> Thanks, Lorena
>> -- 
>> View this message in context:
>> http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27351068.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
> 
> 
> -- 
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27357271.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to call (send message) to jms bc from cxf-se

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

You can use a cxf bc provider endpoint with jms transport to send  
message to jms topic/queue. take a look at CxfBcJmsTest[1] to see how  
to configure cxf bc provider with jms transport.

And you can inject the proxy of cxf bc provider into your cxf se  
endpoint, then invoke the cxf bc provider from your cxf-se just like  
normal java invocation, take a look at the "Proxies" part of [2]

[1]https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcJmsTest.java
[2]http://servicemix.apache.org/servicemix-cxf-se.html

Freeman
On 2010-1-28, at 下午12:49, Lorena A wrote:

>
> Hello,
>
>
> The client will send a request via web service (the client does not  
> want to
> use JMS), then the request needs to go to a jms bc
>
> How can I invoke jms bc from cfx-se?
>
> Any help will be greatly appreciate!
>
> Thanks, Lorena
> -- 
> View this message in context: http://old.nabble.com/How-to-call-%28send-message%29-to-jms-bc-from-cxf-se-tp27351068p27351068.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com