homepage Welcome to WebmasterWorld Guest from 54.237.184.242
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
What is the correct parse of this request?
Seems gSOAP is not handling mandatory enumeration elements properly(?)
sune ahlgren




msg:3874391
 4:09 pm on Mar 19, 2009 (gmt 0)

Hi,

I have implemented a very simple SOAP server using gSOAP. I use a xsd containing among other things a declaration as below:

<!--===============================-->
<xs:complexType name="Information">
<xs:sequence>
<xs:element name="Type" type="tt:DynamicType"/>
<xs:element name="Name" type="tt:Name" minOccurs="0"/>
<xs:element name="Age" type="tt:Age" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<!--===============================-->
<xs:simpleType name="DynamicType">
<xs:restriction base="xs:string">
<xs:enumeration value="Male"/>
<xs:enumeration value="Female"/>
</xs:restriction>
</xs:simpleType>

What surprises me is that if I send a request to this server and that request contains an Information element and I leave out the Type element, this element is set to 0 (that is the same as Male) by gSOAP before my server function is called.

This is what a request might look like:

<SOAP-ENV:Body>
<tds:Information>
<tds:Name>Nisse</tds:Name>
</tds:Information>
</SOAP-ENV:Body>

Why isn't this request rejected? Type is mandatory given the schema above.

BRs
/Sune

 

httpwebwitch




msg:3896422
 8:13 pm on Apr 20, 2009 (gmt 0)

Hi Sune, welcome to WebmasterWorld!

I guess the underlying question is: are requests being validated using the schema at all? Try putting some garbage nodes in the request, and see if you still get no errors. It could be that your XSD is there, but nothing is actually enforced.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved