473,412 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

From Schema to class to WSDL, element attributes lost in translati

Using a schema, I created classes for my web service using the XSD.exe tool.
With the classes I then wrote a web service function, but the WSDL that is
generated has different minOccurs and maxOccurs values for my elements. I
can seem to figure out why this has changed or how to correct it. I can't
find any way to manually modify the classes for minOccurs or maxOccurs
either. It can happen whether I explicitly set the minOccurs/maxOccurs values
in the original schema or leave them as defaults. Any insight? Code samples
below. Thanks.

schema ---> xsd.exe ---> New class(es) ---> WSDL
'// ***** Original schema sample *****
<xsd:complexType name="MessageHeaderType">
<xsd:sequence>
<xsd:element name="MessageID" type="BLS-DB:MessageIDType"/>
<xsd:element name="Acknowledgement" type="BLS-DB:AcknowledgementType"
minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MessageIDType">
<xsd:sequence>
<xsd:element name="ID" type="xsd:normalizedString"/>
<xsd:element name="Timestamp" type="xsd:dateTime"/>
<xsd:element name="MessageType" type="BLS-DB:MessageNameType"/>
<xsd:element name="Sender" type="BLS-DB:ParticipantType"/>
</xsd:sequence>
</xsd:complexType>
'//***** Generated Class Sample *****
'<remarks/>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="M-TEST")> _
Public Class MessageHeaderType

'<remarks/>
Public MessageID As MessageIDType

'<remarks/>
Public Acknowledgement As AcknowledgementType
End Class

'<remarks/>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="M-TEST")> _
Public Class MessageIDType

'<remarks/>

<System.Xml.Serialization.XmlElementAttribute(Data Type:="normalizedString")> _
Public ID As String

'<remarks/>
Public Timestamp As Date

'<remarks/>
Public MessageType As MessageNameType

'<remarks/>
Public Sender As ParticipantType
End Class
'//***** Generated WSDL Sample *****
<s:complexType name="MessageHeaderType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="MessageID"
type="s1:MessageIDType" />
<s:element minOccurs="0" maxOccurs="1" name="Acknowledgement"
type="s1:AcknowledgementType" />
</s:sequence>
</s:complexType>
<s:complexType name="MessageIDType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ID"
type="s:normalizedString" />
<s:element minOccurs="1" maxOccurs="1" name="Timestamp"
type="s:dateTime" />
<s:element minOccurs="1" maxOccurs="1" name="MessageType"
type="s1:MessageNameType" />
<s:element minOccurs="1" maxOccurs="1" name="Sender"
type="s1:ParticipantType" />
</s:sequence>
</s:complexType>
Nov 23 '05 #1
4 2483
Did you have any success finding a solution to this problem? I am trying to
solve the same issue. Thanks.

"joewhitehair" wrote:
Using a schema, I created classes for my web service using the XSD.exe tool.
With the classes I then wrote a web service function, but the WSDL that is
generated has different minOccurs and maxOccurs values for my elements. I
can seem to figure out why this has changed or how to correct it. I can't
find any way to manually modify the classes for minOccurs or maxOccurs
either. It can happen whether I explicitly set the minOccurs/maxOccurs values
in the original schema or leave them as defaults. Any insight? Code samples
below. Thanks.

schema ---> xsd.exe ---> New class(es) ---> WSDL
'// ***** Original schema sample *****
<xsd:complexType name="MessageHeaderType">
<xsd:sequence>
<xsd:element name="MessageID" type="BLS-DB:MessageIDType"/>
<xsd:element name="Acknowledgement" type="BLS-DB:AcknowledgementType"
minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MessageIDType">
<xsd:sequence>
<xsd:element name="ID" type="xsd:normalizedString"/>
<xsd:element name="Timestamp" type="xsd:dateTime"/>
<xsd:element name="MessageType" type="BLS-DB:MessageNameType"/>
<xsd:element name="Sender" type="BLS-DB:ParticipantType"/>
</xsd:sequence>
</xsd:complexType>
'//***** Generated Class Sample *****
'<remarks/>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="M-TEST")> _
Public Class MessageHeaderType

'<remarks/>
Public MessageID As MessageIDType

'<remarks/>
Public Acknowledgement As AcknowledgementType
End Class

'<remarks/>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="M-TEST")> _
Public Class MessageIDType

'<remarks/>

<System.Xml.Serialization.XmlElementAttribute(Data Type:="normalizedString")> _
Public ID As String

'<remarks/>
Public Timestamp As Date

'<remarks/>
Public MessageType As MessageNameType

