Yossi Dahan [BizTalk]

Google
 

Friday, August 11, 2006

Schema re-use and generated web service proxies

We've found out another piece of puzzling .net proxy behaviour (to us at least)

If you have a complex type definition in an XSD file:

<xs:complexType name="myType">
.
.
.
</xs:complextType>

And then an element that uses this type: (in our case in another XSD file that includes the former XSD file)

<xs:element name="myElement" type="myType"/>

When you then publish an orchestration as a web service that uses this schema as a type of the parameter(s) and/or return values, the proxy generated will use the type name as the class name and not the element name.

So it would generate a class called "myType" and not "myElement" as I have expected.

In many cases it doesn't really matter, other then somewhat weird names in the code, in our case, because we're trying really hard to reuse existing objects thorugh the entire solution (inside and outside the biztalk boundaries), it poses a problem as class names are not as they should be.

This can be solved by changing the type name to match the element name, I was surprised by that by xsd seems to be happy with -

<xs:complexType name="myElement">
.
.
.
</xs:complextType>
<xs:element name="myElement" type="myElement"/>

0 Comments:

Post a Comment

<< Home