By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

WSDL.exe vs. "Add Web Reference"

P: n/a
I used WSDL.exe to generate a client side web proxy for a web service, called
the web service, got the results but an array returned by the web service is
not in the results.

However if I use "Add Web Reference" for the same service the same function
works appropriately.

Here is the client proxy generated from WSDL.exe

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("capeconnect:AppSec:AppSecPortType#getApp licationUsers",
RequestElementName:="getApplicationUsersRequest",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)> _
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlArrayAttribute("users "),
System.Xml.Serialization.XmlArrayItemAttribute("us ers", IsNullable:=false)>
user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0), user())
End Function

Here is the client proxy from "Add Web Reference"

<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("capeconnect:AppSec:AppSecPortType#getApp licationUsers",
RequestElementName:="getApplicationUsersRequest",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)> _
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlElementAttribute("use rs")> user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0),user())
End Function
What is the benefit of using WSDL.exe to generate the client compared to
"Add Web Reference".

Thanks, Mike L.
--
Mike Logan
Nov 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,

Visual Studio actually call the WSDL.exe in the background when
setting a webreference. Essentially there is no difference. The only
different is that when using the command line yourself you have more
contorl over the options you rcan use.

Hope this helps,

Marvin Smit.

On Tue, 25 Oct 2005 11:38:14 -0700, "Mike Logan"
<Mi*******@community.nospam> wrote:
I used WSDL.exe to generate a client side web proxy for a web service, called
the web service, got the results but an array returned by the web service is
not in the results.

However if I use "Add Web Reference" for the same service the same function
works appropriately.

Here is the client proxy generated from WSDL.exe

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:AppSec:AppSecPortType#getAp plicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)> _
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlArrayAttribute("user s"),
System.Xml.Serialization.XmlArrayItemAttribute("u sers", IsNullable:=false)>
user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0), user())
End Function

Here is the client proxy from "Add Web Reference"

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:AppSec:AppSecPortType#getAp plicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)> _
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlElementAttribute("us ers")> user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0),user())
End Function
What is the benefit of using WSDL.exe to generate the client compared to
"Add Web Reference".

Thanks, Mike L.

Nov 23 '05 #2

P: n/a
Hi Mike,

As Marvin has mentioned, the VS.NET IDE actually also use the wsdl.exe or
the same code to generate the clientside proxy but may use some default
setting for some of the wsdl.exe's optional parameters. Is the problem also
occuring on other webmethod?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: Marvin Smit <ma*********@gmail.com>
Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: Re: WSDL.exe vs. "Add Web Reference"
Date: Wed, 26 Oct 2005 09:05:33 +0200
Message-ID: <2k********************************@4ax.com>
References: <38**********************************@microsoft.co m>
X-Newsreader: Forte Free Agent 3.0/32.763
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: ab***@chello.nl
Organization: chello.nl
Lines: 58
NNTP-Posting-Host: 62.194.138.116 (62.194.138.116)
NNTP-Posting-Date: Wed, 26 Oct 2005 09:03:37 +0200
X-Trace: d3f40435f2a499b672fd104598
Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!83.128.0.12.MISMATCH!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xind
i.nntp.kabelfoon.nl!216.196.110.149.MISMATCH!borde r2.nntp.ams.giganews.com!n
ntp.giganews.com!amsnews11.chello.com!amsnews14.ch ello.com!news.chello.nl.PO
STED!not-for-mail
microsoft.public.dotnet.framework.webservices:8359
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi,

Visual Studio actually call the WSDL.exe in the background when
setting a webreference. Essentially there is no difference. The only
different is that when using the command line yourself you have more
contorl over the options you rcan use.

Hope this helps,

Marvin Smit.

On Tue, 25 Oct 2005 11:38:14 -0700, "Mike Logan"
<Mi*******@community.nospam> wrote:
I used WSDL.exe to generate a client side web proxy for a web service, calledthe web service, got the results but an array returned by the web service isnot in the results.

However if I use "Add Web Reference" for the same service the same functionworks appropriately.

