On 11/15/06, moraleslos <[EMAIL PROTECTED]> wrote:
I see. Now, before I take one of the two routes you described, I need to
make sure on a couple of things.
1) >>If you just want to do jaxb2 marshaling, you can also just use jaxb2
inside
>> a lightweight component.
Actually, I want to do jaxb2 UNmarshaling. will this work inside a
lightweight component too? I'm assuming you mean to define the jaxb2
component in my servicemix.xml file.
You can use jaxb2 wherever you want, provided that you take
care of including the needed jars.
2) Which ever route I choose, once I unmarshal the data into my POJOs, I
want to persist them right away into the database. I'm planning on having
these jaxb2-annotated POJOs to also include hibernate/ejb3-annotations as
well. What do you recommend on doing this? The way I see it thus far, I
will need to write a web service that will take in the xml data from the
NMR, call a *service* to unmarshal it into my POJOs, and then call another
*service* (presumably a DAO) to persist the POJOs into the DB.
If you use jsr181, the unmarshalling will be performed for you, you would
just have to persist the beans. If you want to expose a web service,
take a look at the wsdl-first example, and just write your own peristence
code in the jsr181 POJO.
Thanks in advance.
-los
gnodet wrote:
>
> The typeMapping attribute can be used to select the xml marshaling
> layer that will be used to marshal / unmarshal data.
> The jsr181 component purpose is to expose a POJO as a (web) service
> on the JBI bus: the POJO's methods will be exposed and if the method
> returns a non void object, it will be returned in the out message.
> You can also use it to invoke other services exposed on the JBI bus.
>
> If you just want to do jaxb2 marshaling, you can also just use jaxb2
> inside
> a lightweight component.
>
> On 11/15/06, moraleslos <[EMAIL PROTECTED]> wrote:
>>
>> I'm a bit confused. All I want to do is unmarshal data from an XML
>> document
>> that is coming from the NMR into my pojos... I thought that was what the
>> typeMapping attribute was for.
>>
>> So if I'm understanding correctly, I'll need to create a Web service that
>> will accept this XML document and then invoke another service that will
>> use
>> jaxb2 APIs to unmarshal the data? Again, I'm still fairly new to all of
>> this jsr181 stuff. Thanks in advance.
>>
>> -los
>>
>>
>>
>> gnodet wrote:
>> >
>> > The pojoClass is the class of your web service.
>> > It could look like:
>> >
>> >
>>
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-itests/src/test/java/org/apache/servicemix/samples/wsdl_first/PersonImpl.java?view=markup
>> >
>> > On 11/15/06, moraleslos <[EMAIL PROTECTED]> wrote:
>> >>
>> >> I was successfully able to create two SUs with an issue though. When
>> >> running
>> >> my SA I get this exception:
>> >>
>> >> ############################
>> >> 13:39:30,535 | INFO | Thread-7 | DefaultFaultHandler |
>> >> re.handler.DefaultFaultHandler 39 | Fault occurred!
>> >> org.codehaus.xfire.fault.XFireFault: Invalid operation: document
>> >> at
>> >>
>>
org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:41)
>> >> at
>> >>
>>
org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
>> >> at
>> >>
>> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
>> >> at
>> >>
>>
org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
>> >> at
>> >>
>> org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
>> >> at
>> >>
>>
org.apache.servicemix.jsr181.Jsr181ExchangeProcessor.doProcess(Jsr181ExchangeProcessor.java:113)
>> >> at
>> >>
>>
org.apache.servicemix.jsr181.Jsr181ExchangeProcessor.process(Jsr181ExchangeProcessor.java:68)
>> >> at
>> >>
>>
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:410)
>> >> at
>> >>
>>
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:43)
>> >> at
>> >>
>>
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624)
>> >> at
>> >>
>>
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170)
>> >> at
>> >>
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:177)
>> >> at
>> >>
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:227)
>> >> at
>> >>
>> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
>> >> at
>> >> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
>> >> Source)
>> >> at java.lang.Thread.run(Thread.java:619)
>> >> #########################################
>> >>
>> >>
>> >> I think this is because I defined by endpoint attributes wrong.
>> Looking
>> >> at
>> >> my xbean.xml:
>> >>
>> >> #########################
>> >> <jsr181:endpoint
>> >> service="foo:xmlUnmarshaller"
>> >> endpoint="xmlUnmarshaller"
>> >> pojoClass="com.test.integration.servicemix.Document"
>> >> typeMapping="jaxb2"/>
>> >> #########################
>> >>
>> >> Is the "pojoClass" attribute suppose to be the root class for data to
>> be
>> >> unmarshalled or something else? Here I assume this is the root class.
>> >> Document has the @XmlRootElement jaxb2 annotation so I would assume
>> that
>> >> the
>> >> jsr181 will notice this and start unmarshaling the xml document into
>> my
>> >> POJOs. I also know my jaxb2-annotated POJOs work (from unit testing)
>> so
>> >> it
>> >> can't be my POJOs.
>> >>
>> >>
>> >>
>> >> >>I think this would be a great addition to ServiceMix if service
>> units
>> >> >> could reference some kind of shared libraries somehow ...
>> >> Looks like the JBI spec needs improving ;-)
>> >>
>> >> Thanks in advance!
>> >>
>> >> -los
>> >>
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > Unfortunately, there's no way to share some code between SU
>> >> > (other than putting this jar in the container classpath). The main
>> >> > reason is that JBI has been designed around xml based interactions,
>> >> > but if you need to put some classes inside properties for example,
>> >> > you need a common jar :(
>> >> > I think this would be a great addition to ServiceMix if service
>> units
>> >> > could reference some kind of shared libraries somehow ...
>> >> >
>> >> > On 11/15/06, moraleslos <[EMAIL PROTECTED]> wrote:
>> >> >>
>> >> >> Ok, I'll give separation a shot. I do have a question related to
>> this
>> >> >> though. Suppose I have two SUs that are dependent on a common jar,
>> >> and
>> >> >> both
>> >> >> of these SUs are packaged into one SA. Each SU has this common jar
>> >> >> packaged
>> >> >> into its /lib directory. Wouldn't there be some kind of class
>> loading
>> >> >> issue? Therefore how would you define this one common jar to be
>> >> shared
>> >> >> across the SUs? Would you define it in the SA or must this common
>> jar
>> >> be
>> >> >> placed into a shared directory ala smx's lib/optional directory?
>> >> Thanks
>> >> >> in
>> >> >> advance.
>> >> >>
>> >> >> -los
>> >> >>
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > The xbean.xml for the jsr81 should be packaged in its
>> >> >> > own SU and referenced from the SA jbi.xml.
>> >> >> >
>> >> >> > On 11/15/06, moraleslos <[EMAIL PROTECTED]> wrote:
>> >> >> >>
>> >> >> >> Could it be that I'm placing the xbean.xml file in the wrong
>> >> location?
>> >> >> >> Currently I have it packaged in my SU at the same location to
>> where
>> >> my
>> >> >> >> servicemix.xml is located. This SU is deployed to on top of the
>> >> >> >> servicemix-lwcontainer. The generated jbi.xml looks like this:
>> >> >> >>
>> >> >> >> #################
>> >> >> >> <jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0">
>> >> >> >> <service-assembly>
>> >> >> >> <identification>
>> >> >> >> <name>test-integration-servicemix-jbi</name>
>> >> >> >> <description></description>
>> >> >> >> </identification>
>> >> >> >> <service-unit>
>> >> >> >> <identification>
>> >> >> >> <name>test-integration-servicemix</name>
>> >> >> >> </identification>
>> >> >> >> <target>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> <artifacts-zip>test-integration-servicemix-1.0-SNAPSHOT.zip</artifacts-zip>
>> >> >> >> <component-name>servicemix-lwcontainer</component-name>
>> >> >> >> </target>
>> >> >> >> </service-unit>
>> >> >> >> </service-assembly>
>> >> >> >> </jbi>
>> >> >> >> #######################
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> gnodet wrote:
>> >> >> >> >
>> >> >> >> > Maybe your servicemix.xml config file is bad.
>> >> >> >> > Could you post the complete one ?
>> >> >> >> >
>> >> >> >> > On 11/15/06, moraleslos <[EMAIL PROTECTED]> wrote:
>> >> >> >> >>
>> >> >> >> >> Thanks Guillaume.
>> >> >> >> >>
>> >> >> >> >> I launched JConsole, went to
>> >> >> >> >> org.apache.servicemix-->ServiceMix-->Component
>> >> >> >> >> as well as Endpoint, and my xmlUnmarshaller component is
>> nowhere
>> >> to
>> >> >> be
>> >> >> >> >> found. Now, knowing why the component can't be found, how do
>> I
>> >> >> have
>> >> >> >> smx
>> >> >> >> >> register my xmlUnmarshaller? Thanks.
>> >> >> >> >>
>> >> >> >> >> -los
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> gnodet wrote:
>> >> >> >> >> >
>> >> >> >> >> > I don't see why it does not work.
>> >> >> >> >> > Check what endpoints are activated using the log file at
>> DEBUG
>> >> >> level
>> >> >> >> >> > or a jmx console and ensure the needed endpoint is activate
>> >> and
>> >> >> >> match
>> >> >> >> >> > the defined route.
>> >> >> >> >> >
>> >> >> >> >> > On 11/14/06, moraleslos <[EMAIL PROTECTED]> wrote:
>> >> >> >> >> >>
>> >> >> >> >> >> I currently have my SU defined to do some XSLT. This is
>> my
>> >> >> >> >> >> servicemix.xml:
>> >> >> >> >> >>
>> >> >> >> >> >> #################
>> >> >> >> >> >> <sm:activationSpec
>> >> >> >> >> >> componentName="xmlTransformer"
>> >> >> >> >> >> service="foo:xmlTransformer"
>> >> >> >> >> >> destinationService="foo:xmlUnmarshaller">
>> >> >> >> >> >> <sm:component>
>> >> >> >> >> >> <bean
>> >> >> >> >> >>
>> class="org.apache.servicemix.components.xslt.XsltComponent">
>> >> >> >> >> >> <property
>> >> >> >> >> >> name="xsltResource"
>> >> >> >> >> >>
>> >> >> value="classpath:com/test/integration/servicemix/xmlTemplate.xsl"/>
>> >> >> >> >> >> </bean>
>> >> >> >> >> >> </sm:component>
>> >> >> >> >> >> </sm:activationSpec>
>> >> >> >> >> >> ###############################
>> >> >> >> >> >>
>> >> >> >> >> >> Now, I want the output from the transformation sent to a
>> >> Jaxb2
>> >> >> >> >> >> unmarshaller.
>> >> >> >> >> >> Looking at the examples, I created an xbean definition
>> like
>> >> >> this:
>> >> >> >> >> >>
>> >> >> >> >> >> ##############################
>> >> >> >> >> >> <beans
>> >> >> >> >> >>
>> >> xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
>> >> >> >> >> >>
>> xmlns:foo="http://com.test.integration.servicemix">
>> >> >> >> >> >>
>> >> >> >> >> >> <classpath>
>> >> >> >> >> >> <location>.</location>
>> >> >> >> >> >> </classpath>
>> >> >> >> >> >>
>> >> >> >> >> >> <jsr181:endpoint
>> >> >> >> >> >> service="foo:xmlUnmarshaller"
>> >> >> >> >> >> endpoint="xmlUnmarshaller"
>> >> >> >> >> >>
>> >> >> >> pojoClass="com.test.integration.servicemix.pojo.Root"
>> >> >> >> >> >> typeMapping="jaxb2"/>
>> >> >> >> >> >>
>> >> >> >> >> >> </beans>
>> >> >> >> >> >> ###############################
>> >> >> >> >> >>
>> >> >> >> >> >> When deploying the SU that contains the xbean.xml and
>> >> >> >> servicemix.xml,
>> >> >> >> >> I
>> >> >> >> >> >> get
>> >> >> >> >> >> this error:
>> >> >> >> >> >>
>> >> >> >> >> >> WARN - DefaultBroker - ServiceName
>> >> >> >> >> >> ({http://com.test.integration.servicemix}xmlUnmarshaller)
>> >> >> specified
>> >> >> >> >> for
>> >> >> >> >> >> routing, but can't find it registered
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> So I'm not sure how to connect the output from the
>> >> >> transformation
>> >> >> >> into
>> >> >> >> >> >> the
>> >> >> >> >> >> jaxb2 unmarshaller. Thanks in advance.
>> >> >> >> >> >>
>> >> >> >> >> >> -los
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> gnodet wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> > If you want to send the output of the XSLT component to
>> >> your
>> >> >> >> >> >> > jsr181 pojo, you can just use the destinationService
>> >> attribute
>> >> >> >> >> >> > on the activationSpec for the xslt component and specify
>> >> >> >> >> >> > the jsr181 pojo service name.
>> >> >> >> >> >> > I guess I miss your problem ...
>> >> >> >> >> >> >
>> >> >> >> >> >> > On 10/27/06, moraleslos <[EMAIL PROTECTED]> wrote:
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> I've developed a test domain that has JAXB2-annotated
>> >> POJOs
>> >> >> and
>> >> >> >> the
>> >> >> >> >> >> >> generation of the schema from these pojos. Now in my
>> SU,
>> >> >> I've
>> >> >> >> >> >> retrieved
>> >> >> >> >> >> >> a
>> >> >> >> >> >> >> file and used the XSLT translator to transform the XML
>> >> into
>> >> >> >> >> something
>> >> >> >> >> >> >> that
>> >> >> >> >> >> >> can be unmarshalled into my domain POJOs. My question
>> is,
>> >> >> how
>> >> >> >> do I
>> >> >> >> >> >> >> connect
>> >> >> >> >> >> >> the output from the XSLT transformation to the jsr-181
>> >> >> endpoint
>> >> >> >> >> that
>> >> >> >> >> >> will
>> >> >> >> >> >> >> unmarshal this xml document into my jaxb2 pojos? I'm
>> used
>> >> to
>> >> >> >> >> seeing
>> >> >> >> >> >> the
>> >> >> >> >> >> >> "destination service":
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> <sm:activationSpec
>> >> >> >> >> >> >> componentName="XSLTTransformer"
>> >> >> >> >> >> >> service="foo:XSLTTransformer"
>> >> >> >> >> >> >> destinationService="foo:JAXB2Unmarshaller">
>> >> >> >> >> >> >> ....
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Now how do I define this destination using the jsr-181
>> >> >> endpoint?
>> >> >> >> I
>> >> >> >> >> >> know
>> >> >> >> >> >> >> this did not work:
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> <jsr181:endpoint endpoint="foo:JAXB2Unmarshaller"
>> >> >> >> >> >> >> typeMapping="jaxb2">
>> >> >> >> >> >> >> <jsr181:pojo>
>> >> >> >> >> >> >> <bean class="test.UnmarshalService" />
>> >> >> >> >> >> >> </jsr181:pojo>
>> >> >> >> >> >> >> </jsr181:endpoint>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> thanks in advance!
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> -los
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> --
>> >> >> >> >> >> >> View this message in context:
>> >> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299.html#a7038693
>> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> >> Nabble.com.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> > --
>> >> >> >> >> >> > Cheers,
>> >> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> View this message in context:
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>>
http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299s12049.html#a7347837
>> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> Nabble.com.
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > --
>> >> >> >> >> > Cheers,
>> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>>
http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299s12049.html#a7359654
>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> >>
>> >>
>>
http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299s12049.html#a7362326
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>>
http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299s12049.html#a7364880
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>>
http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299s12049.html#a7366651
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299s12049.html#a7366944
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Cheers,
> Guillaume Nodet
>
>
--
View this message in context:
http://www.nabble.com/connecting-to-jsr-181-jaxb2-tf2523299s12049.html#a7367566
Sent from the ServiceMix - User mailing list archive at Nabble.com.
--
Cheers,
Guillaume Nodet