You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Gary Brown <ga...@pi4tech.com> on 2011/06/08 23:37:00 UTC

Message transformation when using invoker

Hi

I'm using Tuscany 2 beta2 as an embedded component, and invoking a
service component through the
org.apache.tuscany.sca.invocation.Invoker api.

The service has been created using the cxf wsdl2java tool, so the
parameters are jaxb based Java classes. However I would like to be
able to pass in the XML document and have the framework handle the
necessary transformation to the appropriate type required by the
service interface.

At present the invocation is just returning a response message with an
IllegalArgumentException in the body.

Any suggestions, or suitable examples, would be appreciated.

Regards
Gary

Re: Message transformation when using invoker

Posted by Gary Brown <ga...@pi4tech.com>.
Thanks that worked.

Regards
Gary

On Thu, Jun 9, 2011 at 3:18 PM, ant elder <an...@gmail.com> wrote:
> In that case it should be relatively straight forward - you just need
> to set the databinding name on the interface correctly to what you
> need. One example of doing that is in the Hazelcast binding which
> sends xml on the wire so it uses the DOMDataBinding to have Tuscany
> use a DOM Node in the messages used by the binding. The code that does
> this is at:
>
> https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/binding/hazelcast/HazelcastBindingProviderFactory.java
>
> See the code line:
>
> interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
>
>   ...ant
>
> On Thu, Jun 9, 2011 at 3:04 PM, Gary Brown <ga...@pi4tech.com> wrote:
>> Hi Simon
>>
>> I have created my own binding, following the binding-sample, so I just
>> retrieve a reference to my equivalent of the SampleServiceInvoker.
>>
>> Regards
>> Gary
>>
>> On Thu, Jun 9, 2011 at 1:50 PM, Simon Laws <si...@googlemail.com> wrote:
>>> On Wed, Jun 8, 2011 at 10:37 PM, Gary Brown <ga...@pi4tech.com> wrote:
>>>> Hi
>>>>
>>>> I'm using Tuscany 2 beta2 as an embedded component, and invoking a
>>>> service component through the
>>>> org.apache.tuscany.sca.invocation.Invoker api.
>>>>
>>>> The service has been created using the cxf wsdl2java tool, so the
>>>> parameters are jaxb based Java classes. However I would like to be
>>>> able to pass in the XML document and have the framework handle the
>>>> necessary transformation to the appropriate type required by the
>>>> service interface.
>>>>
>>>> At present the invocation is just returning a response message with an
>>>> IllegalArgumentException in the body.
>>>>
>>>> Any suggestions, or suitable examples, would be appreciated.
>>>>
>>>> Regards
>>>> Gary
>>>>
>>>
>>> Hi Gary
>>>
>>> We do support such transformation but it relies on there being a
>>> suitable wire in place between a service binding and the service
>>> itself. If you look at the last diagram on this page [1]  you'll see a
>>> JMS binding being used to access a Java service. In between the
>>> binding and the service there is a chain of interceptors. These
>>> interceptors typically do formatting and policy handling. In
>>> particular the DatabindingInterceptor will try and convert the
>>> incoming message from the format at the binding to the format required
>>> by the service. Let's say we're receiving XML and the service is
>>> written in Java using JAXB objects as operation parameters (as is the
>>> case in  [1]) then the databinding will look at the incoming message,
>>> which will generally be an Axiom object when XML is coming in, and
>>> then use a JAXB context to convert this XML to appropriate JAXB
>>> objects. The reverse transformation happens when the response is
>>> returned.
>>>
>>> When you say you are "invoking a service component through the
>>> org.apache.tuscany.sca.invocation.Invoker api." can you say a bit more
>>> about how you retrieve the service to invoke and what what you
>>> actually do to enact the invocation.
>>>
>>> [1] http://tuscany.apache.org/documentation-2x/sca-java-runtime-overview.html
>>>
>>> Regards
>>>
>>> Simon
>>>
>>> --
>>> Apache Tuscany committer: tuscany.apache.org
>>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>>>
>>
>

Re: Message transformation when using invoker

Posted by ant elder <an...@gmail.com>.
In that case it should be relatively straight forward - you just need
to set the databinding name on the interface correctly to what you
need. One example of doing that is in the Hazelcast binding which
sends xml on the wire so it uses the DOMDataBinding to have Tuscany
use a DOM Node in the messages used by the binding. The code that does
this is at:

https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/binding/hazelcast/HazelcastBindingProviderFactory.java

See the code line:

interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);

   ...ant

