473,386 Members | 1,969 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,386 software developers and data experts.

WSDL generates with wrong "minOccurs" values

Using the XSD.exe tool, I created a number of classes from my XSD file.
When I generate the WSDL for my web service, the schema does not have
the proper Occurance constraints for the attributes. In this example,
the MessageID element should always occur (minOccur=1, maxOccur=1), but
the WSDL generates minOccur=0. I can't pinpoint why this is happening
and I
can't find a may to force this in the code either. Anyone have any
insight? This is happening with a large number of elements, I just
provide one example below.

Code of the schema, classes, and WSDL excerpts below.

Thanks.

//********** Autogenerated Classes - Begin

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="BLS-DB")> _
Public Class MessageHeaderType

'<remarks/>
Public MessageID As MessageIDType

'<remarks/>
Public Acknowledgement As AcknowledgementType
End Class
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="BLS-DB")> _
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

//********** Autogenerated Classes - End

//************************************************** ************************

//********** Schema Excerpt - Begin
<?xml version="1.0" encoding="utf-8" ?>
- <definitions xmlns:s1="BLS-DB"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://MY_WEBSERVER/schemas/BLS-DB.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="BLS-DB"
xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://4.21.130.175/schemas/BLS-DB.xsd">
<s:import namespace="BLS-DB" />

<!-- PORTION OF SCHEMA SNIPPED FOR CLARITY -->

<xsd:complexType name="MessageHeaderType">
<xsd:sequence>
<xsd:element name="MessageID" type="BLS-DB:MessageIDType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Acknowledgement"
type="BLS-DB:AcknowledgementType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="MessageIDType">
<xsd:sequence>
<xsd:element name="ID" type="xsd:normalizedString" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Timestamp" type="xsd:dateTime" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="MessageType" type="BLS-DB:MessageNameType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Sender" type="BLS-DB:ParticipantType"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

//********** Schema File Excerpt - End

//************************************************** ************************

//********** WSDL Excerpt - Begin

- <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>

//********** WSDL Excerpt - End

Nov 12 '05 #1
2 6876
can you better explain what it is that you are doing,
and what you get,
and what you expect to get?

It seems you start with a WSDL that has minOccurs="1" and maxOccurs="1" on
some number of elements.
Then you generate VB code from that. Everything looks fine.
Then what? do you then generate WSDL from that (generated) VB code? and
that WSDL is the problem? if so, Why generate it? Why not use the
original WSDL ?

-D

<jo**********@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Using the XSD.exe tool, I created a number of classes from my XSD file.
When I generate the WSDL for my web service, the schema does not have
the proper Occurance constraints for the attributes. In this example,
the MessageID element should always occur (minOccur=1, maxOccur=1), but
the WSDL generates minOccur=0. I can't pinpoint why this is happening
and I
can't find a may to force this in the code either. Anyone have any
insight? This is happening with a large number of elements, I just
provide one example below.

Code of the schema, classes, and WSDL excerpts below.

Thanks.

//********** Autogenerated Classes - Begin

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="BLS-DB")> _
Public Class MessageHeaderType

'<remarks/>
Public MessageID As MessageIDType

'<remarks/>
Public Acknowledgement As AcknowledgementType
End Class
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="BLS-DB")> _
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

//********** Autogenerated Classes - End

//************************************************** ************************

//********** Schema Excerpt - Begin
<?xml version="1.0" encoding="utf-8" ?>
- <definitions xmlns:s1="BLS-DB"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://MY_WEBSERVER/schemas/BLS-DB.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="BLS-DB"
xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://4.21.130.175/schemas/BLS-DB.xsd">
<s:import namespace="BLS-DB" />

<!-- PORTION OF SCHEMA SNIPPED FOR CLARITY -->

<xsd:complexType name="MessageHeaderType">
<xsd:sequence>
<xsd:element name="MessageID" type="BLS-DB:MessageIDType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Acknowledgement"
type="BLS-DB:AcknowledgementType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="MessageIDType">
<xsd:sequence>
<xsd:element name="ID" type="xsd:normalizedString" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Timestamp" type="xsd:dateTime" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="MessageType" type="BLS-DB:MessageNameType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Sender" type="BLS-DB:ParticipantType"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

//********** Schema File Excerpt - End

//************************************************** ************************

//********** WSDL Excerpt - Begin

- <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>

//********** WSDL Excerpt - End

Nov 12 '05 #2
It seems pretty clear to me!
There is no .Net attribute for controlling the min/maxoccurs schema
attribute, is it?

