Hi,

What's wrong with this schema fragment?

        <element name="authorizePurchaseResponse">
                <complexType>
                        <sequence>
                                <element name="purchaseId" type="string" 
maxOccurs="1"
                                        minOccurs="1"></element>
                                <element name="processedDate" type="dateTime" 
maxOccurs="1"
                                        minOccurs="1"></element>
                                <element name="statusCode" type="string" 
maxOccurs="1"
                                        minOccurs="1"></element>
                                <element name="paidAmount" type="decimal" 
maxOccurs="1"
                                        minOccurs="0"></element>
                                <element name="errorShortCode" type="string" 
maxOccurs="1"
                                        minOccurs="1"></element>
                                <element name="customerMessage" type="string" 
maxOccurs="1"
                                        minOccurs="0"></element>
                                <element name="partnerMessageOption " 
type="boolean"
                                        maxOccurs="1" minOccurs="0"></element>
                        </sequence>
                </complexType>
        </element>


I obviously wasn't looking hard enough, since to me there was
*nothing* wrong with it until the service I was writing actually tried
to use it in an operation. Then Axis2 returned this error:


org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException:
Unexpected subelement partnerMessageOption
   at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
   at ChargingServiceStub.fromOM(ChargingServiceStub.java:847)
   at ChargingServiceStub.authorizePurchase(ChargingServiceStub.java:201)
   at ChargingClient.callService(ChargingClient.java:86)
   at GeneralClient.main(GeneralClient.java:76)
Caused by: java.lang.Exception:
org.apache.axis2.databinding.ADBException: Unexpected subelement
partnerMessageOption
   at 
AuthorizePurchaseResponse$Factory.parse(AuthorizePurchaseResponse.java:1056)
   at ChargingServiceStub.fromOM(NDPChargingServiceStub.java:827)
   ...3 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected
subelement partnerMessageOption


Now I looked at the schema again and saw that there was an extra space
in the name  "partnerMessageOption ".

Removing this space made the error go away.

Now what I'm wondering is: are spaces at the end of element names
valid in XSD schema?

If it's not, then shouldn't the error be detected and an exception
thrown at the point of code generation and not at runtime?

Hopefully this helps someone who's experienced the same error and is
just as puzzled by the "Unexpected subelement" message.


Ellecer

Reply via email to