You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Mark Swanson <ma...@ScheduleWorld.com> on 2005/07/05 21:32:43 UTC

Axis2-0.9 XmlBeans parameter example?

Hello,

I downloaded Axis2-0.9 and read the docs. It's not clear to me how to 
create a doc/lit test(XmlBeanClass x) service.

Should I create a method test(OMElement o) and then use some sort of 
fromOM() method?
I notice that since I don't have WSDL that I won't have the generated 
echoStringDatabindingSupporter.java...

Any pointers would be appreciated.

Thank you.

-- 
Free replacement for Exchange and Outlook (Contacts and Calendar)
http://www.ScheduleWorld.com/
WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb

Re: [AXIS2] RE: Axis2-0.9 XmlBeans parameter example?

Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> Mark,
> 
> I see that you need a way to do this *NOW* in production. Did you look
> at the xmlbeans support in Axis 1.2?
> (http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/encoding/ser/xbeans/)
> 
> Check the dev email archives for more info. There is sample code in
> one of the JIRA issues.

SOLUTION: The sample doesn't compile if you have the old WebLogic 
xmlbeans ant tasks in your ant/lib dir. Once I moved to a fresh 
ant-1.6.5 install everything built and ran fine. Posting in the hopes it 
helps someone else.

Cheers.

------

Just a FYI - the sample code doesn't work with XmlBeans 1.0.3 or 
XmlBeans-2.0.

With XmlBeans 2.0 the error is:
(after fixing build.xml to use XMLBEANS_LIB instead of XMLBEANS_HOME)

/home/mswanson/downloads/java/xmlbeans/axis12XmlBeans/samples/build.xml:66: 
Following error occured while executing this line
/home/mswanson/downloads/java/xmlbeans/axis12XmlBeans/samples/template/SampleTemplate/build.xml:82: 
java.lang.NoSuchMethodError: 
javax.xml.namespace.QName.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V


With xmlBeans 1.0.3 the error is:

   [xmlbean] schemas/hello.xsd:0: error: Document 
/home/mswanson/downloads/java/xmlbeans/axis12XmlBeans/samples/template/SampleTemplate/schemas/hello.xsd 
is not a schema file
   [xmlbean] Time to build schema type system: 1.449 seconds
   [xmlbean] BUILD FAILED

BUILD FAILED
/home/mswanson/downloads/java/xmlbeans/axis12XmlBeans/samples/template/SampleTemplate/build.xml:82: 
null

It's strange, manually typing 'scomp 
template/SampleTemplate/schemas/hello.xsd' creates the xmltypes.jar just 
fine.

OK. I had the old WebLogic xmlbean ant tasks in my ant/lib dir and that 
was the problem. Using a fresh ant-1.6.5 install solved the problem.

Cheers.




-- 
Free replacement for Exchange and Outlook (Contacts and Calendar)
http://www.ScheduleWorld.com/
WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb

Re: [AXIS2] RE: Axis2-0.9 XmlBeans parameter example?

Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> Mark,
> 
> I see that you need a way to do this *NOW* in production. Did you look
> at the xmlbeans support in Axis 1.2?
> (http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/encoding/ser/xbeans/)
> 
> Check the dev email archives for more info. There is sample code in
> one of the JIRA issues.