So when you declare public fields that are reference types
and then generate a schema definition from the class definition you get all
these fields
with minoccurs="0" which means that they are optional.
It happens even for string fields which is quite rudiculus! I have a bunch
of classes
with string fields are not optionall at all.
How do you force the minoccurs=1 for thes type of fields?

"Dino Chiesa [Microsoft]" wrote:
can you better explain what it is that you are doing,
and what you get,
and what you expect to get?

It seems you start with a WSDL that has minOccurs="1" and maxOccurs="1" on
some number of elements.
Then you generate VB code from that. Everything looks fine.
Then what? do you then generate WSDL from that (generated) VB code? and
that WSDL is the problem? if so, Why generate it? Why not use the
original WSDL ?

-D

<jo**********@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Using the XSD.exe tool, I created a number of classes from my XSD file.
When I generate the WSDL for my web service, the schema does not have
the proper Occurance constraints for the attributes. In this example,
the MessageID element should always occur (minOccur=1, maxOccur=1), but
the WSDL generates minOccur=0. I can't pinpoint why this is happening
and I
can't find a may to force this in the code either. Anyone have any
insight? This is happening with a large number of elements, I just
provide one example below.

Code of the schema, classes, and WSDL excerpts below.

Thanks.

//********** Autogenerated Classes - Begin

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="BLS-DB")> _
Public Class MessageHeaderType

'<remarks/>
Public MessageID As MessageIDType

'<remarks/>
Public Acknowledgement As AcknowledgementType
End Class
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="BLS-DB")> _
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

//********** Autogenerated Classes - End

//************************************************** ************************

//********** Schema Excerpt - Begin
<?xml version="1.0" encoding="utf-8" ?>
- <definitions xmlns:s1="BLS-DB"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://MY_WEBSERVER/schemas/BLS-DB.xsd"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="BLS-DB"
xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://4.21.130.175/schemas/BLS-DB.xsd">
<s:import namespace="BLS-DB" />

<!-- PORTION OF SCHEMA SNIPPED FOR CLARITY -->

<xsd:complexType name="MessageHeaderType">
<xsd:sequence>
<xsd:element name="MessageID" type="BLS-DB:MessageIDType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Acknowledgement"
type="BLS-DB:AcknowledgementType" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="MessageIDType">
<xsd:sequence>
<xsd:element name="ID" type="xsd:normalizedString" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="Timestamp" type="xsd:dateTime" minOccurs="1"
maxOccurs="1"/>
<xsd:element name="MessageType" type="BLS-DB:MessageNameType"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="Sender" type="BLS-DB:ParticipantType"
minOccurs="1" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>

//********** Schema File Excerpt - End

//************************************************** ************************

//********** WSDL Excerpt - Begin

- <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>

//********** WSDL Excerpt - End


Nov 12 '05 #3

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

Similar topics

0
by: Nick Caldwell | last post by:
Y'all, Problem: Reading complex data types returned from WSDL I'll present this in 3 sections. 1. Output of WSDL parser on Google API 2. Output of WSDL parser on Custom API 3. WSDL parser...
3
by: Mike | last post by:
I have created a web service for a client to consume. The element I am having trouble with is, as described in their WSDL: <xsd:element minOccurs="0" ref="LocalData" maxOccurs="1" /> ...
0
by: John Jenkins | last post by:
Hi, can someone tell me why the following scneario occurs. With the nillable attribute set to true on an element that has min occurs set to zero, I generate a class. As expected this adds the...
0
by: John Jenkins | last post by:
Hi, can someone tell me why the following scneario occurs. With the nillable attribute set to true on an element that has min occurs set to zero, I generate a class. As expected this adds the...
0
by: John Jenkins | last post by:
Hi, apologies for tghe repost, but I cannot get an answer to my question and I have noe posted on 7 news groups. Can someone tell me why the following scneario occurs. With the nillable attribute...
0
by: jjouett | last post by:
I'm defining a C# WebMethod where the argument has properties that are mandatory: public bool PerformTask(SimpleObject simpleObject) { .... } where SimpleObject is as follows:
2
by: NoNickname | last post by:
Right now I'm getting this in the wsdl: <s:element minOccurs="0" maxOccurs="1" name="Items" type="tns:ArrayOfMyClass" /> I would like to get minOccurs="1" for this webmethod: public...
2
by: IsValidUN | last post by:
If an xsd indicates that an element within a doc is minOccurs="0" and you're using xsl to transform the doc do you have to do some kind of check prior to doing a transform on the element? For...
1
by: mato81 | last post by:
Hi all! I am a newbie to WSDL. I have a questions which has been driving me crazy... If I would have a WSDL with a types element somewhat like below, what is the point of the third last row...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.