You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Michael Vorburger <mi...@vorburger.ch> on 2011/08/29 17:59:53 UTC

Re: Dynamic SDO REST and SOAP data services

Simon? I've spent a little bit of time on the week-end to dig more
into SDO with Tuscany 2.0, but am confused now:

>> I just took a look at the 2.x code and I it looks like SDO hasn't been
>> ported over to 2.x completely yet. I see databinding-sdo and
>> databinding-sdo-axiom in the modules directory and in the build but
>> then I see a comment in the itest pom...
>>
>> <!-- wait until databinding-sdo is in
>>                <module>properties</module>
>> -->

As far as I can tell, testing/itest/properties has nothing to do with
SDO, that comment in the itest/pom appears to be misleading? I'm
proposing a first few small fixes towards making
testing/itest/properties pass in
https://github.com/vorburger/tuscany-sca-2.x/commit/da22acd05d0a05fd9d90c35f167672e32870e194
- but this is completely unrelated to SDO - would you agree or am I
not getting it? Note that the tests in modules/databinding-sdo &
databinding-sdo-axiom both pass.

I've meanwhile found
https://issues.apache.org/jira/browse/TUSCANY-3469, but noticed this
was removed from current SVN trunk and 2.0-Beta3 distrib. On
https://github.com/vorburger/tuscany-sca-2.x/tree/trunk/samples/getting-started/helloworld-webservice-sdo
is my attempt to get an (adapted) version of what was the
helloworld-ws-sdo.zip attached to that JIRA to pass again -
unfortunately currently failing with a java.lang.NullPointerException
at org.apache.tuscany.sca.databinding.sdo.SDOTypeHelper.addResolvedXSDs(SDOTypeHelper.java:172).
My understanding of Tuscany's internals, after scanning over its code
over the week-end, are too limited to understand how this could ever
have worked or where to start fixing this - the ModelResolver resolver
is passed in from WSDLContractBuilder build where a null is
hard-coded. Anybody willing to help getting this
helloworld-webservice-sdo to pass and included in trunk again? Or
point to what what would have to be done to get it to pass.

I've also attempted to build a helloworld-webservice-sdo-dynamic
example, same thing with dynamic SDO and no code generation, see
https://github.com/vorburger/tuscany-sca-2.x/commit/9a0fc93f2ba382583c74d480e03bdc36e79418f4.
That currently fails with the following exception:

org.apache.tuscany.sca.databinding.TransformationException:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2
counts of IllegalAnnotationExceptions
commonj.sdo.DataObject is an interface, and JAXB can't handle interfaces.
	this problem is related to the following location:
		at commonj.sdo.DataObject
		at protected commonj.sdo.DataObject sample.jaxws.SayHello.arg0
		at sample.jaxws.SayHello
commonj.sdo.DataObject does not have a no-arg default constructor.
	this problem is related to the following location:
		at commonj.sdo.DataObject
		at protected commonj.sdo.DataObject sample.jaxws.SayHello.arg0
		at sample.jaxws.SayHello
	at org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement.transform(JAXB2OMElement.java:60)

because for some reason it's trying to do JAXB instead of SDO data
binding in this case... anybody willing to advise what I'm doing wrong
in this proposed example, and how to fix it?

While playing with this I did found one issue which I think is a bug
in SDOContextHelper which may have crept into 2.x but gone unnoticed
due to the removed SDO examples... before hitting above, you'd get a
java.lang.NullPointerException at
org.apache.tuscany.sca.databinding.sdo.ImportSDOProcessor.importWSDL(ImportSDOProcessor.java:176)
- addressed by https://github.com/vorburger/tuscany-sca-2.x/commit/8822ba1b3b1560d01879bceb9970b165be16340c
- you may want to integrate that? JIRA? (And a TC for this should be
added in SDOContextHelperTestCase I guess.)