Excellent. Thank you!
That will teach me to work from an RC branch (I was working with the 
older 1.2RC2 branch that didn't have them.)
I'm excited to try them out.

Cheers.

-- 
Free replacement for Exchange and Outlook (Contacts and Calendar)
http://www.ScheduleWorld.com/
WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb

Re: [AXIS2] RE: Axis2-0.9 XmlBeans parameter example?

Posted by Davanum Srinivas <da...@gmail.com>.
Mark,

I see that you need a way to do this *NOW* in production. Did you look
at the xmlbeans support in Axis 1.2?
(http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/encoding/ser/xbeans/)

Check the dev email archives for more info. There is sample code in
one of the JIRA issues.

-- dims

On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Hello Chathura,
> 
> Thanks for the response! However, I wasn't clear enough. Let me try again.
> 
> I am doing some work for a company that models all of their data in XSD.
> They use XmlBeans to create Java objects from their xml schema.
> 
> On the server (tomcat 5, axis2-0.9) we want to create a SOAP interface
> that marshalls the XmlBeans objects between the client/server.
> 
> With Axis 1.[1,2] there was no support for XmlBeans objects and you had
> to define your server SOAP interfaces like this:
> 
> // p is a XmlBean.toString().getBytes()
> public void test(byte[] p);
> 
> But this loses type-safety and the generated WSDL is completely missing
> the XSD used to generate the xmlBeans in the first place. We can deal
> with this internally (because we have the XSD) but this is a show
> stopper for making interfaces public because the public interfaces must
> contain the XSD (within the WSDL) or the client won't know how to talk
> to the server properly or validate its own request.
> 
> We want to be able to define server interfaces using Axis2 that accept
> xmlBeans as parameters like this:
> 
> // request is an XmlBean
> public void test(RequestDocument request);
> 
> Axis2 would then generate the WSDL to correctly contain the XSD.
> 
> Since Axis2 is using XmlBeans I was hoping the XmlBean [de]serializers
> were already present and this would just work.
> 
> IMHO doc/lit SOAP with POJOs modelled from XSD is the best way to
> develop web services. I think the XmlBeans XSD->POJO mapping is the best
> available, modelling data in XSD is very natural, and XSD validation is
> a boon.
> 
> I've been confused as to why the Axis developers haven't enabled
> XmlBeans support. The BEA folks provide exactly this and I thought they
> just made some enhancements to Axis? I feel like I'm misunderstanding
> something fundamental wrt xmlBeans support and would love to know what
> it is.
> 
> Thanks in andvance for any help or enlightening comments.
> 
> Cheers.
> 
> --
> Free replacement for Exchange and Outlook (Contacts and Calendar)
> http://www.ScheduleWorld.com/
> WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
> WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
> VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb
> 


-- 
Davanum Srinivas -http://blogs.cocoondev.org/dims/

Re: [AXIS2] RE: Axis2-0.9 XmlBeans parameter example?

Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Hello Chathura,

Thanks for the response! However, I wasn't clear enough. Let me try again.

I am doing some work for a company that models all of their data in XSD. 
They use XmlBeans to create Java objects from their xml schema.

On the server (tomcat 5, axis2-0.9) we want to create a SOAP interface 
that marshalls the XmlBeans objects between the client/server.

With Axis 1.[1,2] there was no support for XmlBeans objects and you had 
to define your server SOAP interfaces like this:

// p is a XmlBean.toString().getBytes()
public void test(byte[] p);

But this loses type-safety and the generated WSDL is completely missing 
the XSD used to generate the xmlBeans in the first place. We can deal 
with this internally (because we have the XSD) but this is a show 
stopper for making interfaces public because the public interfaces must 
contain the XSD (within the WSDL) or the client won't know how to talk 
to the server properly or validate its own request.

We want to be able to define server interfaces using Axis2 that accept 
xmlBeans as parameters like this:

// request is an XmlBean
public void test(RequestDocument request);

Axis2 would then generate the WSDL to correctly contain the XSD.

Since Axis2 is using XmlBeans I was hoping the XmlBean [de]serializers 
were already present and this would just work.

IMHO doc/lit SOAP with POJOs modelled from XSD is the best way to 
develop web services. I think the XmlBeans XSD->POJO mapping is the best 
available, modelling data in XSD is very natural, and XSD validation is 
a boon.

I've been confused as to why the Axis developers haven't enabled 
XmlBeans support. The BEA folks provide exactly this and I thought they 
just made some enhancements to Axis? I feel like I'm misunderstanding 
something fundamental wrt xmlBeans support and would love to know what 
it is.

Thanks in andvance for any help or enlightening comments.

Cheers.

-- 
Free replacement for Exchange and Outlook (Contacts and Calendar)
http://www.ScheduleWorld.com/
WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb

[AXIS2] RE: Axis2-0.9 XmlBeans parameter example?

Posted by Chathura Herath <ch...@opensource.lk>.
Hi Mark,

I didn't quite understand the question, what I think you are asking is how
to get create the response data bound xml-beans object??

Consider the skelton's operation is:
public
org.soapinterop.types.requestresponse.EchoBaseStructFaultResponseDocument
echoBaseStructFault(org.soapinterop.types.requestresponse.EchoBaseStructFaul
tRequestDocument param0)

If the generated skeleton has a method like the one shown above and think
your problem is  creating
org.soapinterop.types.requestresponse.EchoBaseStructFaultResponseDocument
object??
If it is there are two ways of creating the return object.

1) If you have an OMElement with you already you can use the supporter
class's (if the operation name is foo, it will be fooDatabindingSupportor)
fromOM method to get the return object.

2) Or you can progamatically create the object

org.soapinterop.types.requestresponse.EchoBaseStructFaultResponseDocument
emptyObject=
org.soapinterop.types.requestresponse.EchoBaseStructFaultResponseDocument.Fa
ctory.newInstance();

and setting the values progamatically.

If this isn't your question or the answer is not descriptive enough pls
write back..

Regards
Chathura

> -----Original Message-----
> From: Mark Swanson [mailto:mark@ScheduleWorld.com]
> Sent: Wednesday, July 06, 2005 1:33 AM
> To: axis-dev@ws.apache.org
> Subject: Axis2-0.9 XmlBeans parameter example?
> 
> Hello,
> 
> I downloaded Axis2-0.9 and read the docs. It's not clear to me how to
> create a doc/lit test(XmlBeanClass x) service.
> 
> Should I create a method test(OMElement o) and then use some sort of
> fromOM() method?
> I notice that since I don't have WSDL that I won't have the generated
> echoStringDatabindingSupporter.java...
> 
> Any pointers would be appreciated.
> 
> Thank you.
> 
> --
> Free replacement for Exchange and Outlook (Contacts and Calendar)
> http://www.ScheduleWorld.com/
> WAP: http://www.ScheduleWorld.com/sw/WAPToday?id=4000&tz=EST
> WebDAV: http://www.ScheduleWorld.com/sw/webDAVDir/4000.ics
> VFREEBUSY: http://www.ScheduleWorld.com/sw/freebusy/4000.ifb