You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Hatfield, Dan" <da...@hp.com> on 2010/01/08 15:54:25 UTC

(Unknown)

Looking for some quick help on wireformats, specifically <ts:wireFormat.jmsText/>.
I think I must be missing something obvious.
Basically, I modified the composite files to the have tuscany name space and placed the <ts:wireFormat.jmsText/> in the appropriate locations.

So the hello world service example now looks like this:

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
        xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
        xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0"
        targetNamespace="http://helloworld"
        xmlns:hw="http://helloworld"
    name="helloworld">

    <component name="HelloWorldServiceComponent">
        <implementation.java class="helloworld.HelloWorldImpl" />
            <service name="HelloWorldService">
                <interface.java interface="helloworld.HelloWorldService"/>
                <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
                             jndiURL="tcp://localhost:61619">
                    <destination name="RequestQueue" create="ifnotexist"/>
                    <response>
                        <destination name="ResponseQueue" create="ifnotexist"/>
                                <ts:wireFormat.jmsText/>
                    </response>
                          <ts:wireFormat.jmsText/>
                </binding.jms>
        </service>
    </component>

</composite>

And the hello world reference jms example now looks like this:

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
        targetNamespace="http://helloworld"
      xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0"
        xmlns:hw="http://helloworld"
        name="helloworldjmsreference">

    <!-- A component with a reference promoted as a composite reference -->
    <component name="HelloWorldServiceComponent">
      <implementation.java class="helloworld.HelloWorldServiceComponent"/>
      <reference name="helloWorldService">
          <interface.java interface="helloworld.HelloWorldService"/>
          <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory"
                       jndiURL="tcp://localhost:61619">
              <destination name="RequestQueue" create="always"/>
              <response>
                  <destination name="ResponseQueue" create="always"/>
                        <ts:wireFormat.jmsText/>
              </response>
                  <ts:wireFormat.jmsText/>
          </binding.jms>
      </reference>
    </component>

</composite>


I expected this to work based on the fact that the HelloWorld interface is:

public String getGreetings(String s)

And my understanding of wireFormat.jmsText is this:

"The data in the JMS message is the string representation of data coming from/going to the service operation. The service operation signature is expected to have a single String parameter"

However, when I run this, I get the following error:
d helloworld-reference-jms

C:\Documents and Settings\hatfieda\workspace\Tuscany\tuscany-sca-1.5.1\samples\h
elloworld-reference-jms>ant run
Buildfile: build.xml

     [java] INFO: Starting node: helloworldjmsreference.composite
     [java] Injected helloWorldService
     [java] Called getGreetings
     [java] Exception in thread "main" java.lang.ClassCastException: org.apache.
activemq.command.ActiveMQTextMessage
     [java]     at org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime
.WireFormatJMSTextReferenceInterceptor.invokeRequest(WireFormatJMSTextReferenceI
nterceptor.java:83)
     [java]     at org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime
.WireFormatJMSTextReferenceInterceptor.invoke(WireFormatJMSTextReferenceIntercep
tor.java:65)
     [java]     at org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime
.WireFormatJMSTextReferenceInterceptor.invoke(WireFormatJMSTextReferenceIntercep
tor.java:68)
     [java]     at org.apache.tuscany.sca.binding.jms.provider.RRBJMSBindingInvo
ker.invoke(RRBJMSBindingInvoker.java:203)
     [java]     at org.apache.tuscany.sca.core.databinding.wire.PassByValueInter
ceptor.invoke(PassByValueInterceptor.java:55)
     [java]     at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
nvoke(JDKInvocationHandler.java:346)
     [java]     at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
nvoke(JDKInvocationHandler.java:193)
     [java]     at $Proxy5.getGreetings(Unknown Source)
     [java]     at helloworld.HelloWorldServiceComponent.getGreetings(HelloWorld
ServiceComponent.java:30)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at org.apache.tuscany.sca.implementation.java.invocation.JavaImp
lementationInvoker.invoke(JavaImplementationInvoker.java:156)
     [java]     at org.apache.tuscany.sca.core.databinding.wire.PassByValueInter
ceptor.invoke(PassByValueInterceptor.java:60)
     [java]     at org.apache.tuscany.sca.binding.sca.impl.SCABindingInvoker.inv
oke(SCABindingInvoker.java:61)
     [java]     at org.apache.tuscany.sca.core.databinding.wire.PassByValueInter
ceptor.invoke(PassByValueInterceptor.java:60)
     [java]     at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
nvoke(JDKInvocationHandler.java:346)
     [java]     at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.i
nvoke(JDKInvocationHandler.java:193)
     [java]     at $Proxy5.getGreetings(Unknown Source)
     [java]     at helloworld.HelloWorldJmsClient.main(HelloWorldJmsClient.java:
36)



RE: Re:

Posted by "Hatfield, Dan" <da...@hp.com>.
Thanks Simon.
It is raised - https://issues.apache.org/jira/browse/TUSCANY-3418
 

-----Original Message-----
From: Simon Laws [mailto:simonslaws@googlemail.com] 
Sent: Friday, January 08, 2010 10:55 AM
To: user@tuscany.apache.org
Subject: Re:

Hi Dan