Here is the client proxy generated from WSDL.exe

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App Sec:AppSecPortType#getApplicationUsers",RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)> _ Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlArrayAttribute("user s"),
System.Xml.Serialization.XmlArrayItemAttribute("u sers", IsNullable:=false)>user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0), user())
End Function

Here is the client proxy from "Add Web Reference"

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App Sec:AppSecPortType#getApplicationUsers",RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)> _ Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlElementAttribute("us ers")> user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0),user())
End Function
What is the benefit of using WSDL.exe to generate the client compared to
"Add Web Reference".

Thanks, Mike L.


Nov 23 '05 #3

P: n/a
This problem doesn't occur on a method that doesn't return an array of
"complexTypes". I have several other methods that return different types of
complexTypes, and those methods also work in either scenario.

For example this complexType (user):

<xs:complexType name="user">
<xs:sequence>
<xs:element name="userid" type="xs:int" />
<xs:element name="firstname" type="xs:string" />
<xs:element name="middlename" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
<xs:element name="suffix" type="xs:string" />
</xs:sequence>
</xs:complexType>

Is made into a class by WSDL, like this:

Public Class user

Public userid As Integer
Public firstname As String
Public middlename As String
ublic lastname As String
Public suffix As String

End Class

The resulting method for returning an array of these was listed in my first
post. I am trying to use the "contract first" method for design of the web
service. I created an XSD with all my types and messages (one incoming and
one outgoing) for each operation. I them created a WSDL using the XSD. The
difference was that I ran WSDL.exe on a real WSDL, and "Add Web Reference"
ran it on a "asmx?WSDL" reference. I generated the "server stubs" using
WSDL.exe i.e.

wsdl.exe /server /out:Server.vb /l:VB AppSec.WSDL AppSec.XSD

Then I placed this file in an "Empty Web Project", added a Web Service, made
the new Web Service class inherit the "Server" stub class, override the
methods, and that was it.

Enough rambling for me. If I do all these steps correctly the client should
turn out the same each way. What I am saying for these scenarios

- A server stub is generated from a WSDL (real one), and the client is also
generated from a WSDL (real one).
- A server stub is generated from a WSDL (real one), and the client is
generated via "Add Web Reference".

The client should be the same in each scenario, correct?

Well that question makes me wonder if the WSDL file is different from the
ASMX?WSDL

I did a quick comparison of these two:

