axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter <peter.van.rensb...@gmail.com>
Subject Axis and xsd:enumeration
Date Mon, 01 Aug 2005 22:18:02 GMT
Hi,

I'm having a bit of a problem with XML schema enumeration types it
seems. I have the following XSD:

	<xs:complexType name="BrandReferenceType">
		<xs:sequence>
			<xs:element name="brandCode" type="BrandTypes"/>
		</xs:sequence>
	</xs:complexType>

	<xs:simpleType name="BrandTypes">
		<xs:restriction base="xs:string">
			<xs:enumeration value="BRANDA"/>
			<xs:enumeration value="BRANDB"/>
			<xs:enumeration value="BRANDC"/>
		</xs:restriction>
	</xs:simpleType>

I used WSDL2Java to generate my objects from that, so basically in my
code I'm using:

        	BrandReferenceType brandRef = new BrandReferenceType();
        	brandRef.setBrandCode(BrandTypes.BRANDA);
        	
        	Account account = new Account();
        	account.setBrand(brandRef);

The serialized (excerpt) message looks this (looks fine?): 

		<Account xmlns="http://xxx/EDI/types/messages">
			<ns2:accountId xmlns:ns2="http://xxxx/EDI/types/common">1
			</ns2:accountId>
			<ns3:brand xmlns:ns3="http://xxx/EDI/types/common">
				<ns3:brandCode>BRANDA
				</ns3:brandCode>
			</ns3:brand>

However I run into this problem on the server when I invoke a method
consuming an Account object:

~~~~~~~~~
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.encoding.DeserializationContext] Enter:
DeserializationContext::startElement(http://schemas.prophet.net/EDI/types/common,
brand)
2005-08-01 14:08:02,647 DEBUG [org.apache.axis.message.RPCHandler]
Enter: RPCHandler.onStartChild()
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.i18n.ProjectResourceBundle]
org.apache.axis.i18n.resource::handleGetObject(typeFromAttr00)
2005-08-01 14:08:02,647 DEBUG [org.apache.axis.message.RPCHandler]
Type from attributes is:  null
2005-08-01 14:08:02,647 DEBUG [org.apache.axis.message.RPCHandler]
Exit: RPCHandler.onStartChild()
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.i18n.ProjectResourceBundle]
org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.encoding.DeserializationContext] Pushing handler
org.apache.axis.encoding.DeserializerImpl@1b22920
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.i18n.ProjectResourceBundle]
org.apache.axis.i18n.resource::handleGetObject(gotType00)
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.encoding.DeserializerImpl] Deser got type
{http://www.w3.org/2001/XMLSchema}string
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.encoding.DeserializationContext] Exit:
DeserializationContext::startElement()
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.encoding.DeserializationContext] Enter:
DeserializationContext::startElement(http://schemas.prophet.net/EDI/types/common,
brandCode)
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.i18n.ProjectResourceBundle]
org.apache.axis.i18n.resource::handleGetObject(cantHandle00)
2005-08-01 14:08:02,647 DEBUG
[org.apache.axis.i18n.ProjectResourceBundle]
org.apache.axis.i18n.resource::handleGetObject(toAxisFault00)
2005-08-01 14:08:02,647 DEBUG [org.apache.axis.enterprise] Mapping
Exception to AxisFault
org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to
deserialize.
        at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
~~~~~~~~~

So it seems that it does not expect the element <brandCode> inside
<brand>, which seems perfectly valid to me (and XMLSpy ;)

Any ideas?

Incidentally, how can I tell wsdl2java ant task to generated a
style="wrapped" wsdd as apposed to style="document" ?

Thank you,
Peter

Mime
View raw message