On Mon, Aug 22, 2011 at 4:35 PM, Michael Vorburger <mi...@vorburger.ch> wrote:
> Hello Simon,
>
> thank you so much for responding. You most certainly helped...
>
>> String getGreetings(DataObject myGreeting);
>
> this is all it took - and it now seems obvious - once you know it! ;-)
>
> I've pushed the change I made back to my
> https://github.com/vorburger/vorburgers-blueprints/tree/master/helloworld-ws-sdo-dyn.
> Would you be interested in having this as an example included in
> Tuscany?
>
>> Hence to make SDO work the SDO databinding would need to be ported from 1.x
>
> I might have a look into what effort it would take on 2.0 - if I do,
> would this be a welcome contribution?
>
> Best,
> Michael
>
> PS: In looking into this I've also come across two general SDO Qs
> which I'll post in a separate new thread.
> _______________________
> Michael Vorburger
> http://www.vorburger.ch
>
>
>
> On Fri, Aug 19, 2011 at 7:02 PM, Simon Laws <si...@googlemail.com> wrote:
>> On Thu, Aug 18, 2011 at 6:08 PM, Michael Vorburger <mi...@vorburger.ch> wrote:
>>> Hello Tuscans,
>>>
>>> I am interested in Tuscany SCA with Dynamic (!) SDO, to both expose &
>>> consume data via REST and SOAP services.  Can Tuscany do this?
>>>
>>> http://tuscany.apache.org/tuscany-sdo-java-faq.html under "How to use
>>> SDO in tuscany SCA?" says that "It's possible to use Static SDO or
>>> Dynamic SDO" it seems it should - but I am having trouble getting this
>>> to work:
>>>
>>> In https://github.com/vorburger/vorburgers-blueprints/blob/master/helloworld-ws-sdo-dyn/src/test/java/helloworld/HelloWorldDynamicClientTestCase.java,
>>> how do you pass the DataObject into getGreetings() ? I'm probably
>>> getting this all wrong, and the SOAP service client should be generic,
>>> somehow?
>>>
>>> Similarly, how would one go about creating a "dynamic" service? In the
>>> same example project, can the Name interface etc. code generation be
>>> avoided on the server side as well, just having SDO read e.g. the XSD
>>> (or any other dynamic model source) ?
>>>
>>> BTW: The sample-helloworld-ws-sdo is only bundled in v1.6.2 and not in
>>> v2.0-Beta3, is that a case of "not yet" or a "won't be anymore" ?  Is
>>> SDO still used?
>>>
>>> Thanks a lot for any help,
>>> Michael
>>>
>>> _______________________
>>> Michael Vorburger
>>> http://www.vorburger.ch
>>>
>>
>> Hi Michael
>>
>> I just took a look at the 2.x code and I it looks like SDO hasn't been
>> ported over to 2.x completely yet. I see databinding-sdo and
>> databinding-sdo-axiom in the modules directory and in the build but
>> then I see a comment in the itest pom...
>>
>> <!-- wait until databinding-sdo is in
>>                <module>properties</module>
>> -->
>>
>> I haven't seen anyone changing the SDO code itself in a long time and
>> it doesn't seem that there are manyof committers around that know
>> about it. Having said that it worked in 1.x so I don't see a
>> particular reason why it can't be brought into 2.x if there is someone
>> willing to do it.
>>
>> re. actually using it in services.
>>
>> Tuscany treats references and service independently and provides a
>> databinding framework to smooth out the inconsistencies. You could
>> implement getGreetings() at you service in a number of different ways,
>> for example,
>>
>> String getGreetings(MyGreetingJavaBean myGreeting);
>> or
>> String getGreetings(MyGreetingJAXB myGreeting);
>> or
>> String getGreetings(MyGreetingSDO myGreeting);
>> or
>> String getGreetings(DataObject myGreeting);
>>
>> Then if you define you're service as
>>
>> <component name="GreetingComponent">
>>  <implementation.java class="com.greeting.app.GreeterImpl"/>
>>  <service name="Greeter">
>>    <binding.ws uri="http://localhost:8080/my/greeter"/>
>>  </service>
>> </component>
>>
>> The client should be able to send SOAP messages to
>> http://localhost:8080/my/greeter just like any other WS endpoint. In
>> particular you could do http://localhost:8080/my/greeter?wsdl and this
>> will tell you what the interface looks like irrespective of what
>> databinding the implementation assumes.
>>
>> Under the covers on the service side Tuscany looks at the
>> implementation and finds out what sort of data it's expecting, e.g.
>> Java bean, JAXB, Static SDO, Dynamic SDO. It then looks at the binding
>> to see what sort of data is available. XML in the binding.ws case (In
>> Tuscany this will be represented using Axiom). Then it looks for a
>> databinding to convert between the two and hence complete the call to
>> the service.
>>
>> Hence to make SDO work the SDO databinding would need to be ported from 1.x
>>
>> As an aside there are some databindings that are binding specific, for
>> example, if you wanted to do
>>
>> String getGreetings(javax.jms.Message myGreeting);
>>
>> The you would need to use the JMS binding.
>>
>> Not sure if this is helping answer the question.
>>
>> Regards
>>
>> Simon
>>
>> --
>> Apache Tuscany committer: tuscany.apache.org
>> Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Re: Dynamic SDO REST and SOAP data services

