cannot generate C# exception code corresponds to <wsdl:fault> element

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:eek: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]));
}
}
}
 

pgarg4

Usenet Archive
Joined
Mar 16, 2006
Messages
1
Reaction score
0
Hi,
Your are absolutely right. I encountered the same problem, and reached on the same conclusion, what ur suggesting.

Exception related code can not be generated for wsdl , c#,vb.net related files. Bydefault, when we create client proxy or Server stub from wsdl file(which is having fault tag), it dosent any different peiece of code related to exception in code files.
 

rodmcleay

Usenet Archive
Joined
Nov 17, 2006
Messages
1
Reaction score
0
Steve wrote:
*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?
...
 

John Saunders

Usenet Archive
Joined
Aug 8, 2001
Messages
2,273
Reaction score
0
It is true. .NET does not support generation of wsdl:fault elements, nor will it generate exceptions corresponding to wsdl:fault elements it finds during proxy generation.

In this case, the Java world has it over .NET. I used IBM Rational Application Developer product (an eval) and was able to trivially create a Java client for my web service. It came complete with exceptions that not only matched my wsdl:fault elements, but they also properly deserialized the <details> element in the fault into properties on the exception.

Why .NET can't do this, I don't know.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top