473,405 Members | 2,262 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,405 software developers and data experts.

Schema in WSDL File

I have been experimenting with .Net web services for a while and have a few
questions about the schema in the automatically generated WSDL file, and
whether its content can be manipulated programatically.

First of all, I created several very simple test methods in my web service:

<WebMethod()_
Public Function TestString(ByVal test As String) As String
Return "The value passed was " + test
End Function

<WebMethod()_
Public Function TestInteger(ByVal test As Integer) As String
Return "The value passed was " + CStr(test)
End Function

When I look at the schema that was generated for these methods, I find the
following:

<s:element name="TestString">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="test" type="s:string"
/>
</s:sequence>
</s:complexType>
</s:element>

<s:element name="TestInteger">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="test" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>

My question is - why did it specify a minOccurs of 0 for TestString, making
the argument optional, but specified a minOccurs of 1 for TestInteger? If a
method takes an argument, why is it making it optional for strings? Is it
possible to specify that a minOccurs of 1 should be used somewhere in code?

Also, if you want to validate against a custom schema type, say for a social
security number, how would you incorporate that into the automatically
generated WSDL file/schema? I read the article about customizing the
generation of service descriptions at

http://msdn2.microsoft.com/en-us/library/f9hatst6.aspx

but am not clear if the functionality they demonstrate can be used to do
what I want to do.

If it turns out that I cannot get what I want out of the automatically
generated WSDL/schema file, how could I then substitute my own file without
it being overwritten by the one being generated automatically?

Thanks,
Steve C.
Oct 11 '06 #1
2 2015
"SteveChamp" <St********@discussions.microsoft.comwrote in message
news:ED**********************************@microsof t.com...
>I have been experimenting with .Net web services for a while and have a few
questions about the schema in the automatically generated WSDL file, and
whether its content can be manipulated programatically.

First of all, I created several very simple test methods in my web
service:

<WebMethod()_
Public Function TestString(ByVal test As String) As String
Return "The value passed was " + test
End Function

<WebMethod()_
Public Function TestInteger(ByVal test As Integer) As String
Return "The value passed was " + CStr(test)
End Function

When I look at the schema that was generated for these methods, I find the
following:

<s:element name="TestString">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="test" type="s:string"
/>
</s:sequence>
</s:complexType>
</s:element>

<s:element name="TestInteger">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="test" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>

My question is - why did it specify a minOccurs of 0 for TestString,
making
the argument optional, but specified a minOccurs of 1 for TestInteger? If
a
method takes an argument, why is it making it optional for strings? Is it
possible to specify that a minOccurs of 1 should be used somewhere in
code?

Also, if you want to validate against a custom schema type, say for a
social
security number, how would you incorporate that into the automatically
generated WSDL file/schema? I read the article about customizing the
generation of service descriptions at

http://msdn2.microsoft.com/en-us/library/f9hatst6.aspx

but am not clear if the functionality they demonstrate can be used to do
what I want to do.

If it turns out that I cannot get what I want out of the automatically
generated WSDL/schema file, how could I then substitute my own file
without
it being overwritten by the one being generated automatically?
Steve,

The WSDL is only generated automatically if you allow it to be. If you use:

<webServices>
<protocols>
<remove name="Documentation"></remove>
</protocols>
</webServices>

in your web.config, then service.asmx?WSDL will not return a generated WSDL.
You can then host your WSDL wherever you like, or not at all.

As to the minOccurs="0", this is only a guess, but, as a reference type,
your string could be ommitted by returning null. In terms of XML Schema,
null is not a valid string. One way to represent it would be for it to be
absent entirely.

John
Oct 11 '06 #2
John,

Thanks very much for the info. I may end up having to build my own WSDL from
scratch.

Steve C.
Oct 11 '06 #3

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

Similar topics

2
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my...
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...
12
by: Whoever | last post by:
Hi, I'm trying to return an XmlDocument or XmlNode converted from a typed dataset. public XmlNode whatever() { MyTypedDataSet ds = new MyTypedDataSet(); return new XmlDataDocument(ds); }
5
by: Jeff | last post by:
We are using .Net and the wsdl Utility to generate proxies to consume web services built using the BEA toolset. The data architects on the BEA side create XML schemas with various entities in...
1
by: drb | last post by:
Hi, Newbie question #2 - hope that's OK! I'm trying to create a WSDL file using one or more XSD schema files. While WSDL.exe doesn't seem to support the XSD "import" function, if I include a...
0
by: Jimmy L | last post by:
to validate a WSDL is a valid one do i just need 1) WSDL schema - http://schemas.xmlsoap.org/wsdl/ 2) WSDL document input these 2 document into a XML editor just like validate XML doc with...
1
by: =?Utf-8?B?RmlsaXBwbyBCZXR0aW5hZ2xpbw==?= | last post by:
I am trying to use a web service that publishes a WSDL with external schema (.XSD files), unfortunately the .NET wsdl.exe is not able to generate the proxy class for it. It seems that wsdl.exe...
1
by: Christof Winter | last post by:
I am trying to use a webservice with SOAPpy: import SOAPpy intact_wsdl = "http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl" intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl) The...
0
by: mmaslar | last post by:
Can Visual Studio ('05 or '08) generate a WSDL file with an external Schema file? eg. Instead of placing the schema within the WSDL file, generate it in a separate XSD file? In other words......
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
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.