Steve (18)
Usenet Archive
- Joined
- Feb 24, 2006
- Messages
- 21
- Reaction score
- 0
In Visual Studio .NET, I try to generate C# proxy class from WSDL, and the WSDL file has <wsdl:fault> element. I expect the generated proxy code should have the exception code that corresponds to <wsdl:fault> element, but it doesn't have any.
I did some research and found out WSDL description generated by a .NET Web service does not contain any wsdl:fault or soapbind:fault elements. I am not sure if this is true, and not sure if VS.NET supports exception code generation from <wsdl:fault> element. Is that true?
any ideas? please advise.
thanks!!
Here's the WSDL and generated C# proxy code for references:
<?xml version="1.0" encoding="utf-8"?>
<definitions 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://tempuri.org/" 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="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> <s:element name="sum"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="a" type="s:int" /> <s:element minOccurs="1" maxOccurs="1" name="b" type="s:int" /> </s:sequence> </s:complexType> </s:element> <s:element name="sumResponse"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="sumResult" type="s:int" /> </s:sequence> </s:complexType> </s:element> <s:element name="sumException"> <s:complexType> <s:sequence> <s:element name="errorMessage" type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </types> <message name="sumSoapIn"> <part name="parameters" element="s0:sum" /> </message> <message name="sumSoapOut"> <part name="parameters" element="s0:sumResponse" /> </message> <message name="sumSoapFault"> <part name="parameters" element="s0:sumException" /> </message> <portType name="Service1Soap"> <operation name="sum"> <input message="s0:sumSoapIn" /> <output message="s0:sumSoapOut" /> <fault message="s0:sumSoapFault" /> </operation> </portType> <binding name="Service1Soap" type="s0:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="sum"> <soap
peration soapAction="http://tempuri.org/sum" style="document" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="Service1"> <port name="Service1Soap" binding="s0:Service1Soap"> <soap:address location="http://localhost/sumws1/Service1.asmx" /> </port> </service> </definitions>
//------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version
1.1.4322.573.
//
namespace wstest.WebReference {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="Service1Soap", Namespace="http://tempuri.org/")] public class Service1 :
System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public Service1 {
this.Url = "http://localhost/wstest/Service1.asmx"; }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/sum", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public int sum(int a, int b) { object results = this.Invoke("sum", new object { a, b}); return ((int)(results[0])); }
/// <remarks/>
public System.IAsyncResult Beginsum(int a, int b,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("sum", new object {
a,
b}, callback, asyncState);
}
/// <remarks/>
public int Endsum(System.IAsyncResult asyncResult) {
object results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
I did some research and found out WSDL description generated by a .NET Web service does not contain any wsdl:fault or soapbind:fault elements. I am not sure if this is true, and not sure if VS.NET supports exception code generation from <wsdl:fault> element. Is that true?
any ideas? please advise.
thanks!!
Here's the WSDL and generated C# proxy code for references:
<?xml version="1.0" encoding="utf-8"?>
<definitions 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://tempuri.org/" 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="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> <s:element name="sum"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="a" type="s:int" /> <s:element minOccurs="1" maxOccurs="1" name="b" type="s:int" /> </s:sequence> </s:complexType> </s:element> <s:element name="sumResponse"> <s:complexType> <s:sequence> <s:element minOccurs="1" maxOccurs="1" name="sumResult" type="s:int" /> </s:sequence> </s:complexType> </s:element> <s:element name="sumException"> <s:complexType> <s:sequence> <s:element name="errorMessage" type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </types> <message name="sumSoapIn"> <part name="parameters" element="s0:sum" /> </message> <message name="sumSoapOut"> <part name="parameters" element="s0:sumResponse" /> </message> <message name="sumSoapFault"> <part name="parameters" element="s0:sumException" /> </message> <portType name="Service1Soap"> <operation name="sum"> <input message="s0:sumSoapIn" /> <output message="s0:sumSoapOut" /> <fault message="s0:sumSoapFault" /> </operation> </portType> <binding name="Service1Soap" type="s0:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="sum"> <soap
//------------------------------------------------------------------------------ // <autogenerated> // This code was generated by a tool. // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </autogenerated> //------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version
1.1.4322.573.
//
namespace wstest.WebReference {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="Service1Soap", Namespace="http://tempuri.org/")] public class Service1 :
System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public Service1 {
this.Url = "http://localhost/wstest/Service1.asmx"; }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/sum", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public int sum(int a, int b) { object results = this.Invoke("sum", new object { a, b}); return ((int)(results[0])); }
/// <remarks/>
public System.IAsyncResult Beginsum(int a, int b,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("sum", new object {
a,
b}, callback, asyncState);
}
/// <remarks/>
public int Endsum(System.IAsyncResult asyncResult) {
object results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}