You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jonathan Colwell <jc...@bea.com> on 2005/01/09 05:46:42 UTC
XMLBeanDe/Serializer sample
Sorry for the delay Hung, I didn't get a chance to work on this until
late Friday.
I put together a sample Web Service using the XmlBeanSerializers
available from: http://superflaco.com/Beehive/xBeanSample.war
you should be able to just drop it into a servlet container and use the
included build.xml to try out your own XBean services.
Let me know if you have additional questions or if you run into
problems.
cheers,
Jonathan
-----Original Message-----
From: Hung Vu2000 [mailto:hungvu2000@hotmail.com]
Sent: Thursday, January 06, 2005 7:13 PM
To: axis-user@ws.apache.org
Subject: RE: XMLBean data
Jonathan,
Thanks for your help. I need time to read and use your source code.
It'
s great if you have a sample how to to use your patch.
Best regards,
Hung
>From: "Jonathan Colwell" <jc...@bea.com>
>Reply-To: axis-user@ws.apache.org
>To: <ax...@ws.apache.org>
>Subject: RE: XMLBean data
>Date: Thu, 6 Jan 2005 07:48:09 -0800
>
>I wrote some AXIS de/serializers for XmlBeans that I've been using
>successfully in the Beehive project.
>
>http://svn.apache.org/repos/asf/incubator/beehive/trunk/wsm/src/runtime
>/ org/apache/beehive/wsm/axis/util/encoding/
>
>Feel free to check them out to see if they suit your needs. One thing
>to keep in mind is that XmlBeans do not have a default constructor,
>instead they use an internal Factory to create instances. If you are
>trying to register XmlBeans using the regular BeanSerializers you are
>out of luck but these serializers should help.
>
>cheers,
>
>Jonathan
>
>-----Original Message-----
>From: Bouche Paul [mailto:Paul.Bouche@student.hpi.uni-potsdam.de]
>Sent: Thursday, January 06, 2005 5:39 AM
>To: axis-user@ws.apache.org
>Subject: RE: XMLBean data
>
>First of you cannot automatically serialized any arbritrary java object
>with Axis (it wouldn't know how). For Axis to automatically
>serialize/deserialize your objects they need to be Java Bean compatible
>(if you don't know what that is google for java beans). One of the
>requirements for a java bean is that the class has to have a default
>constructor. Your type net.data.xml.MyDocument obviously does not have
>a default constructor or it is not public. So all you need to do, if
>you want Axis to automatically de/serialize your class, is to add
>default constructor ie.
>public MyDocument() {};
>
>Or you have to write a schema for MyDocument, a serializer, a
>deserializer for axis and import the schema into the wsdl.
>
>Hope this helps,
>Paul
>
>P.S.: I cannot resist to say that all this is also mentioned in the
>documentation if one would read it ;-).
>
> > -----Original Message-----
> > From: Hung Vu2000 [mailto:hungvu2000@hotmail.com]
> > Sent: Donnerstag, 6. Januar 2005 07:22
> > To: axis-user@ws.apache.org
> > Subject: XMLBean data
> >
> >
> > Hi,
> > I' m developing a webservice that need a parameter of type
> > XMLBean.
> > When using Java2WSDL tool from Axis to create wsdl file I had the
> > following
> > WARN org.apache.axis.wsdl.fromJava.Types[main] - The class
> > net.data.xml.MyDocument does not contain a default constructor,
> > which is a requirement for a bean class. The class cannot be
> > converted into
>
> > an xml schema type. An xml schema anyType will be used to define
> > this
>
> > class in the wsdl file.
> > How can I resolve this problem ?
> >
> > Thanks,
> > Hung
> >
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today it's
> > FREE!
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> >
> >
> > .
> >
>
>.
>
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
Re: XMLBeanDe/Serializer sample
Posted by Jan Galinski <st...@janhoo.de>.
karim wrote:
> Hi,
> maybe try to compile your java sources using jdk1.4
Hi Karim,
thanks, but I'm already running 1.4.2. (1.4.1 on the linux machine).
Am I getting you wrong? Did you try to run it?
In addition, here's some debug info from the servlet:
Could not find class for the service named: com.superflaco.axis.StarWarsBare
Hint: you may need to copy your class files/tree into the right location
(which depends on the servlet system you are using).; nested exception is:
java.lang.ClassNotFoundException: com.superflaco.axis.StarWarsBare
The hint is nice, but the compiled class is in WEB-INF/classes/
other suggestions?
Jan
Re: XMLBeanDe/Serializer sample
Posted by karim <k....@clipack.com>.
Jan Galinski wrote:
> Jonathan Colwell wrote:
>
>> Sorry for the delay Hung, I didn't get a chance to work on this until
>> late Friday.
>>
>> I put together a sample Web Service using the XmlBeanSerializers
>> available from: http://superflaco.com/Beehive/xBeanSample.war
>>
>> you should be able to just drop it into a servlet container and use the
>> included build.xml to try out your own XBean services.
>>
>
> Hi Jonathan,
>
> thanks a lot, this could be a lifesaver, as the deadline for the
> thesis is closing and I need to do exactly this.
>
>> Let me know if you have additional questions or if you run into
>> problems.
>
>
> I tried to build, but receive the following:
>
> xbean:
> [mkdir] Created dir:
> /var/lib/tomcat5/webapps/xBeanSample/WEB-INF/classes
> [mkdir] Created dir:
> /var/lib/tomcat5/webapps/xBeanSample/WEB-INF/xbeangen
> [xmlbeanbuild] Time to build schema type system: 3.004 seconds
> [xmlbeanbuild] Time to generate code: 0.152 seconds
> [xmlbeanbuild] Compiling 5 source files to
> /var/lib/tomcat5/webapps/xBeanSample/WEB-INF/classes
> [xmlbeanbuild] Time to compile code: 3.216 seconds
>
> build:
> [javac] Compiling 2 source files to
> /var/lib/tomcat5/webapps/xBeanSample/WEB-INF/classes
> [javac]
> /var/lib/tomcat5/webapps/xBeanSample/src/com/superflaco/axis/StarWarsBare.java:28:
> cannot access
> org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory
> [javac] bad class file:
> /var/lib/tomcat5/webapps/xBeanSample/WEB-INF/lib/wsm-axis.jar(org/apache/beehive/wsm/axis/util/encoding/XmlBeanSerializerFactory.class)
>
> [javac] class file has wrong version 49.0, should be 48.0
> [javac] Please remove or make sure it appears in the correct
> subdirectory of the classpath.
> [javac] import
> org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory;
> [javac] ^
> [javac] 1 error
>
> BUILD FAILED
> /var/lib/tomcat5/webapps/xBeanSample/build.xml:77: Compile failed; see
> the compiler error output for details.
>
>
> Also tried to build in eclipse, compiles without problems, but refuses
> to run (exits with a java.lang.NoClassDefFoundError in
> StarWarsBare.tm.register ...)
>
> Any hints appreciated. Is it working somewhere else (despite Jonathans
> machine)? How did you do it?
>
> Thanx a lot
>
> Jan
>
>
>
Hi,
maybe try to compile your java sources using jdk1.4
Re: XMLBeanDe/Serializer sample
Posted by Jan Galinski <st...@janhoo.de>.
Jonathan Colwell wrote:
> Sorry for the delay Hung, I didn't get a chance to work on this until
> late Friday.
>
> I put together a sample Web Service using the XmlBeanSerializers
> available from: http://superflaco.com/Beehive/xBeanSample.war
>
> you should be able to just drop it into a servlet container and use the
> included build.xml to try out your own XBean services.
>
Hi Jonathan,
thanks a lot, this could be a lifesaver, as the deadline for the thesis
is closing and I need to do exactly this.
> Let me know if you have additional questions or if you run into
> problems.
I tried to build, but receive the following:
xbean:
[mkdir] Created dir:
/var/lib/tomcat5/webapps/xBeanSample/WEB-INF/classes
[mkdir] Created dir:
/var/lib/tomcat5/webapps/xBeanSample/WEB-INF/xbeangen
[xmlbeanbuild] Time to build schema type system: 3.004 seconds
[xmlbeanbuild] Time to generate code: 0.152 seconds
[xmlbeanbuild] Compiling 5 source files to
/var/lib/tomcat5/webapps/xBeanSample/WEB-INF/classes
[xmlbeanbuild] Time to compile code: 3.216 seconds
build:
[javac] Compiling 2 source files to
/var/lib/tomcat5/webapps/xBeanSample/WEB-INF/classes
[javac]
/var/lib/tomcat5/webapps/xBeanSample/src/com/superflaco/axis/StarWarsBare.java:28:
cannot access
org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory
[javac] bad class file:
/var/lib/tomcat5/webapps/xBeanSample/WEB-INF/lib/wsm-axis.jar(org/apache/beehive/wsm/axis/util/encoding/XmlBeanSerializerFactory.class)
[javac] class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct
subdirectory of the classpath.
[javac] import
org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory;
[javac] ^
[javac] 1 error
BUILD FAILED
/var/lib/tomcat5/webapps/xBeanSample/build.xml:77: Compile failed; see
the compiler error output for details.
Also tried to build in eclipse, compiles without problems, but refuses
to run (exits with a java.lang.NoClassDefFoundError in
StarWarsBare.tm.register ...)
Any hints appreciated. Is it working somewhere else (despite Jonathans
machine)? How did you do it?
Thanx a lot
Jan
RE: XMLBeanDe/Serializer sample
Posted by Hung Vu2000 <hu...@hotmail.com>.
Hi Jonathan,
I had bugs in my own project to resolved (not relating to XMLBeans) so
I still don't use your sample code. Hope I may use it soon.
Thank you very much,
Hung
>From: "Jonathan Colwell" <jc...@bea.com>
>Reply-To: axis-user@ws.apache.org
>To: <ax...@ws.apache.org>
>CC: <be...@superflaco.com>
>Subject: XMLBeanDe/Serializer sample
>Date: Sat, 8 Jan 2005 20:46:42 -0800
>
>Sorry for the delay Hung, I didn't get a chance to work on this until
>late Friday.
>
>I put together a sample Web Service using the XmlBeanSerializers
>available from: http://superflaco.com/Beehive/xBeanSample.war
>
>you should be able to just drop it into a servlet container and use the
>included build.xml to try out your own XBean services.
>
>Let me know if you have additional questions or if you run into
>problems.
>
>cheers,
>
>Jonathan
>
>-----Original Message-----
>From: Hung Vu2000 [mailto:hungvu2000@hotmail.com]
>Sent: Thursday, January 06, 2005 7:13 PM
>To: axis-user@ws.apache.org
>Subject: RE: XMLBean data
>
>Jonathan,
> Thanks for your help. I need time to read and use your source code.
>It'
>s great if you have a sample how to to use your patch.
>
>Best regards,
>Hung
>
> >From: "Jonathan Colwell" <jc...@bea.com>
> >Reply-To: axis-user@ws.apache.org
> >To: <ax...@ws.apache.org>
> >Subject: RE: XMLBean data
> >Date: Thu, 6 Jan 2005 07:48:09 -0800
> >
> >I wrote some AXIS de/serializers for XmlBeans that I've been using
> >successfully in the Beehive project.
> >
> >http://svn.apache.org/repos/asf/incubator/beehive/trunk/wsm/src/runtime
> >/ org/apache/beehive/wsm/axis/util/encoding/
> >
> >Feel free to check them out to see if they suit your needs. One thing
> >to keep in mind is that XmlBeans do not have a default constructor,
> >instead they use an internal Factory to create instances. If you are
> >trying to register XmlBeans using the regular BeanSerializers you are
> >out of luck but these serializers should help.
> >
> >cheers,
> >
> >Jonathan
> >
> >-----Original Message-----
> >From: Bouche Paul [mailto:Paul.Bouche@student.hpi.uni-potsdam.de]
> >Sent: Thursday, January 06, 2005 5:39 AM
> >To: axis-user@ws.apache.org
> >Subject: RE: XMLBean data
> >
> >First of you cannot automatically serialized any arbritrary java object
>
> >with Axis (it wouldn't know how). For Axis to automatically
> >serialize/deserialize your objects they need to be Java Bean compatible
>
> >(if you don't know what that is google for java beans). One of the
> >requirements for a java bean is that the class has to have a default
> >constructor. Your type net.data.xml.MyDocument obviously does not have
> >a default constructor or it is not public. So all you need to do, if
> >you want Axis to automatically de/serialize your class, is to add
> >default constructor ie.
> >public MyDocument() {};
> >
> >Or you have to write a schema for MyDocument, a serializer, a
> >deserializer for axis and import the schema into the wsdl.
> >
> >Hope this helps,
> >Paul
> >
> >P.S.: I cannot resist to say that all this is also mentioned in the
> >documentation if one would read it ;-).
> >
> > > -----Original Message-----
> > > From: Hung Vu2000 [mailto:hungvu2000@hotmail.com]
> > > Sent: Donnerstag, 6. Januar 2005 07:22
> > > To: axis-user@ws.apache.org
> > > Subject: XMLBean data
> > >
> > >
> > > Hi,
> > > I' m developing a webservice that need a parameter of type
> > > XMLBean.
> > > When using Java2WSDL tool from Axis to create wsdl file I had the
> > > following
> > > WARN org.apache.axis.wsdl.fromJava.Types[main] - The class
> > > net.data.xml.MyDocument does not contain a default constructor,
> > > which is a requirement for a bean class. The class cannot be
> > > converted into
> >
> > > an xml schema type. An xml schema anyType will be used to define
> > > this
> >
> > > class in the wsdl file.
> > > How can I resolve this problem ?
> > >
> > > Thanks,
> > > Hung
> > >
> > > _________________________________________________________________
> > > Express yourself instantly with MSN Messenger! Download today it's
> > > FREE!
> > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > >
> > >
> > > .
> > >
> >
> >.
> >
>
>_________________________________________________________________
>FREE pop-up blocking with the new MSN Toolbar - get it now!
>http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>
>
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/