Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2007

Tip: Looking for answers? Try searching our database.

Client code w/wsdl.exe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nick K. - 14 Mar 2007 16:06 GMT
I use wsdl.exe to generate client code to call a web service. The actual web
service is generated with the BizTalk Web Services Publishing Wizard.

I'm not sure this is particular to the BizTalk code but the calls to web
methods pass parameters by ref so that I have to call it like:

XmlDocument doc = new XmlDocument();

doc.LoadXml(message);

XmlNode node = doc.DocumentElement.ParentNode;

ws.MyMethod(ref node);

I attempt to modify the generated client code so that the parameter is not
passed by ref and is instead returned as a response but I keep getting an
"object not referenced" error.

Is there a way to tell wsdl.exe to not generate a "ref" parameter?

Is the problem I describe just because this is calling a BizTalk web service
or have others seen this?
John Saunders - 14 Mar 2007 16:26 GMT
>I use wsdl.exe to generate client code to call a web service. The actual
>web service is generated with the BizTalk Web Services Publishing Wizard.
[quoted text clipped - 18 lines]
> Is the problem I describe just because this is calling a BizTalk web
> service or have others seen this?

If WSDL.EXE is generating a "ref" parameter, then the chances are that it
needs to be a "ref" parameter.

Have you taken a look into the WSDL file to see what it says about this
parameter?

John
Nick K. - 14 Mar 2007 16:55 GMT
I'm not sure I see anything so I will just show the entire wsdl, hopefully
someone can find something that will show me what to change in the wsdl to
change so that I not pass the parameter by ref:

<?xml version="1.0" encoding="utf-8" ?>

- <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://tempuri.org"
xmlns:s1="http://schemas.microsoft.com/BizTalk/2003/Any"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://tempuri.org"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk
assembly "MyMethod, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=54556428737eb89f" published web service.</wsdl:documentation>

- <wsdl:types>

- <s:schema elementFormDefault="qualified"
targetNamespace="http://tempuri.org">

<s:import namespace="http://schemas.microsoft.com/BizTalk/2003/Any" />

- <s:element name="MyMethod">

- <s:complexType>

- <s:sequence>

<s:element minOccurs="0" maxOccurs="1" ref="s1:Root" />

</s:sequence>

</s:complexType>

</s:element>

- <s:element name="MyMethodResponse">

- <s:complexType>

- <s:sequence>

<s:element minOccurs="0" maxOccurs="1" ref="s1:Root" />

</s:sequence>

</s:complexType>

</s:element>

</s:schema>

- <s:schema elementFormDefault="qualified"
targetNamespace="http://schemas.microsoft.com/BizTalk/2003/Any">

- <s:element name="Root">

- <s:complexType mixed="true">

- <s:sequence>

<s:any />

</s:sequence>

</s:complexType>

</s:element>

</s:schema>

</wsdl:types>

- <wsdl:message name="MyMethodSoapIn">

<wsdl:part name="parameters" element="tns:MyMethod" />

</wsdl:message>

- <wsdl:message name="MyMethodSoapOut">

<wsdl:part name="parameters" element="tns:MyMethodResponse" />

</wsdl:message>

- <wsdl:portType name="TransportOrdersWSSoap">

- <wsdl:operation name="MyMethod">

<wsdl:input message="tns:MyMethodSoapIn" />

<wsdl:output message="tns:MyMethodSoapOut" />

</wsdl:operation>

</wsdl:portType>

- <wsdl:binding name="TransportOrdersWSSoap"
type="tns:TransportOrdersWSSoap">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

- <wsdl:operation name="MyMethod">

<soap:operation soapAction="http://tempuri.org/WebService_MyMethod/MyMethod"
style="document" />

- <wsdl:input>

<soap:body use="literal" />

</wsdl:input>

- <wsdl:output>

<soap:body use="literal" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

- <wsdl:binding name="TransportOrdersWSSoap12"
type="tns:TransportOrdersWSSoap">

<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />

- <wsdl:operation name="MyMethod">

<soap12:operation
soapAction="http://tempuri.org/WebService_MyMethod/MyMethod"
style="document" />

- <wsdl:input>

<soap12:body use="literal" />

</wsdl:input>

- <wsdl:output>

<soap12:body use="literal" />

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

- <wsdl:service name="TransportOrdersWS">

<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">BizTalk
assembly "MyMethod, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=54556428737eb89f" published web service.</wsdl:documentation>

- <wsdl:port name="TransportOrdersWSSoap"
binding="tns:TransportOrdersWSSoap">

<soap:address
location="http://localhost/TransportOrdersWS/TransportOrdersWS.asmx" />

</wsdl:port>

- <wsdl:port name="TransportOrdersWSSoap12"
binding="tns:TransportOrdersWSSoap12">

<soap12:address
location="http://localhost/TransportOrdersWS/TransportOrdersWS.asmx" />

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

>>I use wsdl.exe to generate client code to call a web service. The actual
>>web service is generated with the BizTalk Web Services Publishing Wizard.
[quoted text clipped - 26 lines]
>
> John
John Saunders - 14 Mar 2007 19:04 GMT
> I'm not sure I see anything so I will just show the entire wsdl, hopefully
> someone can find something that will show me what to change in the wsdl to
> change so that I not pass the parameter by ref:

You should not change the WSDL. It does not "belong" to you. It belongs to
BizTalk. It represents the contract that BizTalk is willing to enforce
between the world, and the BizTalk web service.

I looked at the WSDL (please don't paste from IE next time. The "-" signs
make it useless as an XML file). I suspect that the issue is that both the
input and output messages have a single part named "parameters", and that
both "parameters" have the same type. It is saying that "parameters" are
input and then "parameters" are output, which in .NET terms is "ref".

In other words, the server side isn't broken. Is there some reason you don't
want to use "ref"?

John
Nick K. - 14 Mar 2007 19:31 GMT
The lead that gave me the requirements for the web services did not define a
ref parameter. This web service would be called by others that I have no
clue as to their development environment. Would "ref" pose a problem in
environments other than Microsoft?

>> I'm not sure I see anything so I will just show the entire wsdl,
>> hopefully someone can find something that will show me what to change in
[quoted text clipped - 14 lines]
>
> John
John Saunders - 15 Mar 2007 03:34 GMT
> The lead that gave me the requirements for the web services did not define
> a ref parameter. This web service would be called by others that I have no
> clue as to their development environment. Would "ref" pose a problem in
> environments other than Microsoft?

No, "ref" won't cause a problem because there is no "ref" in the WSDL. Only
an operation with both input and output parameters having the same name and
type.

John

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.