Simon Fell > Its just code : Saturday, June 08, 2002

Simon Fell > Its just code

Saturday, June 08, 2002

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 ?
< 11:17:37 PM  # more elsewhere > DJ Food & DK - Jeru the Damaja - Come Clean/The Cinematic Orchestra - Channel One Suite

I just updated the main PocketSOAP RSS feed to RSS 1.0, let me know if you spot any problems.
< 1:01:38 PM  # more elsewhere > Diesel Boy - Terminal Velocity

Trying out the latest version of Aggie
< 11:49:08 AM  # more elsewhere > Big Bud - Pure

Cool, Drew Marsh got his blog up and running.
< 10:08:47 AM  # more elsewhere > Big Bud - My Spirit