Simon Fell > Its just code
I've been looking into how to handle xsd:enumeration in PocketSOAP, I have something that works by mapping it to a VB enum type, and spitting out a custom serializer to get the correct string on the wire. I was looking into what ASP.NET does with enums and noticed that the bitfield stuff that .NET enums support can result in invalid messages being created by ASP.NET. I'm not entirely sure what it should do in this case, but generating a schema invalid message doesn't seem right to me, here's an example.
public enum fooEnum
{
red = 1,
blue = 2,
green = 4
}
[WebService(Namespace="http://example.org/webservices/")]
public class foo
{
[WebMethod]
public fooEnum getSomeFoo()
{
return fooEnum.red | fooEnum.green ;
}
}
And here's the resulting schema fragment it generates
<:s:simpleType name="fooEnum">
<:s:restriction base="s:string">
<:s:enumeration value="red" />
<:s:enumeration value="blue" />
<:s:enumeration value="green" />
<:/s:restriction>
<:/s:simpleType>
This results in a response message containing the value 5, a result which isn't valid according to the schema generated for the WSDL. Perhaps it should generate an array of values ?
I just updated the main PocketSOAP RSS feed to RSS 1.0, let me know if you spot any problems.
Trying out the latest version of Aggie
Cool, Drew Marsh got his blog up and running.