Posted by Simon Laws <si...@googlemail.com>.
On Fri, Sep 2, 2011 at 7:34 PM, Michael Vorburger <mi...@vorburger.ch> wrote:
> Hello Scott,
>
> On Tue, Aug 30, 2011 at 4:03 PM, Scott Kurz <sk...@gmail.com> wrote:
>
>>> It looks like it doesn't know that DataObject means SDO. It maybe that
>>> the SDO data binding it not fully enabled for some reason. I'll give
>>> it a try here an see if I get the same result.
>
> Any luck?
>
>> I'm not even looking at your test app, but I can say that this JIRA
>> https://issues.apache.org/jira/browse/TUSCANY-3910
>> will give a similar symptom.
>>
>> A workaround is to add the @RequestWrapper/@ResponseWrapper annotations with
>> ...className=commonj.sdo.DataObject".
>
> I've just tried that (to be specific: added a
> @RequestWrapper(className="commonj.sdo.DataObject") &
> @ResponseWrapper(className="commonj.sdo.DataObject") on the String
> sayHello(DataObject name); method of my Helloworld interface), but
> that only instead of the earlier exception leads to a
> java.lang.ClassCastException:
> org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to
> commonj.sdo.DataObject at
> org.apache.tuscany.sca.databinding.sdo2om.DataObject2OMElement.transform(DataObject2OMElement.java:44)
>
> Cheers,
> Michael
> _______________________
> Michael Vorburger
> http://www.vorburger.ch
>

Hi Michael

Apologies it's taken me a long time to get back to this. I've applied
3937 but not closed it yet as it's taking my a while to unravel what's
going on with the properties test. It's currently failing because it's
not assigning correct datatypes to properties with non-JAXB java bean
types.

Simon

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

Re: Dynamic SDO REST and SOAP data services

Posted by Michael Vorburger <mi...@vorburger.ch>.
Hello Scott,

On Tue, Aug 30, 2011 at 4:03 PM, Scott Kurz <sk...@gmail.com> wrote:

>> It looks like it doesn't know that DataObject means SDO. It maybe that
>> the SDO data binding it not fully enabled for some reason. I'll give
>> it a try here an see if I get the same result.

Any luck?

> I'm not even looking at your test app, but I can say that this JIRA
> https://issues.apache.org/jira/browse/TUSCANY-3910
> will give a similar symptom.
>
> A workaround is to add the @RequestWrapper/@ResponseWrapper annotations with
> ...className=commonj.sdo.DataObject".

I've just tried that (to be specific: added a
@RequestWrapper(className="commonj.sdo.DataObject") &
@ResponseWrapper(className="commonj.sdo.DataObject") on the String
sayHello(DataObject name); method of my Helloworld interface), but
that only instead of the earlier exception leads to a
java.lang.ClassCastException:
org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to
commonj.sdo.DataObject at
org.apache.tuscany.sca.databinding.sdo2om.DataObject2OMElement.transform(DataObject2OMElement.java:44)

Cheers,
Michael
_______________________
Michael Vorburger
http://www.vorburger.ch

Re: Dynamic SDO REST and SOAP data services

Posted by Scott Kurz <sk...@gmail.com>.
I wish I'd more time to investigate SDO, but just a quick comment on this
point:


> It looks like it doesn't know that DataObject means SDO. It maybe that
> the SDO data binding it not fully enabled for some reason. I'll give
> it a try here an see if I get the same result.
>

I'm not even looking at your test app, but I can say that this JIRA
https://issues.apache.org/jira/browse/TUSCANY-3910
will give a similar symptom.

A workaround is to add the @RequestWrapper/@ResponseWrapper annotations with
...className=commonj.sdo.DataObject".

The reason has to do with the ordering of the visitors which we had in 1.x
is no longer in place in 2.x.

Re: Dynamic SDO REST and SOAP data services

Posted by Michael Vorburger <mi...@vorburger.ch>.
Hello Simon,

I've filed https://issues.apache.org/jira/browse/TUSCANY-3936 &
https://issues.apache.org/jira/browse/TUSCANY-3937, as requested.

> I'd have to look at the test/code to work out what's going on. I may get a chance later in the week.

Any luck?

Best,
Michael
_______________________
Michael Vorburger
http://www.vorburger.ch



On Tue, Aug 30, 2011 at 12:39 PM, Simon Laws <si...@googlemail.com> wrote:
> Hi Michael
>
> Thanks for taking a look at the samples. Comments in-line...
>
> Regards
>
> Simon
>
> snip...
>
>>
>> As far as I can tell, testing/itest/properties has nothing to do with
>> SDO, that comment in the itest/pom appears to be misleading?
>
> I think you right. I took a quick look in the pom and it doesn't
> mention SDO. I was misslead by the comment. I seem to remember there
> were some SDO property tests, i.e, an SCA porperty whose type is an
> SDO, but maybe they were elsewhere.
>
>> I'm
>> proposing a first few small fixes towards making
>> testing/itest/properties pass in
>> https://github.com/vorburger/tuscany-sca-2.x/commit/da22acd05d0a05fd9d90c35f167672e32870e194
>
> Excellent. If you want to get this in the code base, capture the diff,
> attach it to a JIRA and press the "grant to ASF" button I can check it
> on for you.
>
>> - but this is completely unrelated to SDO - would you agree or am I
>> not getting it? Note that the tests in modules/databinding-sdo &
>> databinding-sdo-axiom both pass.
>
> Sounds right. to me.
>
>>
>> I've meanwhile found
>> https://issues.apache.org/jira/browse/TUSCANY-3469, but noticed this
>> was removed from current SVN trunk and 2.0-Beta3 distrib. On
>> https://github.com/vorburger/tuscany-sca-2.x/tree/trunk/samples/getting-started/helloworld-webservice-sdo
>> is my attempt to get an (adapted) version of what was the
>> helloworld-ws-sdo.zip attached to that JIRA to pass again -
>> unfortunately currently failing with a java.lang.NullPointerException
>> at org.apache.tuscany.sca.databinding.sdo.SDOTypeHelper.addResolvedXSDs(SDOTypeHelper.java:172).
>> My understanding of Tuscany's internals, after scanning over its code
>> over the week-end, are too limited to understand how this could ever
>> have worked or where to start fixing this - the ModelResolver resolver
>> is passed in from WSDLContractBuilder build where a null is
>> hard-coded. Anybody willing to help getting this
>> helloworld-webservice-sdo to pass and included in trunk again? Or
>> point to what what would have to be done to get it to pass.
>
> We started from scratch with the samples as there were too may that
> didn't work properly. I don't think it was anti-SDO in particular. I'd
> have to look at the test/code to work out what's going on. I may get a
> chance later in the week.
>
>>
>> I've also attempted to build a helloworld-webservice-sdo-dynamic
>> example, same thing with dynamic SDO and no code generation, see
>> https://github.com/vorburger/tuscany-sca-2.x/commit/9a0fc93f2ba382583c74d480e03bdc36e79418f4.
>> That currently fails with the following exception:
>>
>> org.apache.tuscany.sca.databinding.TransformationException:
>> com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2
>> counts of IllegalAnnotationExceptions
>> commonj.sdo.DataObject is an interface, and JAXB can't handle interfaces.
>>        this problem is related to the following location:
>>                at commonj.sdo.DataObject
>>                at protected commonj.sdo.DataObject sample.jaxws.SayHello.arg0
>>                at sample.jaxws.SayHello
>> commonj.sdo.DataObject does not have a no-arg default constructor.
>>        this problem is related to the following location:
>>                at commonj.sdo.DataObject
>>                at protected commonj.sdo.DataObject sample.jaxws.SayHello.arg0
>>                at sample.jaxws.SayHello
>>        at org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement.transform(JAXB2OMElement.java:60)
>>
>> because for some reason it's trying to do JAXB instead of SDO data
>> binding in this case... anybody willing to advise what I'm doing wrong
>> in this proposed example, and how to fix it?
>
> It looks like it doesn't know that DataObject means SDO. It maybe that
> the SDO data binding it not fully enabled for some reason. I'll give
> it a try here an see if I get the same result.
>>
>> While playing with this I did found one issue which I think is a bug
>> in SDOContextHelper which may have crept into 2.x but gone unnoticed
>> due to the removed SDO examples... before hitting above, you'd get a
>> java.lang.NullPointerException at
>> org.apache.tuscany.sca.databinding.sdo.ImportSDOProcessor.importWSDL(ImportSDOProcessor.java:176)
>> - addressed by https://github.com/vorburger/tuscany-sca-2.x/commit/8822ba1b3b1560d01879bceb9970b165be16340c
>> - you may want to integrate that? JIRA? (And a TC for this should be
>> added in SDOContextHelperTestCase I guess.)
>
> Again, if you want to create a JIRA/Patch I can apply it.
>>
>>
>
>
> --
> Apache Tuscany committer: tuscany.apache.org
> Co-author of a book about Tuscany and SCA: tuscanyinaction.com
>