Yes, I'm seeing it here also. In this case the
WireFormatJMSTextReferenceInterceptor is being added to the wire twice
for some reason and that's causing the problem. Don't know why yet but
can you raise a JIRA [1] for the problem and I'll look at making a fix
for it.

Thanks

Simon

[1] https://issues.apache.org/jira/browse/TUSCANY

RE: Re:

Posted by "Hatfield, Dan" <da...@hp.com>.
Yes, this does work for the hello world example.
It doesn't work for my actual case for some reason.
But I found that my actual case works when I place the <ts:wireFormat.jmsText/> on only the request destination (i.e. not in the response node).

My actual topology looks like this:

non-sca WebsphereMQ client talking to SCA node (sevice) talking to non-sca websphere MQ server (which is a reference)

What works for me is <ts:wireFormat.jmsText> on the request destination on the service and the reference and nothing with regards to <ts:wireFormat> in the <response> nodes on either the service or the reference.
I think the WebsphereMQ mangler of JMS headers might have something to do with it, but its been hard to verify.

Hope that makes sense.
Here's a sanitized composite file if it helps clarify.

<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
	xmlns:ts="http://tuscany.apache.org/xmlns/sca/1.0"
	xmlns:s="http://ActualComponent"
	targetNamespace="http://ActualComponent"
	name="ActualComponent">

	<component name="ActualComponent">
		<implementation.java class="actual.component.implementation"/>
      	<reference name="LegacyService">
          	<interface.java interface="legacy_service"/>
          	<binding.jms>
           		<destination name="WebsphereMQ.Request"/>
       			<connectionFactory name="WebsphereMQ.QCF"/>
           		<response>
               		<destination name="WebsphereMQ.Response"/>
           			<connectionFactory name="WebsphereMQ.QCF"/>
           			<activationSpec name="WebsphereMQ.Response.AS "/>
            	</response>
            	<ts:wireFormat.jmsText/>
          	</binding.jms>
	    </reference>			
		<service name="SCAService">
                <interface.java interface="sca_service"/>
                <binding.jms correlationScheme="RequestMsgIDToCorrelID">
 	          		<destination name="WebsphereMQ.SCAService.Request"/>
       			<activationSpec name="WebsphereMQ.SCAService.Request.AS"/>
    	       		<response>
        	       		<destination name="WebsphereMQ.SCAService.Response"/>
           				<connectionFactory name="WebsphereMQ.QCF"/>
            		</response>
            		<ts:wireFormat.jmsText/>
                </binding.jms>
        </service>			
	</component>
</composite>

The interface definitions on both sca_service and legacy_service are - String method(String).

Anyway...I'm off and running again for now. Thanks.

-----Original Message-----
From: Simon Laws [mailto:simonslaws@googlemail.com] 
Sent: Friday, January 08, 2010 12:41 PM
To: user@tuscany.apache.org
Subject: Re: Re:

Thanks Dan

Could you try something for me. Can you replace

<ts:wireFormat.jmsText/>

with

<ts:wireFormat.jmsdefault sendFormat="text"/>

Bit of a long shot but I don't believe the jmsdefault format suffers
from the same bug as jmstext.

Let me know

Regards

Simon

Re: Re:

Posted by Simon Laws <si...@googlemail.com>.
Thanks Dan

Could you try something for me. Can you replace

<ts:wireFormat.jmsText/>

with

<ts:wireFormat.jmsdefault sendFormat="text"/>

Bit of a long shot but I don't believe the jmsdefault format suffers
from the same bug as jmstext.

Let me know

Regards

Simon

RE: Re:

Posted by "Hatfield, Dan" <da...@hp.com>.
Also,
By the way can you think of a temporary workaround offhand?
The end point I'm communicating with is not something built with SCA. It is an legacy request/response messaging pattern exposed via WebsphereMQ.

So it just expects a JMS message with a text payload. The payload is an XML document (proprietary schema).



-----Original Message-----
From: Hatfield, Dan 
Sent: Friday, January 08, 2010 11:11 AM
To: 'user@tuscany.apache.org'
Subject: RE: Re:

Thanks Simon.
It is raised - https://issues.apache.org/jira/browse/TUSCANY-3418
 

-----Original Message-----
From: Simon Laws [mailto:simonslaws@googlemail.com] 
Sent: Friday, January 08, 2010 10:55 AM
To: user@tuscany.apache.org
Subject: Re:

Hi Dan

Yes, I'm seeing it here also. In this case the
WireFormatJMSTextReferenceInterceptor is being added to the wire twice
for some reason and that's causing the problem. Don't know why yet but
can you raise a JIRA [1] for the problem and I'll look at making a fix
for it.

Thanks

Simon

[1] https://issues.apache.org/jira/browse/TUSCANY

Re:

Posted by Simon Laws <si...@googlemail.com>.
Hi Dan

Yes, I'm seeing it here also. In this case the
WireFormatJMSTextReferenceInterceptor is being added to the wire twice
for some reason and that's causing the problem. Don't know why yet but
can you raise a JIRA [1] for the problem and I'll look at making a fix
for it.

Thanks

Simon

[1] https://issues.apache.org/jira/browse/TUSCANY

Re:

Posted by Simon Laws <si...@googlemail.com>.
Hi Dan

Looks OK at first glance. Let me try running it here.

Simon