- In my real WSDL each message was post fixed with "Request" (for incoming
messages, and "Response" (for outgoing messages). In the ASMX?WSDL version
all messages were posted fixed with "SoapIn" and "SoapOut" respectively.
- In my original WSDL, the schema was defined in an XSD file. In the
ASMX?WSDL version the schema was embedded.

Other than that no real difference. OK, what is the difference in the
outgoing message of the operation that returns an array of the "user"
complexType.

In my XSD here is the relevant parts.

The outgoing message:

<xs:element name="getApplicationUsersResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="users" type="userList" />
</xs:sequence>
</xs:complexType>
</xs:element>

complexType userList:

<xs:complexType name="userList">
<xs:sequence>
<xs:element name="users" type="user" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>

However in the ASMX?WSDL the outgoing message is defined as this:

<s:element name="getApplicationUsersResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="users"
type="s0:user" />
</s:sequence>
</s:complexType>
</s:element>

I guess this is the difference?? Should my XSD be like the ASMX?WSDL
version of "getApplicationUsersResponse"? I will do some testing but if
anyone can shed any light that would be appreciated.

Also, is there a guide on controling the output of the ASMX?WSDL somewhere?

Thanks for the help Marvin and Steven.
Thanks,
--
Mike Logan
"Steven Cheng[MSFT]" wrote:
Hi Mike,

As Marvin has mentioned, the VS.NET IDE actually also use the wsdl.exe or
the same code to generate the clientside proxy but may use some default
setting for some of the wsdl.exe's optional parameters. Is the problem also
occuring on other webmethod?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: Marvin Smit <ma*********@gmail.com>
Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: Re: WSDL.exe vs. "Add Web Reference"
Date: Wed, 26 Oct 2005 09:05:33 +0200
Message-ID: <2k********************************@4ax.com>
References: <38**********************************@microsoft.co m>
X-Newsreader: Forte Free Agent 3.0/32.763
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: ab***@chello.nl
Organization: chello.nl
Lines: 58
NNTP-Posting-Host: 62.194.138.116 (62.194.138.116)
NNTP-Posting-Date: Wed, 26 Oct 2005 09:03:37 +0200
X-Trace: d3f40435f2a499b672fd104598
Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!83.128.0.12.MISMATCH!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xind
i.nntp.kabelfoon.nl!216.196.110.149.MISMATCH!borde r2.nntp.ams.giganews.com!n
ntp.giganews.com!amsnews11.chello.com!amsnews14.ch ello.com!news.chello.nl.PO
STED!not-for-mail
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.webservices:8359
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi,

Visual Studio actually call the WSDL.exe in the background when
setting a webreference. Essentially there is no difference. The only
different is that when using the command line yourself you have more
contorl over the options you rcan use.

Hope this helps,

Marvin Smit.

On Tue, 25 Oct 2005 11:38:14 -0700, "Mike Logan"
<Mi*******@community.nospam> wrote:
I used WSDL.exe to generate a client side web proxy for a web service,

called
the web service, got the results but an array returned by the web service

is
not in the results.

However if I use "Add Web Reference" for the same service the same

function
works appropriately.

Here is the client proxy generated from WSDL.exe

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App

Sec:AppSecPortType#getApplicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>

_
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlArrayAttribute("user s"),
System.Xml.Serialization.XmlArrayItemAttribute("u sers",

IsNullable:=false)>
user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0), user())
End Function

Here is the client proxy from "Add Web Reference"

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App

Sec:AppSecPortType#getApplicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>

_
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlElementAttribute("us ers")> user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0),user())
End Function
What is the benefit of using WSDL.exe to generate the client compared to
"Add Web Reference".

Thanks, Mike L

Nov 23 '05 #4

P: n/a
That was it. Chaning my outgoing message in the XSD from this:

<xs:element name="getApplicationUsersResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="users" type="userList" />
</xs:sequence>
</xs:complexType>
</xs:element>

To this:

<xs:complexType name="userList">
<xs:sequence>
<xs:element name="users" type="user" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>

and the now the client works correctly....!

--
Mike Logan
"Mike Logan" wrote:
This problem doesn't occur on a method that doesn't return an array of
"complexTypes". I have several other methods that return different types of
complexTypes, and those methods also work in either scenario.

For example this complexType (user):

<xs:complexType name="user">
<xs:sequence>
<xs:element name="userid" type="xs:int" />
<xs:element name="firstname" type="xs:string" />
<xs:element name="middlename" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
<xs:element name="suffix" type="xs:string" />
</xs:sequence>
</xs:complexType>

Is made into a class by WSDL, like this:

Public Class user

Public userid As Integer
Public firstname As String
Public middlename As String
ublic lastname As String
Public suffix As String

End Class

The resulting method for returning an array of these was listed in my first
post. I am trying to use the "contract first" method for design of the web
service. I created an XSD with all my types and messages (one incoming and
one outgoing) for each operation. I them created a WSDL using the XSD. The
difference was that I ran WSDL.exe on a real WSDL, and "Add Web Reference"
ran it on a "asmx?WSDL" reference. I generated the "server stubs" using
WSDL.exe i.e.

wsdl.exe /server /out:Server.vb /l:VB AppSec.WSDL AppSec.XSD

Then I placed this file in an "Empty Web Project", added a Web Service, made
the new Web Service class inherit the "Server" stub class, override the
methods, and that was it.

Enough rambling for me. If I do all these steps correctly the client should
turn out the same each way. What I am saying for these scenarios

