Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > cannot generate C# exception code corresponds to <wsdl:fault> element

Reply
Thread Tools

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

 
 
Steve
Guest
Posts: n/a
 
      02-24-2006
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">
<soapperation 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("c ode")]

[System.Web.Services.WebServiceBindingAttribute(Nam e="Service1Soap",
Namespace="http://tempuri.org/")]
public class Service1 :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {

/// <remarks/>
public Service1() {
this.Url = "http://localhost/wstest/Service1.asmx";
}

/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/sum",
RequestNamespace="http://tempuri.org/",
ResponseNamespace="http://tempuri.org/",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.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]));
}
}
}

 
Reply With Quote
 
 
 
 
pgarg4@csc.com
Guest
Posts: n/a
 
      03-16-2006
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.

---
Posted via www.DotNetSlackers.com
 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      11-17-2006
"rodmcleay" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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?
>>
>> any ideas? please advise.


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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
Exception of type 'System.Web.HttpUnhandledException' wasthrown.Exception has been thrown by the target of an invocation.System.WebSystem.Exception jobs ASP .Net 1 11-16-2007 05:57 PM
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
Element TABLE cannot be nested within element 'p' Fred Flintstone ASP .Net 2 09-13-2006 08:15 PM
Which codec corresponds to GSM? Al UK VOIP 1 07-14-2005 08:18 AM



Advertisments