Re: Dynamic SDO REST and SOAP data services

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

Thanks for taking a look at the samples. Comments in-line...

Regards

Simon

snip...

>
> As far as I can tell, testing/itest/properties has nothing to do with
> SDO, that comment in the itest/pom appears to be misleading?

I think you right. I took a quick look in the pom and it doesn't
mention SDO. I was misslead by the comment. I seem to remember there
were some SDO property tests, i.e, an SCA porperty whose type is an
SDO, but maybe they were elsewhere.

> I'm
> proposing a first few small fixes towards making
> testing/itest/properties pass in
> https://github.com/vorburger/tuscany-sca-2.x/commit/da22acd05d0a05fd9d90c35f167672e32870e194

Excellent. If you want to get this in the code base, capture the diff,
attach it to a JIRA and press the "grant to ASF" button I can check it
on for you.

> - but this is completely unrelated to SDO - would you agree or am I
> not getting it? Note that the tests in modules/databinding-sdo &
> databinding-sdo-axiom both pass.

Sounds right. to me.

>
> I've meanwhile found
> https://issues.apache.org/jira/browse/TUSCANY-3469, but noticed this
> was removed from current SVN trunk and 2.0-Beta3 distrib. On
> https://github.com/vorburger/tuscany-sca-2.x/tree/trunk/samples/getting-started/helloworld-webservice-sdo
> is my attempt to get an (adapted) version of what was the
> helloworld-ws-sdo.zip attached to that JIRA to pass again -
> unfortunately currently failing with a java.lang.NullPointerException
> at org.apache.tuscany.sca.databinding.sdo.SDOTypeHelper.addResolvedXSDs(SDOTypeHelper.java:172).
> My understanding of Tuscany's internals, after scanning over its code
> over the week-end, are too limited to understand how this could ever
> have worked or where to start fixing this - the ModelResolver resolver
> is passed in from WSDLContractBuilder build where a null is
> hard-coded. Anybody willing to help getting this
> helloworld-webservice-sdo to pass and included in trunk again? Or
> point to what what would have to be done to get it to pass.

We started from scratch with the samples as there were too may that
didn't work properly. I don't think it was anti-SDO in particular. I'd
have to look at the test/code to work out what's going on. I may get a
chance later in the week.

>
> I've also attempted to build a helloworld-webservice-sdo-dynamic
> example, same thing with dynamic SDO and no code generation, see
> https://github.com/vorburger/tuscany-sca-2.x/commit/9a0fc93f2ba382583c74d480e03bdc36e79418f4.
> That currently fails with the following exception:
>
> org.apache.tuscany.sca.databinding.TransformationException:
> com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2
> counts of IllegalAnnotationExceptions
> commonj.sdo.DataObject is an interface, and JAXB can't handle interfaces.
>        this problem is related to the following location:
>                at commonj.sdo.DataObject
>                at protected commonj.sdo.DataObject sample.jaxws.SayHello.arg0
>                at sample.jaxws.SayHello
> commonj.sdo.DataObject does not have a no-arg default constructor.
>        this problem is related to the following location:
>                at commonj.sdo.DataObject
>                at protected commonj.sdo.DataObject sample.jaxws.SayHello.arg0
>                at sample.jaxws.SayHello
>        at org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement.transform(JAXB2OMElement.java:60)
>
> because for some reason it's trying to do JAXB instead of SDO data
> binding in this case... anybody willing to advise what I'm doing wrong
> in this proposed example, and how to fix it?

It looks like it doesn't know that DataObject means SDO. It maybe that
the SDO data binding it not fully enabled for some reason. I'll give
it a try here an see if I get the same result.
>
> While playing with this I did found one issue which I think is a bug
> in SDOContextHelper which may have crept into 2.x but gone unnoticed
> due to the removed SDO examples... before hitting above, you'd get a
> java.lang.NullPointerException at
> org.apache.tuscany.sca.databinding.sdo.ImportSDOProcessor.importWSDL(ImportSDOProcessor.java:176)
> - addressed by https://github.com/vorburger/tuscany-sca-2.x/commit/8822ba1b3b1560d01879bceb9970b165be16340c
> - you may want to integrate that? JIRA? (And a TC for this should be
> added in SDOContextHelperTestCase I guess.)

Again, if you want to create a JIRA/Patch I can apply it.
>
>


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