On Thu, Jun 9, 2011 at 3:04 PM, Gary Brown <ga...@pi4tech.com> wrote:
> Hi Simon
>
> I have created my own binding, following the binding-sample, so I just
> retrieve a reference to my equivalent of the SampleServiceInvoker.
>
> Regards
> Gary
>
> On Thu, Jun 9, 2011 at 1:50 PM, Simon Laws <si...@googlemail.com> wrote:
>> On Wed, Jun 8, 2011 at 10:37 PM, Gary Brown <ga...@pi4tech.com> wrote:
>>> Hi
>>>
>>> I'm using Tuscany 2 beta2 as an embedded component, and invoking a
>>> service component through the
>>> org.apache.tuscany.sca.invocation.Invoker api.
>>>
>>> The service has been created using the cxf wsdl2java tool, so the
>>> parameters are jaxb based Java classes. However I would like to be
>>> able to pass in the XML document and have the framework handle the
>>> necessary transformation to the appropriate type required by the
>>> service interface.
>>>
>>> At present the invocation is just returning a response message with an
>>> IllegalArgumentException in the body.
>>>
>>> Any suggestions, or suitable examples, would be appreciated.
>>>
>>> Regards
>>> Gary
>>>
>>
>> Hi Gary
>>
>> We do support such transformation but it relies on there being a
>> suitable wire in place between a service binding and the service
>> itself. If you look at the last diagram on this page [1]  you'll see a
>> JMS binding being used to access a Java service. In between the
>> binding and the service there is a chain of interceptors. These
>> interceptors typically do formatting and policy handling. In
>> particular the DatabindingInterceptor will try and convert the
>> incoming message from the format at the binding to the format required
>> by the service. Let's say we're receiving XML and the service is
>> written in Java using JAXB objects as operation parameters (as is the
>> case in  [1]) then the databinding will look at the incoming message,
>> which will generally be an Axiom object when XML is coming in, and
>> then use a JAXB context to convert this XML to appropriate JAXB
>> objects. The reverse transformation happens when the response is
>> returned.
>>
>> When you say you are "invoking a service component through the
>> org.apache.tuscany.sca.invocation.Invoker api." can you say a bit more
>> about how you retrieve the service to invoke and what what you
>> actually do to enact the invocation.
>>
>> [1] http://tuscany.apache.org/documentation-2x/sca-java-runtime-overview.html
>>
>> Regards
>>
>> Simon
>>
>> --
>> Apache Tuscany committer: tuscany.apache.org
>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>>
>

Re: Message transformation when using invoker

Posted by Gary Brown <ga...@pi4tech.com>.
Hi Simon

I have created my own binding, following the binding-sample, so I just
retrieve a reference to my equivalent of the SampleServiceInvoker.

Regards
Gary

On Thu, Jun 9, 2011 at 1:50 PM, Simon Laws <si...@googlemail.com> wrote:
> On Wed, Jun 8, 2011 at 10:37 PM, Gary Brown <ga...@pi4tech.com> wrote:
>> Hi
>>
>> I'm using Tuscany 2 beta2 as an embedded component, and invoking a
>> service component through the
>> org.apache.tuscany.sca.invocation.Invoker api.
>>
>> The service has been created using the cxf wsdl2java tool, so the
>> parameters are jaxb based Java classes. However I would like to be
>> able to pass in the XML document and have the framework handle the
>> necessary transformation to the appropriate type required by the
>> service interface.
>>
>> At present the invocation is just returning a response message with an
>> IllegalArgumentException in the body.
>>
>> Any suggestions, or suitable examples, would be appreciated.
>>
>> Regards
>> Gary
>>
>
> Hi Gary
>
> We do support such transformation but it relies on there being a
> suitable wire in place between a service binding and the service
> itself. If you look at the last diagram on this page [1]  you'll see a
> JMS binding being used to access a Java service. In between the
> binding and the service there is a chain of interceptors. These
> interceptors typically do formatting and policy handling. In
> particular the DatabindingInterceptor will try and convert the
> incoming message from the format at the binding to the format required
> by the service. Let's say we're receiving XML and the service is
> written in Java using JAXB objects as operation parameters (as is the
> case in  [1]) then the databinding will look at the incoming message,
> which will generally be an Axiom object when XML is coming in, and
> then use a JAXB context to convert this XML to appropriate JAXB
> objects. The reverse transformation happens when the response is
> returned.
>
> When you say you are "invoking a service component through the
> org.apache.tuscany.sca.invocation.Invoker api." can you say a bit more
> about how you retrieve the service to invoke and what what you
> actually do to enact the invocation.
>
> [1] http://tuscany.apache.org/documentation-2x/sca-java-runtime-overview.html
>
> Regards
>
> Simon
>
> --
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>

Re: Message transformation when using invoker

Posted by Simon Laws <si...@googlemail.com>.
On Wed, Jun 8, 2011 at 10:37 PM, Gary Brown <ga...@pi4tech.com> wrote:
> Hi
>
> I'm using Tuscany 2 beta2 as an embedded component, and invoking a
> service component through the
> org.apache.tuscany.sca.invocation.Invoker api.
>
> The service has been created using the cxf wsdl2java tool, so the
> parameters are jaxb based Java classes. However I would like to be
> able to pass in the XML document and have the framework handle the
> necessary transformation to the appropriate type required by the
> service interface.
>
> At present the invocation is just returning a response message with an
> IllegalArgumentException in the body.
>
> Any suggestions, or suitable examples, would be appreciated.
>
> Regards
> Gary
>

Hi Gary

We do support such transformation but it relies on there being a
suitable wire in place between a service binding and the service
itself. If you look at the last diagram on this page [1]  you'll see a
JMS binding being used to access a Java service. In between the
binding and the service there is a chain of interceptors. These
interceptors typically do formatting and policy handling. In
particular the DatabindingInterceptor will try and convert the
incoming message from the format at the binding to the format required
by the service. Let's say we're receiving XML and the service is
written in Java using JAXB objects as operation parameters (as is the
case in  [1]) then the databinding will look at the incoming message,
which will generally be an Axiom object when XML is coming in, and
then use a JAXB context to convert this XML to appropriate JAXB
objects. The reverse transformation happens when the response is
returned.

When you say you are "invoking a service component through the
org.apache.tuscany.sca.invocation.Invoker api." can you say a bit more
about how you retrieve the service to invoke and what what you
actually do to enact the invocation.

[1] http://tuscany.apache.org/documentation-2x/sca-java-runtime-overview.html

Regards

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com