- A server stub is generated from a WSDL (real one), and the client is also
generated from a WSDL (real one).
- A server stub is generated from a WSDL (real one), and the client is
generated via "Add Web Reference".

The client should be the same in each scenario, correct?

Well that question makes me wonder if the WSDL file is different from the
ASMX?WSDL

I did a quick comparison of these two:

- In my real WSDL each message was post fixed with "Request" (for incoming
messages, and "Response" (for outgoing messages). In the ASMX?WSDL version
all messages were posted fixed with "SoapIn" and "SoapOut" respectively.
- In my original WSDL, the schema was defined in an XSD file. In the
ASMX?WSDL version the schema was embedded.

Other than that no real difference. OK, what is the difference in the
outgoing message of the operation that returns an array of the "user"
complexType.

In my XSD here is the relevant parts.

The outgoing message:

<xs:element name="getApplicationUsersResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="users" type="userList" />
</xs:sequence>
</xs:complexType>
</xs:element>

complexType userList:

<xs:complexType name="userList">
<xs:sequence>
<xs:element name="users" type="user" maxOccurs="unbounded" minOccurs="0" />
</xs:sequence>
</xs:complexType>

However in the ASMX?WSDL the outgoing message is defined as this:

<s:element name="getApplicationUsersResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="users"
type="s0:user" />
</s:sequence>
</s:complexType>
</s:element>

I guess this is the difference?? Should my XSD be like the ASMX?WSDL
version of "getApplicationUsersResponse"? I will do some testing but if
anyone can shed any light that would be appreciated.

Also, is there a guide on controling the output of the ASMX?WSDL somewhere?

Thanks for the help Marvin and Steven.
Thanks,
--
Mike Logan
"Steven Cheng[MSFT]" wrote:
Hi Mike,

As Marvin has mentioned, the VS.NET IDE actually also use the wsdl.exe or
the same code to generate the clientside proxy but may use some default
setting for some of the wsdl.exe's optional parameters. Is the problem also
occuring on other webmethod?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: Marvin Smit <ma*********@gmail.com>
Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: Re: WSDL.exe vs. "Add Web Reference"
Date: Wed, 26 Oct 2005 09:05:33 +0200
Message-ID: <2k********************************@4ax.com>
References: <38**********************************@microsoft.co m>
X-Newsreader: Forte Free Agent 3.0/32.763
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: ab***@chello.nl
Organization: chello.nl
Lines: 58
NNTP-Posting-Host: 62.194.138.116 (62.194.138.116)
NNTP-Posting-Date: Wed, 26 Oct 2005 09:03:37 +0200
X-Trace: d3f40435f2a499b672fd104598
Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!83.128.0.12.MISMATCH!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xind
i.nntp.kabelfoon.nl!216.196.110.149.MISMATCH!borde r2.nntp.ams.giganews.com!n
ntp.giganews.com!amsnews11.chello.com!amsnews14.ch ello.com!news.chello.nl.PO
STED!not-for-mail
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.webservices:8359
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi,

Visual Studio actually call the WSDL.exe in the background when
setting a webreference. Essentially there is no difference. The only
different is that when using the command line yourself you have more
contorl over the options you rcan use.

Hope this helps,

Marvin Smit.

On Tue, 25 Oct 2005 11:38:14 -0700, "Mike Logan"
<Mi*******@community.nospam> wrote:
I used WSDL.exe to generate a client side web proxy for a web service,

called
the web service, got the results but an array returned by the web service

is
not in the results.

However if I use "Add Web Reference" for the same service the same

function
works appropriately.

Here is the client proxy generated from WSDL.exe

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App

Sec:AppSecPortType#getApplicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>

_
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlArrayAttribute("user s"),
System.Xml.Serialization.XmlArrayItemAttribute("u sers",

IsNullable:=false)>
user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0), user())
End Function

Here is the client proxy from "Add Web Reference"

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App

Sec:AppSecPortType#getApplicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>

_
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlElementAttribute("us ers")> user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0),user())
End Function
What is the benefit of using WSDL.exe to generate the client compared to
"Add Web Reference".

