Warning

 

Close
Confirm Action

Are you sure you wish to do this?

Cancel Confirm
AR15.COM
8/28/2009 11:57:37 AM EDT
I'm a Java developer and a client reported an issue when I gave them a new WSDL. I'd added a new enumerated datatype that was a union with an existing type and added a new value. It seems that the MS parser/binding/whatever tool doesn't like unions. The schema is WSI compliant and validates through XML Spy but MS still doesn't like it. Anyone deal with this before?
8/31/2009 10:52:25 AM EDT
[#1]
Do you have an example of the WSDL? You can dumb it down to the specific enumeration if you're under NDA.
8/31/2009 4:43:54 PM EDT
[#2]
Obviously anti-capitalism.
8/31/2009 5:22:56 PM EDT
[#3]

<xs:simpleType name="BaseEnumeration__Type">
   <xs:restriction base="xs:string">
     <xs:enumeration value="Value1"/>
     <xs:enumeration value="Value2"/>
     <xs:enumeration value="Value3"/>
   </xs:restriction>
</xs:simpleType>
<xs:simpleType name="ExtendedEnumeration__Type">
   <xs:union memberTypes="BaseEnumeration__Type">
     <xs:simpleType>
       <xs:restriction base="xs:string">
         <xs:enumeration value="NewValue1"/>
         <xs:enumeration value="NewValue2"/>
         <xs:enumeration value="NewValue3"/>
       </xs:restriction>
     </xs:simpleType>
   </xs:union>
</xs:simpleType>


So ExtendedEnumeration is a union based on BaseEnumeration but it adds three new values for a total of six.
9/1/2009 10:54:45 AM EDT
[#4]
I wrote a console app that took the schema (added a complex type with just the extended enumeration as an element). I created a XML document that had one instance of the complex type with the enumerated element set to NewValue1. Using the XmlReader class, the document validated successfully against the schema. So at least at the library/parser level, .NET 3.5 does support union types.
9/1/2009 12:58:17 PM EDT
[#5]
Interesting. I'll have to see what the client and the .NET guy in another dev group are using where it's failing. Whatever tool they're using simply ignores the union types. Thanks.
9/1/2009 4:42:11 PM EDT
[#6]
Pardon my ignorance on the .NET side but are you binding to the schema? Come to think of it I think you can only bind to a WSDL. I recall sending my co-worker a schema and he needed the WSDL. I think the binding process makes each element, enumeration, etc. an object. Maybe this is why it works for you and not for us. Sorry if that was a key detail. Then again, it may not mean anything.
9/2/2009 5:50:34 AM EDT
[#7]
You can consume the WSDL in a .NET application; that's probably what you're saying (tomatoes and all that) but you only provided the schema for the union type so I can only validate XML against it. If you can give me the WSDL generated by your Java web services (dumbed down to exclude NDA and irrelevant objects), I'll see if VS can consume it. I'm assuming your client is letting VS generate the proxy classes and they're not coding them by hand.
9/2/2009 6:29:05 AM EDT
[#8]
I believe you're right. I didn't think about the WSDL until yesterday. I'll see what I can do. If I don't get it today it'll be next week since I'm headed out tom at noon. Tnx again.
9/2/2009 12:22:20 PM EDT
[#9]
I generated a mock web service with a generic Hello World web method in it (outputs a string and takes an enumeration as an input). Taking the WSDL from that web service, I modified it so the enumeration simple type was a union type. The interesting thing is that VS can't figure out how to create the union enumeration in the proxy classes as it would normally do for a simple enumeration. However, VS reverts the input parameter to a string type so you can still use the web method. You just don't have the associated enumeration for it anymore. Is this the same issue your client is running into (the fact the enumeration isn't being created)?
9/2/2009 3:21:35 PM EDT
[#10]
I remember one case in this episode where it did change the enum to xs:string. However (and I don't know what's different) when I searched the other files they sent me I found no reference to it at all.