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/06 18:30:37 UTC
bug: Axis 1.2 and 1.2.1 is missing xbeans package
So I grep'd everything in 1.2 and 1.2.1. The xbeans package is mentioned
in the docs but is completely missing from the bin download.
--
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: Axis 1.3 beta and XmlBeans config
Posted by Davanum Srinivas <da...@gmail.com>.
Mark,
the code is based on the code in beehive. can u please check if they
have any updates that will help us?
http://svn.apache.org/repos/asf/incubator/beehive/trunk/wsm/src/axis/org/apache/beehive/wsm/axis/util/encoding/
thanks,
dims
On 7/21/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> There were two problems:
>
> XmlBeans.typeForClass(javaType) creates a SchemaType with a QName of
> null for Anonymous types. This is fine. However, the QName is required
> to get the XmlObject. So I just parsed the anonymous type to get its
> QName and that works fine.
>
> Because the QName may be null one of the lines in getAllDependentTypes()
> always failed in this case because it wasn't checking for null. Fixed.
>
> I uploaded the new XmlBeanSerializer.java to the relevant JIRA location:
>
> http://issues.apache.org/jira/browse/AXIS-1764
>
> Note: I only handled one Anonymous type. The other types must also be
> handled of the error 'Unhandled anonymous type' will be printed to stdout.
>
> If I can work around the _major_ problem of having to manually specify
> the XmlBeanSerializer per class I'll come back to fix the other
> anonymous type handling.
>
> 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: Axis 1.3 beta and XmlBeans config
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
There were two problems:
XmlBeans.typeForClass(javaType) creates a SchemaType with a QName of
null for Anonymous types. This is fine. However, the QName is required
to get the XmlObject. So I just parsed the anonymous type to get its
QName and that works fine.
Because the QName may be null one of the lines in getAllDependentTypes()
always failed in this case because it wasn't checking for null. Fixed.
I uploaded the new XmlBeanSerializer.java to the relevant JIRA location:
http://issues.apache.org/jira/browse/AXIS-1764
Note: I only handled one Anonymous type. The other types must also be
handled of the error 'Unhandled anonymous type' will be printed to stdout.
If I can work around the _major_ problem of having to manually specify
the XmlBeanSerializer per class I'll come back to fix the other
anonymous type handling.
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: Axis 1.3 beta and XmlBeans config
Posted by Davanum Srinivas <da...@gmail.com>.
great! looking forward to it.
-- dims
On 7/20/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> I have solved it.
> I think there may be a bug in XmlBeans 2.0.0 because one of the things I
> had to do was work around missing QNames. Will post tomorrow.
>
> 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: Axis 1.3 beta and XmlBeans config
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
I have solved it.
I think there may be a bug in XmlBeans 2.0.0 because one of the things I
had to do was work around missing QNames. Will post tomorrow.
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: Axis 1.3 beta and XmlBeans config
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> Can you please open a JIRA bug and zip up your war and upload it?
Before I do that I'd like to just clarify something. My testing shows
that XmlBeanSerializer.writeSchema() is being passed simple types. This
seems wrong. All that has to be done to trigger this from the starwars
demo is to make the xbeans sample starwars.xsd character complex type
contain some simple element with a restriction like this:
<complexType name="character">
<xs:sequence>
<xs:element ref="month"/>
</xs:sequence>
...
<xs:element name="month">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:totalDigits value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
...
It seems that XmlBeansSerializer is forgetting about referernces inside
of complex types.
SchemaType docType = XmlBeans.typeForClass(javaType);
if (docType.getName() == null) {
if (docType.isSimpleType()) {
if (docType.getSimpleVariety() == SchemaType.ATOMIC) {
SchemaType s2 = docType.getPrimitiveType();
QName q2 = s2.getName();
System.out.println("simple atomic qname:" +
q2.toString());
return null;
}
}
}
This little patch allows the WSDL to generate and it prints out the
primitive types that are ignored (XmlDecimal in case you're interested)
I suspect they are unhandled data left over because the Atomic types
weren't handled (only complex, element, simple seem to be handled) and
the month restriction causes atomic types to be used.
Anyone have any thoughts about how to nudge me forward?
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: Axis 1.3 beta and XmlBeans config
Posted by Davanum Srinivas <da...@gmail.com>.
Can you please open a JIRA bug and zip up your war and upload it?
thanks,
dims
On 7/20/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Davanum Srinivas wrote:
> > plz try the example in the jira that i pointed to earlier first.
>
> It builds and deploys fine, but when I try to view the WSDL I get:
>
>
> java.lang.NullPointerException
> at
> org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer.getTypeNode(XmlBeanSerializer.java:276)
> at
> org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer.writeSchemaForDocType(XmlBeanSerializer.java:134)
> at
> org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer.writeSchema(XmlBeanSerializer.java:120)
> at
> org.apache.axis.wsdl.fromJava.Types.makeTypeElement(Types.java:1849)
> at
> org.apache.axis.wsdl.fromJava.Types.writeTypeForPart(Types.java:421)
> at
> org.apache.axis.wsdl.fromJava.Types.writeWrappedParameter(Types.java:612)
> at
> org.apache.axis.wsdl.fromJava.Emitter.writeWrapperPart(Emitter.java:1680)
> at
> org.apache.axis.wsdl.fromJava.Emitter.writeRequestMessage(Emitter.java:1467)
> at
> org.apache.axis.wsdl.fromJava.Emitter.writeMessages(Emitter.java:1106)
> at
> org.apache.axis.wsdl.fromJava.Emitter.writePortType(Emitter.java:1075)
> at org.apache.axis.wsdl.fromJava.Emitter.getWSDL(Emitter.java:484)
> at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:331)
> at
> org.apache.axis.providers.BasicProvider.generateWSDL(BasicProvider.java:242)
> at
> org.apache.axis.strategies.WSDLGenStrategy.visit(WSDLGenStrategy.java:33)
> at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> at org.apache.axis.SimpleChain.generateWSDL(SimpleChain.java:104)
> at
> org.apache.axis.handlers.soap.SOAPService.generateWSDL(SOAPService.java:319)
> at
> org.apache.axis.server.AxisServer.generateWSDL(AxisServer.java:482)
> at
> org.apache.axis.transport.http.QSWSDLHandler.invoke(QSWSDLHandler.java:68)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at
> org.apache.axis.transport.http.AxisServlet.processQuery(AxisServlet.java:1217)
> at
> org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:249)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>
>
> --
> 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: Axis 1.3 beta and XmlBeans config
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Anne Thomas Manes wrote:
> If you want to do doc/literal, you definitely don't want to specify
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
Yeah :_)
Thanks for the response.
--
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: Axis 1.3 beta and XmlBeans config
Posted by Anne Thomas Manes <at...@gmail.com>.
If you want to do doc/literal, you definitely don't want to specify
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
Anne
On 7/19/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Davanum Srinivas wrote:
> > HEAD version. use JDK1.4 to compile or drop xerces jars in your
> > endorsed directory. saaj 1.2 does not support dom3.
>
> Now we're gettin' somewhere. However, Axis is mapping my XmlBeans to
> anyType. I tried to define serializers like this but it didn't work:
>
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>
> <service name="Math" style="document">
> <parameter name="className" value="Math"/>
> <parameter name="allowedMethods" value="*"/>
> <typeMapping qname="ns:CountryDocument" xmlns:ns="someNamespace"
>
> languageSpecificType="java:com.optimalpayments.webservices.xact.CountryDocument"
>
> serializer="org.apache.axis.encoding.ser.xbeans.XmlBeanSerializerFactory"
>
> deserializer="org.apache.axis.encoding.ser.xbeans.XmlBeanDeserializerFactory"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
> </service>
>
> </deployment>
>
> - Please register a typemapping/beanmapping for
> 'com.optimalpayments.webservices.xact.CountryDocument'
> - The class com.optimalpayments.webservices.xact.CountryDocument 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.
>
> I'm trying to define a simple doc/literal service with a CountryDocument
> XmlBean. I copied and modified the above from the Axis 1.2
> documentation. Please help me get it right.
>
> Cheers.
>
> P.S. the Math class:
>
> public class Math {
>
> public void test(CountryDocument countryDocument) {
> System.out.println("CountryDocument:" +
> countryDocument.toString());
> }
>
>
> --
> 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: Axis 1.3 beta and XmlBeans config
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
It doesn't quite work.
I can get the simple <complex> star wars example to work. However, if
the complex type refers to a simple <element> it fails to generate the
WSDL. Example:
<xs:complexType name="CardExpiry">
<xs:sequence>
<xs:element ref="month"/>
...
<xs:element name="month">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:totalDigits value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
I map the CardExpiry and it runs through the
writeSchemaForDocType() just fine. However, Axis then tries to include
the xsd for the month element and fails.
I may be mapping month incorrectly, but I do it the same was as
'CardExpiry' so...
q = new QName(ns, "month");
tm.register(MonthDocument.Month.class, q,
new XmlBeanSerializerFactory(MonthDocument.Month.class, q),
new XmlBeanDeserializerFactory(MonthDocument.Month.class, q));
Am I registering "month" incorrectly?
writeSchemaForDocType.docType.getName() returns a qname of null with a
docType.getShortJavaName() == "Month".
Another thing that may be incredibly difficult to deal with: How does
Axis expect folks with large schemas to register the XmlBeanSerializers?
If the solution is the hand-craft serializer definitions for each and
every schema element and also maintain that by hand it's never going to
be feasible and I'm going to have to look at writing something to
automate that.
Let me know.
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: Axis 1.3 beta and XmlBeans config
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> plz try the example in the jira that i pointed to earlier first.
It builds and deploys fine, but when I try to view the WSDL I get:
java.lang.NullPointerException
at
org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer.getTypeNode(XmlBeanSerializer.java:276)
at
org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer.writeSchemaForDocType(XmlBeanSerializer.java:134)
at
org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer.writeSchema(XmlBeanSerializer.java:120)
at
org.apache.axis.wsdl.fromJava.Types.makeTypeElement(Types.java:1849)
at
org.apache.axis.wsdl.fromJava.Types.writeTypeForPart(Types.java:421)
at
org.apache.axis.wsdl.fromJava.Types.writeWrappedParameter(Types.java:612)
at
org.apache.axis.wsdl.fromJava.Emitter.writeWrapperPart(Emitter.java:1680)
at
org.apache.axis.wsdl.fromJava.Emitter.writeRequestMessage(Emitter.java:1467)
at
org.apache.axis.wsdl.fromJava.Emitter.writeMessages(Emitter.java:1106)
at
org.apache.axis.wsdl.fromJava.Emitter.writePortType(Emitter.java:1075)
at org.apache.axis.wsdl.fromJava.Emitter.getWSDL(Emitter.java:484)
at org.apache.axis.wsdl.fromJava.Emitter.emit(Emitter.java:331)
at
org.apache.axis.providers.BasicProvider.generateWSDL(BasicProvider.java:242)
at
org.apache.axis.strategies.WSDLGenStrategy.visit(WSDLGenStrategy.java:33)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.generateWSDL(SimpleChain.java:104)
at
org.apache.axis.handlers.soap.SOAPService.generateWSDL(SOAPService.java:319)
at
org.apache.axis.server.AxisServer.generateWSDL(AxisServer.java:482)
at
org.apache.axis.transport.http.QSWSDLHandler.invoke(QSWSDLHandler.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.axis.transport.http.AxisServlet.processQuery(AxisServlet.java:1217)
at
org.apache.axis.transport.http.AxisServlet.doGet(AxisServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
--
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: Axis 1.3 beta and XmlBeans config
Posted by Davanum Srinivas <da...@gmail.com>.
plz try the example in the jira that i pointed to earlier first.
thanks,
dims
On 7/19/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Davanum Srinivas wrote:
> > HEAD version. use JDK1.4 to compile or drop xerces jars in your
> > endorsed directory. saaj 1.2 does not support dom3.
>
> Now we're gettin' somewhere. However, Axis is mapping my XmlBeans to
> anyType. I tried to define serializers like this but it didn't work:
>
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>
> <service name="Math" style="document">
> <parameter name="className" value="Math"/>
> <parameter name="allowedMethods" value="*"/>
> <typeMapping qname="ns:CountryDocument" xmlns:ns="someNamespace"
>
> languageSpecificType="java:com.optimalpayments.webservices.xact.CountryDocument"
>
> serializer="org.apache.axis.encoding.ser.xbeans.XmlBeanSerializerFactory"
>
> deserializer="org.apache.axis.encoding.ser.xbeans.XmlBeanDeserializerFactory"
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
> </service>
>
> </deployment>
>
> - Please register a typemapping/beanmapping for
> 'com.optimalpayments.webservices.xact.CountryDocument'
> - The class com.optimalpayments.webservices.xact.CountryDocument 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.
>
> I'm trying to define a simple doc/literal service with a CountryDocument
> XmlBean. I copied and modified the above from the Axis 1.2
> documentation. Please help me get it right.
>
> Cheers.
>
> P.S. the Math class:
>
> public class Math {
>
> public void test(CountryDocument countryDocument) {
> System.out.println("CountryDocument:" +
> countryDocument.toString());
> }
>
>
> --
> 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/
Axis 1.3 beta and XmlBeans config
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> HEAD version. use JDK1.4 to compile or drop xerces jars in your
> endorsed directory. saaj 1.2 does not support dom3.
Now we're gettin' somewhere. However, Axis is mapping my XmlBeans to
anyType. I tried to define serializers like this but it didn't work:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Math" style="document">
<parameter name="className" value="Math"/>
<parameter name="allowedMethods" value="*"/>
<typeMapping qname="ns:CountryDocument" xmlns:ns="someNamespace"
languageSpecificType="java:com.optimalpayments.webservices.xact.CountryDocument"
serializer="org.apache.axis.encoding.ser.xbeans.XmlBeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.xbeans.XmlBeanDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</service>
</deployment>
- Please register a typemapping/beanmapping for
'com.optimalpayments.webservices.xact.CountryDocument'
- The class com.optimalpayments.webservices.xact.CountryDocument 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.
I'm trying to define a simple doc/literal service with a CountryDocument
XmlBean. I copied and modified the above from the Axis 1.2
documentation. Please help me get it right.
Cheers.
P.S. the Math class:
public class Math {
public void test(CountryDocument countryDocument) {
System.out.println("CountryDocument:" +
countryDocument.toString());
}
--
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Davanum Srinivas <da...@gmail.com>.
HEAD version. use JDK1.4 to compile or drop xerces jars in your
endorsed directory. saaj 1.2 does not support dom3.
-- dims
On 7/19/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Mark Swanson wrote:
> >>>>
> >>>> I've got the changes into CVS and got everything building with JDK1.4.
> >>>> Please pull the latest code. You will need wsm-schema.jar from here
> >
> >
> > It does not build. I just grabbed the latest CVS and receive this:
> > (using ant 1.6.5, java 1.5.04)
>
> Btw, which branch should I be using? Axis1_2 ? You just mentioned CVS..
>
>
> --
> 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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Mark Swanson wrote:
>>>>
>>>> I've got the changes into CVS and got everything building with JDK1.4.
>>>> Please pull the latest code. You will need wsm-schema.jar from here
>
>
> It does not build. I just grabbed the latest CVS and receive this:
> (using ant 1.6.5, java 1.5.04)
Btw, which branch should I be using? Axis1_2 ? You just mentioned CVS..
--
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
>>>
>>>I've got the changes into CVS and got everything building with JDK1.4.
>>>Please pull the latest code. You will need wsm-schema.jar from here
It does not build. I just grabbed the latest CVS and receive this:
(using ant 1.6.5, java 1.5.04)
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/Text.java:30:
org.apache.axis.message.Text is not abstract and does not override
abstract method getUserData(java.lang.String) in org.w3c.dom.Node
[javac] public class Text extends NodeImpl implements
javax.xml.soap.Text {
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/CDATAImpl.java:24:
org.apache.axis.message.CDATAImpl is not abstract and does not override
abstract method replaceWholeText(java.lang.String) in org.w3c.dom.Text
[javac] public class CDATAImpl extends org.apache.axis.message.Text
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/CommentImpl.java:31:
org.apache.axis.message.CommentImpl is not abstract and does not
override abstract method getUserData(java.lang.String) in org.w3c.dom.Node
[javac] public class CommentImpl
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/SOAPFaultElement.java:26:
org.apache.axis.message.SOAPFaultElement is not abstract and does not
override abstract method getUserData(java.lang.String) in org.w3c.dom.Node
[javac] public class SOAPFaultElement extends MessageElement
implements javax.xml.soap.SOAPFaultElement {
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/Detail.java:29:
org.apache.axis.message.Detail is not abstract and does not override
abstract method getUserData(java.lang.String) in org.w3c.dom.Node
[javac] public class Detail extends SOAPFaultElement implements
javax.xml.soap.Detail {
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/DetailEntry.java:24:
org.apache.axis.message.DetailEntry is not abstract and does not
override abstract method getUserData(java.lang.String) in org.w3c.dom.Node
[javac] public class DetailEntry extends MessageElement implements
javax.xml.soap.DetailEntry {
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/SOAPDocumentImpl.java:56:
org.apache.axis.message.SOAPDocumentImpl is not abstract and does not
override abstract method
renameNode(org.w3c.dom.Node,java.lang.String,java.lang.String) in
org.w3c.dom.Document
[javac] public class SOAPDocumentImpl
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/message/SOAPFault.java:46:
org.apache.axis.message.SOAPFault is not abstract and does not override
abstract method getUserData(java.lang.String) in org.w3c.dom.Node
[javac] public class SOAPFault extends SOAPBodyElement implements
javax.xml.soap.SOAPFault
[javac] ^
[javac]
/home/mswanson/src/ws-axis/java/src/org/apache/axis/utils/ClasspathUtils.java:190:
warning: [deprecation] decode(java.lang.String) in java.net.URLDecoder
has been deprecated
[javac] classpath.append(URLDecoder.decode(path));
[javac]
--
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Davanum Srinivas <da...@gmail.com>.
please try now.
On 7/19/05, Mark Swanson <ma...@scheduleworld.com> wrote:
>
> Hello,
>
> I'm able to spend some time on this again.
> I don't have permission to download the wsm-schema.jar.
>
> Thanks.
>
> Davanum Srinivas wrote:
> > Mark,
> >
> > I've got the changes into CVS and got everything building with JDK1.4.
> > Please pull the latest code. You will need wsm-schema.jar from here
> > (http://ws.zones.apache.org/~dims/libs/wsm-schema.jar) in addition to
> > all the jars from xmlbeans 2.0.0. wsm-schema.jar is basically xmlbeans
> > output of various xsd's needed (build xml is in beehive wsm project).
> >
> > Please try it and let me know. I will try to see if i can integrate
> > the sample into axis as well when i get a chance.
> >
> > thanks,
> > dims
> >
> > On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> >
> >>Davanum Srinivas wrote:
> >>
> >>>sorry!!! - http://issues.apache.org/jira/browse/AXIS-1812
> >>
> >>[mswanson@sfd111 xbeans]$ patch -p0 </tmp/axis.patch
> >>(Stripping trailing CRs from patch.)
> >>patching file XmlBeanSerializer.java
> >>Hunk #1 FAILED at 21.
> >>Hunk #2 FAILED at 50.
> >>Hunk #3 FAILED at 99.
> >>3 out of 3 hunks FAILED -- saving rejects to file XmlBeanSerializer.java.rej
> >>
> >>I patched it by hand, and then found enum is being incorrectly used in
> >>the Axis-1_2_1 sources:
> >>
> >>compile:
> >> [depend] Deleted 0 out of date files in 0 seconds
> >> [javac] Compiling 708 source files to
> >>/home/mswanson/downloads/java/axis-1_2_1/build/classes
> >> [javac]
> >>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Scope.java:17:
> >>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> >> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> >> [javac] package org.apache.axis.enum;
> >> [javac] ^
> >> [javac]
> >>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Style.java:17:
> >>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> >> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> >> [javac] package org.apache.axis.enum;
> >> [javac] ^
> >> [javac]
> >>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Use.java:17:
> >>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> >> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> >> [javac] package org.apache.axis.enum;
> >> [javac] ^
> >> [javac]
> >>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:70:
> >>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> >> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> >> [javac] Enumeration enum = request.getParameterNames();
> >> [javac] ^
> >> [javac]
> >>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:72:
> >>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> >> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> >> [javac] while (enum.hasMoreElements()) {
> >> [javac] ^
> >> [javac]
> >>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:73:
> >>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> >> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> >> [javac] String param = (String) enum.nextElement();
> >> [javac] ^
> >> [javac] 6 errors
> >>
> >>BUILD FAILED
> >>
> >>Arg. I can't even do a test with Java 6 to see if the patch works or
> >>not. I'm quite surprised to see this.
> >>I don't have enough time left today and will have to pick this up next
> >>Tuesday.
> >>
> >>I'm pasting my hand-patched file in case someone wants to grab this ball
> >>and roll with it before I get back.
> >>
> >>Cheers.
> >>
> >>/*
> >> * XmlBeanSerializer.java
> >> *
> >> * Copyright 2001-2004 The Apache Software Foundation.
> >> *
> >> *
> >> * Licensed under the Apache License, Version 2.0 (the "License");
> >> * you may not use this file except in compliance with the License.
> >> * You may obtain a copy of the License at
> >> *
> >> * http://www.apache.org/licenses/LICENSE-2.0
> >> *
> >> * Unless required by applicable law or agreed to in writing, software
> >> * distributed under the License is distributed on an "AS IS" BASIS,
> >> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> >> * See the License for the specific language governing permissions and
> >> * limitations under the License.
> >> *
> >> * Original author: Jonathan Colwell
> >> */
> >>
> >>package org.apache.axis.encoding.ser.xbeans;
> >>
> >>import org.apache.axis.AxisFault;
> >>import org.apache.axis.Constants;
> >>import org.apache.axis.encoding.SerializationContext;
> >>import org.apache.axis.encoding.Serializer;
> >>import org.apache.axis.wsdl.fromJava.Types;
> >>import org.apache.beehive.wsm.wsdl.Schema;
> >>import org.apache.beehive.wsm.wsdl.Utilities;
> >>import org.apache.xmlbeans.SchemaField;
> >>import org.apache.xmlbeans.SchemaType;
> >>import org.apache.xmlbeans.SchemaTypeLoader;
> >>import org.apache.xmlbeans.XmlBeans;
> >>import org.apache.xmlbeans.XmlCursor;
> >>import org.apache.xmlbeans.XmlObject;
> >>import org.apache.xmlbeans.XmlOptions;
> >>import org.w3.x2001.xmlSchema.LocalElement;
> >>import org.w3.x2001.xmlSchema.SchemaDocument;
> >>import org.w3.x2001.xmlSchema.TopLevelComplexType;
> >>import org.w3.x2001.xmlSchema.TopLevelElement;
> >>import org.w3c.dom.Document;
> >>import org.w3c.dom.Element;
> >>import org.w3c.dom.Node;
> >>import org.xml.sax.Attributes;
> >>import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
> >>import org.xmlsoap.schemas.wsdl.TDefinitions;
> >>import org.xmlsoap.schemas.wsdl.TTypes;
> >>
> >>import javax.xml.namespace.QName;
> >>import java.io.IOException;
> >>import java.io.InputStream;
> >>import java.lang.reflect.Array;
> >>import java.util.HashSet;
> >>import java.util.Set;
> >>
> >>/**
> >> * Class XmlBeanSerializer
> >> * @author Jonathan Colwell
> >> */
> >>public class XmlBeanSerializer implements Serializer {
> >>
> >> /**
> >> * Serialize an element named name, with the indicated attributes
> >> * and value.
> >> *
> >> * @param name is the element name
> >> * @param attributes are the attributes...serialize is free to add
> >>more.
> >> * @param value is the value
> >> * @param context is the SerializationContext
> >> */
> >> public void serialize(QName name, Attributes attributes,
> >> Object value, SerializationContext context)
> >> throws IOException {
> >> List<String> testL = new ArrayList<String>();
> >> if (!(value instanceof XmlObject)) {
> >> throw new IOException(((value != null) ?
> >> value.getClass().getName()
> >> : "null")
> >> + " is not an "
> >> + XmlObject.class.getName());
> >> } else {
> >> context.setWriteXMLType(null);
> >> context.startElement(name, attributes);
> >> XmlCursor xCur = ((XmlObject) value).newCursor();
> >> if (xCur.toFirstContentToken() == XmlCursor.TokenType.START) {
> >> do {
> >> Node n = xCur.getDomNode();
> >> if (n.getNodeType() == Node.ELEMENT_NODE) {
> >> context.writeDOMElement((Element) n);
> >> }
> >> } while (xCur.toNextSibling());
> >> }
> >> context.endElement();
> >> }
> >> }
> >>
> >> public String getMechanismType() {
> >> return Constants.AXIS_SAX;
> >> }
> >>
> >> /**
> >> * Return XML schema for the specified type, suitable for insertion
> >>into the
> >> * <types> element of a WSDL document, or underneath an
> >> * <element> or <attribute> declaration.
> >> *
> >> * @param javaType
> >> * the Java Class we're writing out schema for
> >> * @param types
> >> * the Java2WSDL Types object which holds the context
> >>for the
> >> * WSDL being generated.
> >> * @return a type element containing a schema simpleType/complexType
> >> * @see org.apache.axis.wsdl.fromJava.Types
> >> */
> >> public Element writeSchema(Class javaType, Types types) throws
> >>Exception {
> >> //if (XmlObject.class.isAssignableFrom(javaType)) {
> >> try {
> >> if (!XmlObject.class.isAssignableFrom(javaType)) {
> >> throw new RuntimeException(
> >> "Invalid Object type is assigned to the
> >>XMLBeanSerialization Type: "
> >> + javaType.getCanonicalName());
> >> }
> >> SchemaType docType = XmlBeans.typeForClass(javaType);
> >> writeSchemaForDocType(docType, types);
> >> // assume that the writeSchemaForDocType wrote the schema
> >> // for the type and all the dependent types.
> >> return null;
> >> } catch (Exception e) {
> >> e.printStackTrace();
> >> throw e;
> >> }
> >> }
> >>
> >> /**
> >> * @param types
> >> * @param docType
> >> * @return
> >> * @throws Exception
> >> */
> >> private void writeSchemaForDocType(SchemaType docType, Types types)
> >> throws Exception {
> >> Schema mySchema = Utilities.findtSchemaDocument(docType);
> >>
> >> QName q = docType.getName();
> >>
> >> XmlObject typeNodeInWSDL = mySchema.getTypeNode(q);
> >>
> >> if (null == typeNodeInWSDL)
> >> throw new RuntimeException(
> >> "Type for object not found in the assigned WSDL file. "
> >> + docType.getName() + " schema in: "
> >> + docType.getSourceName());
> >> // insertDependentTypes(typeNodeInWSDL, types);
> >> Node n = typeNodeInWSDL.getDomNode();
> >> Document doc = types.createElement(
> >>
> >>"element_to_get_document_useless_otherwise").getOwnerDocument();
> >> Element e = (Element) doc.importNode(n, true);
> >> try {
> >> types.writeSchemaElementDecl(q, e);
> >> } catch (AxisFault e1) {
> >> // this means the types was already in... fine!
> >> // TBD: make sure there are other types of exceptions are
> >>at least
> >> // reported
> >> }
> >> Set<QName> dependentTypes = new HashSet<QName>();
> >> getAllDependentTypes(typeNodeInWSDL, dependentTypes);
> >> for (QName nxtType : dependentTypes) {
> >> Class nxtJavaType = null;
> >> // add the class if it is an xml bean
> >> if (null != (nxtJavaType = q2UserClass(nxtType))
> >> && XmlObject.class.isAssignableFrom(nxtJavaType)) {
> >> writeSchema(nxtJavaType, types);
> >> }
> >> }
> >> return;
> >> }
> >>
> >>
> >> /**
> >> * @param nxtType
> >> * @return null for classes that are not found, or if they are
> >>primitive types
> >> * *
> >> */
> >> private Class q2UserClass(QName qname) {
> >> SchemaTypeLoader stl = XmlBeans.getContextTypeLoader();
> >> SchemaType st = stl.findType(qname);
> >> if (st == null) {
> >> SchemaField sf = stl.findElement(qname);
> >> if (sf != null)
> >> st = sf.getType();
> >> }
> >>
> >> if (st != null && !st.isBuiltinType())
> >> return st.getJavaClass();
> >> else
> >> return null; // for classes that are not found, or are build in
> >>
> >> }
> >>
> >> /**
> >> * @param nodeInWSDL
> >> * @param dependentTypes
> >> * @return
> >> *
> >> * Walk all the nodes under the nodeInWSDL if there is an 'element'
> >>type the
> >> * add its types or references to the dependent type.
> >> */
> >> private void getAllDependentTypes(XmlObject nodeInWSDL,
> >> Set<QName> dependentTypes) {
> >> // scan for any node under the type that has "type" or "ref"
> >>attribute
> >> XmlCursor cursor = nodeInWSDL.newCursor();
> >> if (cursor.toFirstChild()) { // has child
> >> while (true) {
> >> getAllDependentTypes(cursor.getObject(), dependentTypes);
> >> if (!cursor.toNextSibling())
> >> break;
> >> }
> >> }
> >> if (nodeInWSDL.schemaType().getName().getLocalPart().equals(
> >> "localElement")) {
> >> LocalElement e = (LocalElement) nodeInWSDL;
> >>
> >> if (e.isSetType())
> >> dependentTypes.add(e.getType());
> >> else if (e.isSetRef())
> >> dependentTypes.add(e.getRef());
> >> }
> >> return;
> >> }
> >>
> >> // NOTE jcolwell@bea.com 2004-Nov-15 --
> >> // once the WSDLProcessor is changed to an interface, remove this
> >>function
> >> // and use the one in the upcoming XmlBeanWSDLProcessor.
> >> private static <T extends XmlObject> T[] selectChildren(XmlObject
> >>parent,
> >> Class<T> childClass) throws IllegalAccessException,
> >> NoSuchFieldException {
> >> // retrieve the SchemaType from the static type field
> >> SchemaType st = (SchemaType) childClass.getField("type").get(null);
> >> XmlObject[] kids =
> >>parent.selectChildren(st.getDocumentElementName());
> >> T[] castKids = (T[]) Array.newInstance(childClass, kids.length);
> >> for (int j = 0; j < castKids.length; j++) {
> >> castKids[j] = childClass.cast(kids[j]);
> >> }
> >> return castKids;
> >> }
> >>}
> >>
> >>
> >>
> >>
> >>--
> >>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
> >>
> >
> >
> >
>
>
> --
> 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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Hello,
I'm able to spend some time on this again.
I don't have permission to download the wsm-schema.jar.
Thanks.
Davanum Srinivas wrote:
> Mark,
>
> I've got the changes into CVS and got everything building with JDK1.4.
> Please pull the latest code. You will need wsm-schema.jar from here
> (http://ws.zones.apache.org/~dims/libs/wsm-schema.jar) in addition to
> all the jars from xmlbeans 2.0.0. wsm-schema.jar is basically xmlbeans
> output of various xsd's needed (build xml is in beehive wsm project).
>
> Please try it and let me know. I will try to see if i can integrate
> the sample into axis as well when i get a chance.
>
> thanks,
> dims
>
> On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
>
>>Davanum Srinivas wrote:
>>
>>>sorry!!! - http://issues.apache.org/jira/browse/AXIS-1812
>>
>>[mswanson@sfd111 xbeans]$ patch -p0 </tmp/axis.patch
>>(Stripping trailing CRs from patch.)
>>patching file XmlBeanSerializer.java
>>Hunk #1 FAILED at 21.
>>Hunk #2 FAILED at 50.
>>Hunk #3 FAILED at 99.
>>3 out of 3 hunks FAILED -- saving rejects to file XmlBeanSerializer.java.rej
>>
>>I patched it by hand, and then found enum is being incorrectly used in
>>the Axis-1_2_1 sources:
>>
>>compile:
>> [depend] Deleted 0 out of date files in 0 seconds
>> [javac] Compiling 708 source files to
>>/home/mswanson/downloads/java/axis-1_2_1/build/classes
>> [javac]
>>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Scope.java:17:
>>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
>> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
>> [javac] package org.apache.axis.enum;
>> [javac] ^
>> [javac]
>>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Style.java:17:
>>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
>> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
>> [javac] package org.apache.axis.enum;
>> [javac] ^
>> [javac]
>>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Use.java:17:
>>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
>> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
>> [javac] package org.apache.axis.enum;
>> [javac] ^
>> [javac]
>>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:70:
>>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
>> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
>> [javac] Enumeration enum = request.getParameterNames();
>> [javac] ^
>> [javac]
>>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:72:
>>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
>> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
>> [javac] while (enum.hasMoreElements()) {
>> [javac] ^
>> [javac]
>>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:73:
>>as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
>> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
>> [javac] String param = (String) enum.nextElement();
>> [javac] ^
>> [javac] 6 errors
>>
>>BUILD FAILED
>>
>>Arg. I can't even do a test with Java 6 to see if the patch works or
>>not. I'm quite surprised to see this.
>>I don't have enough time left today and will have to pick this up next
>>Tuesday.
>>
>>I'm pasting my hand-patched file in case someone wants to grab this ball
>>and roll with it before I get back.
>>
>>Cheers.
>>
>>/*
>> * XmlBeanSerializer.java
>> *
>> * Copyright 2001-2004 The Apache Software Foundation.
>> *
>> *
>> * Licensed under the Apache License, Version 2.0 (the "License");
>> * you may not use this file except in compliance with the License.
>> * You may obtain a copy of the License at
>> *
>> * http://www.apache.org/licenses/LICENSE-2.0
>> *
>> * Unless required by applicable law or agreed to in writing, software
>> * distributed under the License is distributed on an "AS IS" BASIS,
>> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>> * See the License for the specific language governing permissions and
>> * limitations under the License.
>> *
>> * Original author: Jonathan Colwell
>> */
>>
>>package org.apache.axis.encoding.ser.xbeans;
>>
>>import org.apache.axis.AxisFault;
>>import org.apache.axis.Constants;
>>import org.apache.axis.encoding.SerializationContext;
>>import org.apache.axis.encoding.Serializer;
>>import org.apache.axis.wsdl.fromJava.Types;
>>import org.apache.beehive.wsm.wsdl.Schema;
>>import org.apache.beehive.wsm.wsdl.Utilities;
>>import org.apache.xmlbeans.SchemaField;
>>import org.apache.xmlbeans.SchemaType;
>>import org.apache.xmlbeans.SchemaTypeLoader;
>>import org.apache.xmlbeans.XmlBeans;
>>import org.apache.xmlbeans.XmlCursor;
>>import org.apache.xmlbeans.XmlObject;
>>import org.apache.xmlbeans.XmlOptions;
>>import org.w3.x2001.xmlSchema.LocalElement;
>>import org.w3.x2001.xmlSchema.SchemaDocument;
>>import org.w3.x2001.xmlSchema.TopLevelComplexType;
>>import org.w3.x2001.xmlSchema.TopLevelElement;
>>import org.w3c.dom.Document;
>>import org.w3c.dom.Element;
>>import org.w3c.dom.Node;
>>import org.xml.sax.Attributes;
>>import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
>>import org.xmlsoap.schemas.wsdl.TDefinitions;
>>import org.xmlsoap.schemas.wsdl.TTypes;
>>
>>import javax.xml.namespace.QName;
>>import java.io.IOException;
>>import java.io.InputStream;
>>import java.lang.reflect.Array;
>>import java.util.HashSet;
>>import java.util.Set;
>>
>>/**
>> * Class XmlBeanSerializer
>> * @author Jonathan Colwell
>> */
>>public class XmlBeanSerializer implements Serializer {
>>
>> /**
>> * Serialize an element named name, with the indicated attributes
>> * and value.
>> *
>> * @param name is the element name
>> * @param attributes are the attributes...serialize is free to add
>>more.
>> * @param value is the value
>> * @param context is the SerializationContext
>> */
>> public void serialize(QName name, Attributes attributes,
>> Object value, SerializationContext context)
>> throws IOException {
>> List<String> testL = new ArrayList<String>();
>> if (!(value instanceof XmlObject)) {
>> throw new IOException(((value != null) ?
>> value.getClass().getName()
>> : "null")
>> + " is not an "
>> + XmlObject.class.getName());
>> } else {
>> context.setWriteXMLType(null);
>> context.startElement(name, attributes);
>> XmlCursor xCur = ((XmlObject) value).newCursor();
>> if (xCur.toFirstContentToken() == XmlCursor.TokenType.START) {
>> do {
>> Node n = xCur.getDomNode();
>> if (n.getNodeType() == Node.ELEMENT_NODE) {
>> context.writeDOMElement((Element) n);
>> }
>> } while (xCur.toNextSibling());
>> }
>> context.endElement();
>> }
>> }
>>
>> public String getMechanismType() {
>> return Constants.AXIS_SAX;
>> }
>>
>> /**
>> * Return XML schema for the specified type, suitable for insertion
>>into the
>> * <types> element of a WSDL document, or underneath an
>> * <element> or <attribute> declaration.
>> *
>> * @param javaType
>> * the Java Class we're writing out schema for
>> * @param types
>> * the Java2WSDL Types object which holds the context
>>for the
>> * WSDL being generated.
>> * @return a type element containing a schema simpleType/complexType
>> * @see org.apache.axis.wsdl.fromJava.Types
>> */
>> public Element writeSchema(Class javaType, Types types) throws
>>Exception {
>> //if (XmlObject.class.isAssignableFrom(javaType)) {
>> try {
>> if (!XmlObject.class.isAssignableFrom(javaType)) {
>> throw new RuntimeException(
>> "Invalid Object type is assigned to the
>>XMLBeanSerialization Type: "
>> + javaType.getCanonicalName());
>> }
>> SchemaType docType = XmlBeans.typeForClass(javaType);
>> writeSchemaForDocType(docType, types);
>> // assume that the writeSchemaForDocType wrote the schema
>> // for the type and all the dependent types.
>> return null;
>> } catch (Exception e) {
>> e.printStackTrace();
>> throw e;
>> }
>> }
>>
>> /**
>> * @param types
>> * @param docType
>> * @return
>> * @throws Exception
>> */
>> private void writeSchemaForDocType(SchemaType docType, Types types)
>> throws Exception {
>> Schema mySchema = Utilities.findtSchemaDocument(docType);
>>
>> QName q = docType.getName();
>>
>> XmlObject typeNodeInWSDL = mySchema.getTypeNode(q);
>>
>> if (null == typeNodeInWSDL)
>> throw new RuntimeException(
>> "Type for object not found in the assigned WSDL file. "
>> + docType.getName() + " schema in: "
>> + docType.getSourceName());
>> // insertDependentTypes(typeNodeInWSDL, types);
>> Node n = typeNodeInWSDL.getDomNode();
>> Document doc = types.createElement(
>>
>>"element_to_get_document_useless_otherwise").getOwnerDocument();
>> Element e = (Element) doc.importNode(n, true);
>> try {
>> types.writeSchemaElementDecl(q, e);
>> } catch (AxisFault e1) {
>> // this means the types was already in... fine!
>> // TBD: make sure there are other types of exceptions are
>>at least
>> // reported
>> }
>> Set<QName> dependentTypes = new HashSet<QName>();
>> getAllDependentTypes(typeNodeInWSDL, dependentTypes);
>> for (QName nxtType : dependentTypes) {
>> Class nxtJavaType = null;
>> // add the class if it is an xml bean
>> if (null != (nxtJavaType = q2UserClass(nxtType))
>> && XmlObject.class.isAssignableFrom(nxtJavaType)) {
>> writeSchema(nxtJavaType, types);
>> }
>> }
>> return;
>> }
>>
>>
>> /**
>> * @param nxtType
>> * @return null for classes that are not found, or if they are
>>primitive types
>> * *
>> */
>> private Class q2UserClass(QName qname) {
>> SchemaTypeLoader stl = XmlBeans.getContextTypeLoader();
>> SchemaType st = stl.findType(qname);
>> if (st == null) {
>> SchemaField sf = stl.findElement(qname);
>> if (sf != null)
>> st = sf.getType();
>> }
>>
>> if (st != null && !st.isBuiltinType())
>> return st.getJavaClass();
>> else
>> return null; // for classes that are not found, or are build in
>>
>> }
>>
>> /**
>> * @param nodeInWSDL
>> * @param dependentTypes
>> * @return
>> *
>> * Walk all the nodes under the nodeInWSDL if there is an 'element'
>>type the
>> * add its types or references to the dependent type.
>> */
>> private void getAllDependentTypes(XmlObject nodeInWSDL,
>> Set<QName> dependentTypes) {
>> // scan for any node under the type that has "type" or "ref"
>>attribute
>> XmlCursor cursor = nodeInWSDL.newCursor();
>> if (cursor.toFirstChild()) { // has child
>> while (true) {
>> getAllDependentTypes(cursor.getObject(), dependentTypes);
>> if (!cursor.toNextSibling())
>> break;
>> }
>> }
>> if (nodeInWSDL.schemaType().getName().getLocalPart().equals(
>> "localElement")) {
>> LocalElement e = (LocalElement) nodeInWSDL;
>>
>> if (e.isSetType())
>> dependentTypes.add(e.getType());
>> else if (e.isSetRef())
>> dependentTypes.add(e.getRef());
>> }
>> return;
>> }
>>
>> // NOTE jcolwell@bea.com 2004-Nov-15 --
>> // once the WSDLProcessor is changed to an interface, remove this
>>function
>> // and use the one in the upcoming XmlBeanWSDLProcessor.
>> private static <T extends XmlObject> T[] selectChildren(XmlObject
>>parent,
>> Class<T> childClass) throws IllegalAccessException,
>> NoSuchFieldException {
>> // retrieve the SchemaType from the static type field
>> SchemaType st = (SchemaType) childClass.getField("type").get(null);
>> XmlObject[] kids =
>>parent.selectChildren(st.getDocumentElementName());
>> T[] castKids = (T[]) Array.newInstance(childClass, kids.length);
>> for (int j = 0; j < castKids.length; j++) {
>> castKids[j] = childClass.cast(kids[j]);
>> }
>> return castKids;
>> }
>>}
>>
>>
>>
>>
>>--
>>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
>>
>
>
>
--
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Davanum Srinivas <da...@gmail.com>.
Mark,
I've got the changes into CVS and got everything building with JDK1.4.
Please pull the latest code. You will need wsm-schema.jar from here
(http://ws.zones.apache.org/~dims/libs/wsm-schema.jar) in addition to
all the jars from xmlbeans 2.0.0. wsm-schema.jar is basically xmlbeans
output of various xsd's needed (build xml is in beehive wsm project).
Please try it and let me know. I will try to see if i can integrate
the sample into axis as well when i get a chance.
thanks,
dims
On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Davanum Srinivas wrote:
> > sorry!!! - http://issues.apache.org/jira/browse/AXIS-1812
>
> [mswanson@sfd111 xbeans]$ patch -p0 </tmp/axis.patch
> (Stripping trailing CRs from patch.)
> patching file XmlBeanSerializer.java
> Hunk #1 FAILED at 21.
> Hunk #2 FAILED at 50.
> Hunk #3 FAILED at 99.
> 3 out of 3 hunks FAILED -- saving rejects to file XmlBeanSerializer.java.rej
>
> I patched it by hand, and then found enum is being incorrectly used in
> the Axis-1_2_1 sources:
>
> compile:
> [depend] Deleted 0 out of date files in 0 seconds
> [javac] Compiling 708 source files to
> /home/mswanson/downloads/java/axis-1_2_1/build/classes
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Scope.java:17:
> as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> [javac] package org.apache.axis.enum;
> [javac] ^
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Style.java:17:
> as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> [javac] package org.apache.axis.enum;
> [javac] ^
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Use.java:17:
> as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> [javac] package org.apache.axis.enum;
> [javac] ^
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:70:
> as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> [javac] Enumeration enum = request.getParameterNames();
> [javac] ^
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:72:
> as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> [javac] while (enum.hasMoreElements()) {
> [javac] ^
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:73:
> as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
> [javac] (use -source 1.4 or lower to use 'enum' as an identifier)
> [javac] String param = (String) enum.nextElement();
> [javac] ^
> [javac] 6 errors
>
> BUILD FAILED
>
> Arg. I can't even do a test with Java 6 to see if the patch works or
> not. I'm quite surprised to see this.
> I don't have enough time left today and will have to pick this up next
> Tuesday.
>
> I'm pasting my hand-patched file in case someone wants to grab this ball
> and roll with it before I get back.
>
> Cheers.
>
> /*
> * XmlBeanSerializer.java
> *
> * Copyright 2001-2004 The Apache Software Foundation.
> *
> *
> * Licensed under the Apache License, Version 2.0 (the "License");
> * you may not use this file except in compliance with the License.
> * You may obtain a copy of the License at
> *
> * http://www.apache.org/licenses/LICENSE-2.0
> *
> * Unless required by applicable law or agreed to in writing, software
> * distributed under the License is distributed on an "AS IS" BASIS,
> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> * See the License for the specific language governing permissions and
> * limitations under the License.
> *
> * Original author: Jonathan Colwell
> */
>
> package org.apache.axis.encoding.ser.xbeans;
>
> import org.apache.axis.AxisFault;
> import org.apache.axis.Constants;
> import org.apache.axis.encoding.SerializationContext;
> import org.apache.axis.encoding.Serializer;
> import org.apache.axis.wsdl.fromJava.Types;
> import org.apache.beehive.wsm.wsdl.Schema;
> import org.apache.beehive.wsm.wsdl.Utilities;
> import org.apache.xmlbeans.SchemaField;
> import org.apache.xmlbeans.SchemaType;
> import org.apache.xmlbeans.SchemaTypeLoader;
> import org.apache.xmlbeans.XmlBeans;
> import org.apache.xmlbeans.XmlCursor;
> import org.apache.xmlbeans.XmlObject;
> import org.apache.xmlbeans.XmlOptions;
> import org.w3.x2001.xmlSchema.LocalElement;
> import org.w3.x2001.xmlSchema.SchemaDocument;
> import org.w3.x2001.xmlSchema.TopLevelComplexType;
> import org.w3.x2001.xmlSchema.TopLevelElement;
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> import org.w3c.dom.Node;
> import org.xml.sax.Attributes;
> import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
> import org.xmlsoap.schemas.wsdl.TDefinitions;
> import org.xmlsoap.schemas.wsdl.TTypes;
>
> import javax.xml.namespace.QName;
> import java.io.IOException;
> import java.io.InputStream;
> import java.lang.reflect.Array;
> import java.util.HashSet;
> import java.util.Set;
>
> /**
> * Class XmlBeanSerializer
> * @author Jonathan Colwell
> */
> public class XmlBeanSerializer implements Serializer {
>
> /**
> * Serialize an element named name, with the indicated attributes
> * and value.
> *
> * @param name is the element name
> * @param attributes are the attributes...serialize is free to add
> more.
> * @param value is the value
> * @param context is the SerializationContext
> */
> public void serialize(QName name, Attributes attributes,
> Object value, SerializationContext context)
> throws IOException {
> List<String> testL = new ArrayList<String>();
> if (!(value instanceof XmlObject)) {
> throw new IOException(((value != null) ?
> value.getClass().getName()
> : "null")
> + " is not an "
> + XmlObject.class.getName());
> } else {
> context.setWriteXMLType(null);
> context.startElement(name, attributes);
> XmlCursor xCur = ((XmlObject) value).newCursor();
> if (xCur.toFirstContentToken() == XmlCursor.TokenType.START) {
> do {
> Node n = xCur.getDomNode();
> if (n.getNodeType() == Node.ELEMENT_NODE) {
> context.writeDOMElement((Element) n);
> }
> } while (xCur.toNextSibling());
> }
> context.endElement();
> }
> }
>
> public String getMechanismType() {
> return Constants.AXIS_SAX;
> }
>
> /**
> * Return XML schema for the specified type, suitable for insertion
> into the
> * <types> element of a WSDL document, or underneath an
> * <element> or <attribute> declaration.
> *
> * @param javaType
> * the Java Class we're writing out schema for
> * @param types
> * the Java2WSDL Types object which holds the context
> for the
> * WSDL being generated.
> * @return a type element containing a schema simpleType/complexType
> * @see org.apache.axis.wsdl.fromJava.Types
> */
> public Element writeSchema(Class javaType, Types types) throws
> Exception {
> //if (XmlObject.class.isAssignableFrom(javaType)) {
> try {
> if (!XmlObject.class.isAssignableFrom(javaType)) {
> throw new RuntimeException(
> "Invalid Object type is assigned to the
> XMLBeanSerialization Type: "
> + javaType.getCanonicalName());
> }
> SchemaType docType = XmlBeans.typeForClass(javaType);
> writeSchemaForDocType(docType, types);
> // assume that the writeSchemaForDocType wrote the schema
> // for the type and all the dependent types.
> return null;
> } catch (Exception e) {
> e.printStackTrace();
> throw e;
> }
> }
>
> /**
> * @param types
> * @param docType
> * @return
> * @throws Exception
> */
> private void writeSchemaForDocType(SchemaType docType, Types types)
> throws Exception {
> Schema mySchema = Utilities.findtSchemaDocument(docType);
>
> QName q = docType.getName();
>
> XmlObject typeNodeInWSDL = mySchema.getTypeNode(q);
>
> if (null == typeNodeInWSDL)
> throw new RuntimeException(
> "Type for object not found in the assigned WSDL file. "
> + docType.getName() + " schema in: "
> + docType.getSourceName());
> // insertDependentTypes(typeNodeInWSDL, types);
> Node n = typeNodeInWSDL.getDomNode();
> Document doc = types.createElement(
>
> "element_to_get_document_useless_otherwise").getOwnerDocument();
> Element e = (Element) doc.importNode(n, true);
> try {
> types.writeSchemaElementDecl(q, e);
> } catch (AxisFault e1) {
> // this means the types was already in... fine!
> // TBD: make sure there are other types of exceptions are
> at least
> // reported
> }
> Set<QName> dependentTypes = new HashSet<QName>();
> getAllDependentTypes(typeNodeInWSDL, dependentTypes);
> for (QName nxtType : dependentTypes) {
> Class nxtJavaType = null;
> // add the class if it is an xml bean
> if (null != (nxtJavaType = q2UserClass(nxtType))
> && XmlObject.class.isAssignableFrom(nxtJavaType)) {
> writeSchema(nxtJavaType, types);
> }
> }
> return;
> }
>
>
> /**
> * @param nxtType
> * @return null for classes that are not found, or if they are
> primitive types
> * *
> */
> private Class q2UserClass(QName qname) {
> SchemaTypeLoader stl = XmlBeans.getContextTypeLoader();
> SchemaType st = stl.findType(qname);
> if (st == null) {
> SchemaField sf = stl.findElement(qname);
> if (sf != null)
> st = sf.getType();
> }
>
> if (st != null && !st.isBuiltinType())
> return st.getJavaClass();
> else
> return null; // for classes that are not found, or are build in
>
> }
>
> /**
> * @param nodeInWSDL
> * @param dependentTypes
> * @return
> *
> * Walk all the nodes under the nodeInWSDL if there is an 'element'
> type the
> * add its types or references to the dependent type.
> */
> private void getAllDependentTypes(XmlObject nodeInWSDL,
> Set<QName> dependentTypes) {
> // scan for any node under the type that has "type" or "ref"
> attribute
> XmlCursor cursor = nodeInWSDL.newCursor();
> if (cursor.toFirstChild()) { // has child
> while (true) {
> getAllDependentTypes(cursor.getObject(), dependentTypes);
> if (!cursor.toNextSibling())
> break;
> }
> }
> if (nodeInWSDL.schemaType().getName().getLocalPart().equals(
> "localElement")) {
> LocalElement e = (LocalElement) nodeInWSDL;
>
> if (e.isSetType())
> dependentTypes.add(e.getType());
> else if (e.isSetRef())
> dependentTypes.add(e.getRef());
> }
> return;
> }
>
> // NOTE jcolwell@bea.com 2004-Nov-15 --
> // once the WSDLProcessor is changed to an interface, remove this
> function
> // and use the one in the upcoming XmlBeanWSDLProcessor.
> private static <T extends XmlObject> T[] selectChildren(XmlObject
> parent,
> Class<T> childClass) throws IllegalAccessException,
> NoSuchFieldException {
> // retrieve the SchemaType from the static type field
> SchemaType st = (SchemaType) childClass.getField("type").get(null);
> XmlObject[] kids =
> parent.selectChildren(st.getDocumentElementName());
> T[] castKids = (T[]) Array.newInstance(childClass, kids.length);
> for (int j = 0; j < castKids.length; j++) {
> castKids[j] = childClass.cast(kids[j]);
> }
> return castKids;
> }
> }
>
>
>
>
> --
> 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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> sorry!!! - http://issues.apache.org/jira/browse/AXIS-1812
[mswanson@sfd111 xbeans]$ patch -p0 </tmp/axis.patch
(Stripping trailing CRs from patch.)
patching file XmlBeanSerializer.java
Hunk #1 FAILED at 21.
Hunk #2 FAILED at 50.
Hunk #3 FAILED at 99.
3 out of 3 hunks FAILED -- saving rejects to file XmlBeanSerializer.java.rej
I patched it by hand, and then found enum is being incorrectly used in
the Axis-1_2_1 sources:
compile:
[depend] Deleted 0 out of date files in 0 seconds
[javac] Compiling 708 source files to
/home/mswanson/downloads/java/axis-1_2_1/build/classes
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Scope.java:17:
as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
[javac] (use -source 1.4 or lower to use 'enum' as an identifier)
[javac] package org.apache.axis.enum;
[javac] ^
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Style.java:17:
as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
[javac] (use -source 1.4 or lower to use 'enum' as an identifier)
[javac] package org.apache.axis.enum;
[javac] ^
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/enum/Use.java:17:
as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
[javac] (use -source 1.4 or lower to use 'enum' as an identifier)
[javac] package org.apache.axis.enum;
[javac] ^
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:70:
as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
[javac] (use -source 1.4 or lower to use 'enum' as an identifier)
[javac] Enumeration enum = request.getParameterNames();
[javac] ^
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:72:
as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
[javac] (use -source 1.4 or lower to use 'enum' as an identifier)
[javac] while (enum.hasMoreElements()) {
[javac] ^
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/transport/http/QSMethodHandler.java:73:
as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
[javac] (use -source 1.4 or lower to use 'enum' as an identifier)
[javac] String param = (String) enum.nextElement();
[javac] ^
[javac] 6 errors
BUILD FAILED
Arg. I can't even do a test with Java 6 to see if the patch works or
not. I'm quite surprised to see this.
I don't have enough time left today and will have to pick this up next
Tuesday.
I'm pasting my hand-patched file in case someone wants to grab this ball
and roll with it before I get back.
Cheers.
/*
* XmlBeanSerializer.java
*
* Copyright 2001-2004 The Apache Software Foundation.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Original author: Jonathan Colwell
*/
package org.apache.axis.encoding.ser.xbeans;
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.encoding.Serializer;
import org.apache.axis.wsdl.fromJava.Types;
import org.apache.beehive.wsm.wsdl.Schema;
import org.apache.beehive.wsm.wsdl.Utilities;
import org.apache.xmlbeans.SchemaField;
import org.apache.xmlbeans.SchemaType;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.w3.x2001.xmlSchema.LocalElement;
import org.w3.x2001.xmlSchema.SchemaDocument;
import org.w3.x2001.xmlSchema.TopLevelComplexType;
import org.w3.x2001.xmlSchema.TopLevelElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.Attributes;
import org.xmlsoap.schemas.wsdl.DefinitionsDocument;
import org.xmlsoap.schemas.wsdl.TDefinitions;
import org.xmlsoap.schemas.wsdl.TTypes;
import javax.xml.namespace.QName;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.util.HashSet;
import java.util.Set;
/**
* Class XmlBeanSerializer
* @author Jonathan Colwell
*/
public class XmlBeanSerializer implements Serializer {
/**
* Serialize an element named name, with the indicated attributes
* and value.
*
* @param name is the element name
* @param attributes are the attributes...serialize is free to add
more.
* @param value is the value
* @param context is the SerializationContext
*/
public void serialize(QName name, Attributes attributes,
Object value, SerializationContext context)
throws IOException {
List<String> testL = new ArrayList<String>();
if (!(value instanceof XmlObject)) {
throw new IOException(((value != null) ?
value.getClass().getName()
: "null")
+ " is not an "
+ XmlObject.class.getName());
} else {
context.setWriteXMLType(null);
context.startElement(name, attributes);
XmlCursor xCur = ((XmlObject) value).newCursor();
if (xCur.toFirstContentToken() == XmlCursor.TokenType.START) {
do {
Node n = xCur.getDomNode();
if (n.getNodeType() == Node.ELEMENT_NODE) {
context.writeDOMElement((Element) n);
}
} while (xCur.toNextSibling());
}
context.endElement();
}
}
public String getMechanismType() {
return Constants.AXIS_SAX;
}
/**
* Return XML schema for the specified type, suitable for insertion
into the
* <types> element of a WSDL document, or underneath an
* <element> or <attribute> declaration.
*
* @param javaType
* the Java Class we're writing out schema for
* @param types
* the Java2WSDL Types object which holds the context
for the
* WSDL being generated.
* @return a type element containing a schema simpleType/complexType
* @see org.apache.axis.wsdl.fromJava.Types
*/
public Element writeSchema(Class javaType, Types types) throws
Exception {
//if (XmlObject.class.isAssignableFrom(javaType)) {
try {
if (!XmlObject.class.isAssignableFrom(javaType)) {
throw new RuntimeException(
"Invalid Object type is assigned to the
XMLBeanSerialization Type: "
+ javaType.getCanonicalName());
}
SchemaType docType = XmlBeans.typeForClass(javaType);
writeSchemaForDocType(docType, types);
// assume that the writeSchemaForDocType wrote the schema
// for the type and all the dependent types.
return null;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
/**
* @param types
* @param docType
* @return
* @throws Exception
*/
private void writeSchemaForDocType(SchemaType docType, Types types)
throws Exception {
Schema mySchema = Utilities.findtSchemaDocument(docType);
QName q = docType.getName();
XmlObject typeNodeInWSDL = mySchema.getTypeNode(q);
if (null == typeNodeInWSDL)
throw new RuntimeException(
"Type for object not found in the assigned WSDL file. "
+ docType.getName() + " schema in: "
+ docType.getSourceName());
// insertDependentTypes(typeNodeInWSDL, types);
Node n = typeNodeInWSDL.getDomNode();
Document doc = types.createElement(
"element_to_get_document_useless_otherwise").getOwnerDocument();
Element e = (Element) doc.importNode(n, true);
try {
types.writeSchemaElementDecl(q, e);
} catch (AxisFault e1) {
// this means the types was already in... fine!
// TBD: make sure there are other types of exceptions are
at least
// reported
}
Set<QName> dependentTypes = new HashSet<QName>();
getAllDependentTypes(typeNodeInWSDL, dependentTypes);
for (QName nxtType : dependentTypes) {
Class nxtJavaType = null;
// add the class if it is an xml bean
if (null != (nxtJavaType = q2UserClass(nxtType))
&& XmlObject.class.isAssignableFrom(nxtJavaType)) {
writeSchema(nxtJavaType, types);
}
}
return;
}
/**
* @param nxtType
* @return null for classes that are not found, or if they are
primitive types
* *
*/
private Class q2UserClass(QName qname) {
SchemaTypeLoader stl = XmlBeans.getContextTypeLoader();
SchemaType st = stl.findType(qname);
if (st == null) {
SchemaField sf = stl.findElement(qname);
if (sf != null)
st = sf.getType();
}
if (st != null && !st.isBuiltinType())
return st.getJavaClass();
else
return null; // for classes that are not found, or are build in
}
/**
* @param nodeInWSDL
* @param dependentTypes
* @return
*
* Walk all the nodes under the nodeInWSDL if there is an 'element'
type the
* add its types or references to the dependent type.
*/
private void getAllDependentTypes(XmlObject nodeInWSDL,
Set<QName> dependentTypes) {
// scan for any node under the type that has "type" or "ref"
attribute
XmlCursor cursor = nodeInWSDL.newCursor();
if (cursor.toFirstChild()) { // has child
while (true) {
getAllDependentTypes(cursor.getObject(), dependentTypes);
if (!cursor.toNextSibling())
break;
}
}
if (nodeInWSDL.schemaType().getName().getLocalPart().equals(
"localElement")) {
LocalElement e = (LocalElement) nodeInWSDL;
if (e.isSetType())
dependentTypes.add(e.getType());
else if (e.isSetRef())
dependentTypes.add(e.getRef());
}
return;
}
// NOTE jcolwell@bea.com 2004-Nov-15 --
// once the WSDLProcessor is changed to an interface, remove this
function
// and use the one in the upcoming XmlBeanWSDLProcessor.
private static <T extends XmlObject> T[] selectChildren(XmlObject
parent,
Class<T> childClass) throws IllegalAccessException,
NoSuchFieldException {
// retrieve the SchemaType from the static type field
SchemaType st = (SchemaType) childClass.getField("type").get(null);
XmlObject[] kids =
parent.selectChildren(st.getDocumentElementName());
T[] castKids = (T[]) Array.newInstance(childClass, kids.length);
for (int j = 0; j < castKids.length; j++) {
castKids[j] = childClass.cast(kids[j]);
}
return castKids;
}
}
--
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Davanum Srinivas <da...@gmail.com>.
sorry!!! - http://issues.apache.org/jira/browse/AXIS-1812
On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Davanum Srinivas wrote:
> > Mark,
> >
> > Since you have gotten this far, i'll throw u another curve ball.
> > Here's another patch that has not been applied yet as it has JDK1.5
> > stuff. this will fix the schema problem you had. Can you please take a
> > look at that?
>
> FYI - just a reminder I haven't received the patch.
>
> 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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Davanum Srinivas <da...@gmail.com>.
Mark,
Since you have gotten this far, i'll throw u another curve ball.
Here's another patch that has not been applied yet as it has JDK1.5
stuff. this will fix the schema problem you had. Can you please take a
look at that?
I really appreciate you helping with this.
thanks,
dims
On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Davanum Srinivas wrote:
> > get wsdltypes.jar from
> > http://superflaco.com/Beehive/java1dot4XBeanSample.war (mentioned in
> > the bug report http://issues.apache.org/jira/browse/AXIS-1764). It's
> > part of beehive wsm.
>
> Thanks. That solved one issue. The last issue is in this code:
>
> XmlObject[] kids = selectChildren
> (tt, SchemaDocument.Schema.class);
> SchemaDocument.Schema[] schemas =
> new SchemaDocument.Schema[kids.length];
>
> // NOTE jcolwell@bea.com 2005-Jan-10 -- this is the
> part that the
> // fancy generics saves me from having to do after each
> call to
> // selectChildren(XmlObject, Class)
>
> for (int j = 0; j < kids.length; j++) {
> bug: ---> schemas[j] = (SchemaDocument.Schema) kids[j];
> }
>
> The bug is that you can't cast an XmlObject to a SchemaDocument.Schema:
>
> >>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:142:
> >>types org.apache.xmlbeans.XmlObject and
> >>org.w3.x2001.xmlSchema.SchemaDocument.Schema are incompatible; both
> >>define copy(), but with different return type
> >> [javac] schemas[j] = (SchemaDocument.Schema)
> >>kids[j];
> >> [javac] ^
>
> Instead of casting I tried to use an XmlObject method to accomplish the
> same thing in a safer manner. I patched the above code to look like this:
>
> for (int j = 0; j < kids.length; j++) {^M
> schemas[j] = kids[j].schemaType();^M
> //schemas[j] = (SchemaDocument.Schema) kids[j];^M
> }^M
>
> Though, I haven't tested it. It does compile and it seems like I
> followed the intent but the underlying details are new to me so...
>
> Is there anyone on this mailing list that would know the answer to this?
> I've cc'd the author of the code fragment. Perhaps he could help.
>
> If we can get through this I'll post a nice summary for future reference.
>
> 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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> get wsdltypes.jar from
> http://superflaco.com/Beehive/java1dot4XBeanSample.war (mentioned in
> the bug report http://issues.apache.org/jira/browse/AXIS-1764). It's
> part of beehive wsm.
Thanks. That solved one issue. The last issue is in this code:
XmlObject[] kids = selectChildren
(tt, SchemaDocument.Schema.class);
SchemaDocument.Schema[] schemas =
new SchemaDocument.Schema[kids.length];
// NOTE jcolwell@bea.com 2005-Jan-10 -- this is the
part that the
// fancy generics saves me from having to do after each
call to
// selectChildren(XmlObject, Class)
for (int j = 0; j < kids.length; j++) {
bug: ---> schemas[j] = (SchemaDocument.Schema) kids[j];
}
The bug is that you can't cast an XmlObject to a SchemaDocument.Schema:
>>/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:142:
>>types org.apache.xmlbeans.XmlObject and
>>org.w3.x2001.xmlSchema.SchemaDocument.Schema are incompatible; both
>>define copy(), but with different return type
>> [javac] schemas[j] = (SchemaDocument.Schema)
>>kids[j];
>> [javac] ^
Instead of casting I tried to use an XmlObject method to accomplish the
same thing in a safer manner. I patched the above code to look like this:
for (int j = 0; j < kids.length; j++) {^M
schemas[j] = kids[j].schemaType();^M
//schemas[j] = (SchemaDocument.Schema) kids[j];^M
}^M
Though, I haven't tested it. It does compile and it seems like I
followed the intent but the underlying details are new to me so...
Is there anyone on this mailing list that would know the answer to this?
I've cc'd the author of the code fragment. Perhaps he could help.
If we can get through this I'll post a nice summary for future reference.
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Davanum Srinivas <da...@gmail.com>.
get wsdltypes.jar from
http://superflaco.com/Beehive/java1dot4XBeanSample.war (mentioned in
the bug report http://issues.apache.org/jira/browse/AXIS-1764). It's
part of beehive wsm.
-- dims
On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> Mark Swanson wrote:
> > 3. There are no build instructions on how to build the XmlBeans optional
> > component in the docs/building-axis.html document.
> >
> > If anyone has such build instructions, please post.
>
> Note: I tried to copy the Xmlbeans-2.0.0 libs into the axis-1_2_1/lib
> dir. I received this when I tried to compile:
>
> compile:
> [depend] Deleted 0 out of date files in 0 seconds
> [javac] Compiling 4 source files to
> /home/mswanson/downloads/java/axis-1_2_1/build/classes
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:132:
> selectChildren(org.apache.xmlbeans.XmlObject,java.lang.Class) in
> org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer cannot be applied
> to (org.xmlsoap.schemas.wsdl.TTypes,java.lang.Class)
> [javac] XmlObject[] kids = selectChildren
> [javac] ^
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:142:
> types org.apache.xmlbeans.XmlObject and
> org.w3.x2001.xmlSchema.SchemaDocument.Schema are incompatible; both
> define copy(), but with different return type
> [javac] schemas[j] = (SchemaDocument.Schema)
> kids[j];
> [javac] ^
> [javac]
> /home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:170:
> cannot resolve symbol
> [javac] symbol : method newDomNode (org.apache.xmlbeans.XmlOptions)
> [javac] location: interface org.xmlsoap.schemas.wsdl.TDefinitions
> [javac] Node defEl = definitions.newDomNode(new
> XmlOptions()
> [javac] ^
> [javac] 3 errors
>
> BUILD FAILED
> /home/mswanson/downloads/java/axis-1_2_1/build.xml:98: Compile failed;
> see the compiler error output for details.
>
>
>
> --
> 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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Mark Swanson wrote:
> 3. There are no build instructions on how to build the XmlBeans optional
> component in the docs/building-axis.html document.
>
> If anyone has such build instructions, please post.
Note: I tried to copy the Xmlbeans-2.0.0 libs into the axis-1_2_1/lib
dir. I received this when I tried to compile:
compile:
[depend] Deleted 0 out of date files in 0 seconds
[javac] Compiling 4 source files to
/home/mswanson/downloads/java/axis-1_2_1/build/classes
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:132:
selectChildren(org.apache.xmlbeans.XmlObject,java.lang.Class) in
org.apache.axis.encoding.ser.xbeans.XmlBeanSerializer cannot be applied
to (org.xmlsoap.schemas.wsdl.TTypes,java.lang.Class)
[javac] XmlObject[] kids = selectChildren
[javac] ^
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:142:
types org.apache.xmlbeans.XmlObject and
org.w3.x2001.xmlSchema.SchemaDocument.Schema are incompatible; both
define copy(), but with different return type
[javac] schemas[j] = (SchemaDocument.Schema)
kids[j];
[javac] ^
[javac]
/home/mswanson/downloads/java/axis-1_2_1/src/org/apache/axis/encoding/ser/xbeans/XmlBeanSerializer.java:170:
cannot resolve symbol
[javac] symbol : method newDomNode (org.apache.xmlbeans.XmlOptions)
[javac] location: interface org.xmlsoap.schemas.wsdl.TDefinitions
[javac] Node defEl = definitions.newDomNode(new
XmlOptions()
[javac] ^
[javac] 3 errors
BUILD FAILED
/home/mswanson/downloads/java/axis-1_2_1/build.xml:98: Compile failed;
see the compiler error output for details.
--
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Mark Swanson <ma...@ScheduleWorld.com>.
Davanum Srinivas wrote:
> they are optional. you need to build it. dependecy jars are in the zip
> file (http://issues.apache.org/jira/browse/AXIS-1764)
Thanks for the info Davanum. A few comments:
1. There are no dependency jars in the zip that I can see. The zip only
contains sample code.
2. The sample code is not that useful because it has nothing to do with
Axis and are simple xmlBeans examples. What would be useful would be an
example of how to use Axis with XmlBeans. I know, I should provide one.
3. There are no build instructions on how to build the XmlBeans optional
component in the docs/building-axis.html document.
If anyone has such build instructions, please post.
Thank you.
> -- dims
>
> On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
>
>>So I grep'd everything in 1.2 and 1.2.1. The xbeans package is mentioned
>>in the docs but is completely missing from the bin download.
>>
>>--
>>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
>>
>
>
>
--
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: bug: Axis 1.2 and 1.2.1 is missing xbeans package
Posted by Davanum Srinivas <da...@gmail.com>.
they are optional. you need to build it. dependecy jars are in the zip
file (http://issues.apache.org/jira/browse/AXIS-1764)
-- dims
On 7/6/05, Mark Swanson <ma...@scheduleworld.com> wrote:
> So I grep'd everything in 1.2 and 1.2.1. The xbeans package is mentioned
> in the docs but is completely missing from the bin download.
>
> --
> 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/