Thanks, Mike L

Nov 23 '05 #5

P: n/a
Thanks for your further followup Mike,

Glad that you're got it working now. If there're any further questions
later, please feel free to post here.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
Thread-Topic: WSDL.exe vs. "Add Web Reference"
thread-index: AcXaKz/FNXE+LT1tQcGN5cGeXMBAnQ==
X-WBNR-Posting-Host: 165.176.240.10
From: "=?Utf-8?B?TWlrZSBMb2dhbg==?=" <Mi*******@community.nospam>
References: <38**********************************@microsoft.co m>
<2k********************************@4ax.com>
<f$**************@TK2MSFTNGXA01.phx.gbl>
<D9**********************************@microsoft.co m>
Subject: Re: WSDL.exe vs. "Add Web Reference"
Date: Wed, 26 Oct 2005 05:46:13 -0700
Lines: 249
Message-ID: <8E**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl
microsoft.public.dotnet.framework.webservices:8362
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

That was it. Chaning my outgoing message in the XSD from this:

<xs:element name="getApplicationUsersResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="users" type="userList" />
</xs:sequence>
</xs:complexType>
</xs:element>

To this:

<xs:complexType name="userList">
<xs:sequence>
<xs:element name="users" type="user" maxOccurs="unbounded" minOccurs="0"
/>
</xs:sequence>
</xs:complexType>

and the now the client works correctly....!

--
Mike Logan
"Mike Logan" wrote:
This problem doesn't occur on a method that doesn't return an array of
"complexTypes". I have several other methods that return different types of complexTypes, and those methods also work in either scenario.

For example this complexType (user):

<xs:complexType name="user">
<xs:sequence>
<xs:element name="userid" type="xs:int" />
<xs:element name="firstname" type="xs:string" />
<xs:element name="middlename" type="xs:string" />
<xs:element name="lastname" type="xs:string" />
<xs:element name="suffix" type="xs:string" />
</xs:sequence>
</xs:complexType>

Is made into a class by WSDL, like this:

Public Class user

Public userid As Integer
Public firstname As String
Public middlename As String
ublic lastname As String
Public suffix As String

End Class

The resulting method for returning an array of these was listed in my first post. I am trying to use the "contract first" method for design of the web service. I created an XSD with all my types and messages (one incoming and one outgoing) for each operation. I them created a WSDL using the XSD. The difference was that I ran WSDL.exe on a real WSDL, and "Add Web Reference" ran it on a "asmx?WSDL" reference. I generated the "server stubs" using
WSDL.exe i.e.

wsdl.exe /server /out:Server.vb /l:VB AppSec.WSDL AppSec.XSD

Then I placed this file in an "Empty Web Project", added a Web Service, made the new Web Service class inherit the "Server" stub class, override the
methods, and that was it.

Enough rambling for me. If I do all these steps correctly the client should turn out the same each way. What I am saying for these scenarios

- A server stub is generated from a WSDL (real one), and the client is also generated from a WSDL (real one).
- A server stub is generated from a WSDL (real one), and the client is
generated via "Add Web Reference".

The client should be the same in each scenario, correct?

Well that question makes me wonder if the WSDL file is different from the
ASMX?WSDL

I did a quick comparison of these two:

