Problem generating appropriate WSDL from C# classes generated from an XSD

A

Andy

Hi all,

We are integrating Great Plains 7.5 (GP) with BizTalk 2004 (BT)
through web services.

GP's connectivity component (eConnect) works with XML and all
transaction types are defined in a single schema eConnect.XSD (about
506kB).

BT requires the web service to expose the transaction types as classes
within the web service so that the eConnect XSD reflects as part of
the WSDL.

To generate these classes in C# I used the .NET XSD utility:
XSD.exe econnect.xsd /c
which created econnect.cs (about 24500 lines)

I then imported these C# classes into my webservice.asmx and use them
as input parameters for my web methods - which works beautifully when
consuming the web service outside BT.


The problem is that the minOccurs value changes from 0 to 1 in this
process, eg:
In the eConnect.XSD we have a snippet:

<xs:complexType name="SOPTransactionType">
<xs:sequence>
:
:
:
<xs:element minOccurs="0" maxOccurs="1" name="taMdaUpdate_Items"
type="taMdaUpdate_Items" nillable="true" />
</xs:sequence>
</xs:complexType>


This generates the class in the ASMX:

[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified,
IsNullable=true)]
[System.Xml.Serialization.XmlArrayItemAttribute("taMdaUpdate",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public taMdaUpdate_ItemsTaMdaUpdate[] taMdaUpdate_Items;


Which reflects in the WSDL as:
<s:element minOccurs="1" maxOccurs="1" form="unqualified"
name="taMdaUpdate_Items" nillable="true"
type="s0:ArrayOfTaMdaUpdate_ItemsTaMdaUpdate" />

In BT the minOccurs must be set to "0" and the nillable set to "true"
or the BT mapping requires the "taMdaUpdate_Items" to be populated
with non-existant data...


I can change the code in the ASMX to:

[System.Xml.Serialization.XmlElementAttribute("taMdaUpdate_Items",
Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)]
public taMdaUpdate_ItemsTaMdaUpdate[] taMdaUpdate_Items;

Which then gives:
<s:element minOccurs="0" maxOccurs="unbounded" form="unqualified"
name="taMdaUpdate_Items" nillable="true"
type="s0:taMdaUpdate_ItemsTaMdaUpdate" />


This is only semi-OK as maxOccurs is now "unbounded" and there are
several thousand lines of code that must me maintained manually each
time the XSD is modified...

Any ideas on how I can get the schema to reflect correctly in the WSDL
(and preferably through the use of a utility)?

Thanx,
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,123
Latest member
Layne6498
Top