'<remarks/>
Public Sender As ParticipantType
End Class
'//***** Generated WSDL Sample *****
<s:complexType name="MessageHeaderType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="MessageID"
type="s1:MessageIDType" />
<s:element minOccurs="0" maxOccurs="1" name="Acknowledgement"
type="s1:AcknowledgementType" />
</s:sequence>
</s:complexType>
<s:complexType name="MessageIDType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ID"
type="s:normalizedString" />
<s:element minOccurs="1" maxOccurs="1" name="Timestamp"
type="s:dateTime" />
<s:element minOccurs="1" maxOccurs="1" name="MessageType"
type="s1:MessageNameType" />
<s:element minOccurs="1" maxOccurs="1" name="Sender"
type="s1:ParticipantType" />
</s:sequence>
</s:complexType>

Nov 23 '05 #2
The only solution I found was to modified by hand.
"Robert Rae" wrote:
Did you have any success finding a solution to this problem? I am trying to
solve the same issue. Thanks.

Nov 23 '05 #3
maxOccurs="1" I believe is the default.
So any introduction of that into your generated WSDL does not constitute a
change in meaning.

If you want maxOccurs= (more than 1) then you are talking about an array.

for minOccurs="0", if it is a value type, then you need to include a
property with a name like XxxxSpecified, as per the doc at:
http://msdn.microsoft.com/library/en...ClassTopic.asp

The change of minOccurs="0" in your schema, to minOccurs="1" in the
generated WSDL, comes about because of the "impedance mismatch" between the
..NET type system and the W3C XML Schema type system.
More on that, here:
http://www.25hoursaday.com/weblog/de...ate=2005-02-10
-Dino

"joewhitehair" <jo**********@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
The only solution I found was to modified by hand.
"Robert Rae" wrote:
Did you have any success finding a solution to this problem? I am trying
to
solve the same issue. Thanks.
>

Nov 23 '05 #4
Dino,

Do you have any suggestions with regard to my post on 3/8 "setting minoccurs
and maxoccurs with attributes"? I am trying to set the maxoccurs value of an
element to a specifc value.

Any help would be greatly appreciated.

"Dino Chiesa [Microsoft]" wrote:
maxOccurs="1" I believe is the default.
So any introduction of that into your generated WSDL does not constitute a
change in meaning.

If you want maxOccurs= (more than 1) then you are talking about an array.

for minOccurs="0", if it is a value type, then you need to include a
property with a name like XxxxSpecified, as per the doc at:
http://msdn.microsoft.com/library/en...ClassTopic.asp

The change of minOccurs="0" in your schema, to minOccurs="1" in the
generated WSDL, comes about because of the "impedance mismatch" between the
..NET type system and the W3C XML Schema type system.
More on that, here:
http://www.25hoursaday.com/weblog/de...ate=2005-02-10
-Dino

"joewhitehair" <jo**********@discussions.microsoft.com> wrote in message
news:7A**********************************@microsof t.com...
The only solution I found was to modified by hand.
"Robert Rae" wrote:
Did you have any success finding a solution to this problem? I am trying
to
solve the same issue. Thanks.
>


Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ffhansix | last post by:
Hi, I am having problems with generating a c# proxy class from a IBM websphere WSDL file, when running the wsdl.exe to create the c# proxy file command i recieve an error: Warning: one or...
2
by: Burak | last post by:
Hello, I have a web service that has a two user defined public classes. For sake of brevity, I'll write them as follows Public Class Service1 Public Class Class1 Public x as integer End...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
0
by: jennifer.perkins | last post by:
I've seen a couple posts by people having similar problems, but the suggested solutions I've tried so far haven't worked. I'm using a SOAP client in VB.Net (constructed by wsdl.exe) and the...
2
by: Danny Gagne | last post by:
I'm currently working an .net application (I can use 1.1 or 2.0 if needed) that needs to read a wsdl file and generate another piece of code that can use it. I'm encountering a problem where I...
1
by: Mike Logan | last post by:
I have a schema that defines my messages and objects. I then have a WSDL that defines the web services. I have my sample XSD, sample WSDL, and the code generated from WSDL.exe. In the generated...
3
by: Ivan Zuzak | last post by:
Hello, My Python application calls web services available on the Internet. The web service being called is defined through application user input. The Python built-in library allows access to...
0
by: Steven Bolard | last post by:
Hello, I am trying to port my .net 1.1 application to 2.0. I am using vs2005. I am trying to get my webservices to run and although i can compile them and and get wsdl and service descriptions...
2
by: =?Utf-8?B?TWlnaHR5IE1hcms=?= | last post by:
I'd like to generate my WebService interface from an XSD schema. Here's what I've done: 1. created a XML file 2. use the xsd.exe to generate the XSD: C:\>xsd my.xml 3. my.xsd is generated 4....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.