- In my real WSDL each message was post fixed with "Request" (for incoming messages, and "Response" (for outgoing messages). In the ASMX?WSDL version all messages were posted fixed with "SoapIn" and "SoapOut" respectively.
- In my original WSDL, the schema was defined in an XSD file. In the
ASMX?WSDL version the schema was embedded.

Other than that no real difference. OK, what is the difference in the
outgoing message of the operation that returns an array of the "user"
complexType.

In my XSD here is the relevant parts.

The outgoing message:

<xs:element name="getApplicationUsersResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="users" type="userList" />
</xs:sequence>
</xs:complexType>
</xs:element>

complexType userList:

<xs:complexType name="userList">
<xs:sequence>
<xs:element name="users" type="user" maxOccurs="unbounded" minOccurs="0" /> </xs:sequence>
</xs:complexType>

However in the ASMX?WSDL the outgoing message is defined as this:

<s:element name="getApplicationUsersResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="users"
type="s0:user" />
</s:sequence>
</s:complexType>
</s:element>

I guess this is the difference?? Should my XSD be like the ASMX?WSDL
version of "getApplicationUsersResponse"? I will do some testing but if
anyone can shed any light that would be appreciated.

Also, is there a guide on controling the output of the ASMX?WSDL somewhere?
Thanks for the help Marvin and Steven.
Thanks,
--
Mike Logan
"Steven Cheng[MSFT]" wrote:
Hi Mike,

As Marvin has mentioned, the VS.NET IDE actually also use the wsdl.exe or the same code to generate the clientside proxy but may use some default
setting for some of the wsdl.exe's optional parameters. Is the problem also occuring on other webmethod?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
From: Marvin Smit <ma*********@gmail.com>
Newsgroups: microsoft.public.dotnet.framework.webservices
Subject: Re: WSDL.exe vs. "Add Web Reference"
Date: Wed, 26 Oct 2005 09:05:33 +0200
Message-ID: <2k********************************@4ax.com>
References: <38**********************************@microsoft.co m>
X-Newsreader: Forte Free Agent 3.0/32.763
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Complaints-To: ab***@chello.nl
Organization: chello.nl
Lines: 58
NNTP-Posting-Host: 62.194.138.116 (62.194.138.116)
NNTP-Posting-Date: Wed, 26 Oct 2005 09:03:37 +0200
X-Trace: d3f40435f2a499b672fd104598
Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli ne.de!83.128.0.12.MISMATCH!news-out2.kabelfoon.nl!newsfeed.kabelfoon.nl!xind i.nntp.kabelfoon.nl!216.196.110.149.MISMATCH!borde r2.nntp.ams.giganews.com!n ntp.giganews.com!amsnews11.chello.com!amsnews14.ch ello.com!news.chello.nl.PO STED!not-for-mail
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.webservices:8359
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi,

Visual Studio actually call the WSDL.exe in the background when
setting a webreference. Essentially there is no difference. The only
different is that when using the command line yourself you have more
contorl over the options you rcan use.

Hope this helps,

Marvin Smit.

On Tue, 25 Oct 2005 11:38:14 -0700, "Mike Logan"
<Mi*******@community.nospam> wrote:
I used WSDL.exe to generate a client side web proxy for a web service,

called
the web service, got the results but an array returned by the web service
is
not in the results.

However if I use "Add Web Reference" for the same service the same

function
works appropriately.

Here is the client proxy generated from WSDL.exe

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App
Sec:AppSecPortType#getApplicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,

ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>
_
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlArrayAttribute("user s"),
System.Xml.Serialization.XmlArrayItemAttribute("u sers",

IsNullable:=false)>
user()
Dim results() As Object = Me.Invoke("getApplicationUsers", New
Object(-1) {})
Return CType(results(0), user())
End Function

Here is the client proxy from "Add Web Reference"

<System.Web.Services.Protocols.SoapDocumentMethod Attribute("capeconnect:App
Sec:AppSecPortType#getApplicationUsers",
RequestElementName:="getApplicationUsersRequest ",
RequestNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
ResponseNamespace:="http://www.vita.virginia.gov/xml/xsd/AppSec1.xsd",
Use:=System.Web.Services.Description.SoapBindingU se.Literal,

ParameterStyle:=System.Web.Services.Protocols.Soa pParameterStyle.Wrapped)>
_
Public Function getApplicationUsers() As
<System.Xml.Serialization.XmlElementAttribute("us ers")> user()
Dim results() As Object = Me.Invoke("getApplicationUsers",

NewObject(-1) {})
Return CType(results(0),user())
End Function
What is the benefit of using WSDL.exe to generate the client compared to"Add Web Reference".

Thanks, Mike L


Nov 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.