473,545 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deserialization of Soap Fault into custom exception class: possible?

Nol
Hi all,

My webservice throws an exception, which is translated into a soap
Fault in the soap message body. See below for the actual message format
as it is send by the server. On the (dotNet) client I get (catch) this
as a SoapException (or SoapHeaderExcep tion). The SoapException contains
various (string type) fields. For example, the Message fields contains
the fully qualified name of the exception on the server side. The
InnerException field however is always null.

What I would like to do is to have the Soap Fault deserialized into a
class wich is similar as found in the the detail field of the Soap
Fault. In other words, I just would like to have the exception in the
same format it is defined on the server. For this I could catch the
SoapException, and parse it's fields, but would rather have the
SoapFault automatically deserialized into the target exception type.

I've been experimenting with the annotations in my client code (proxy),
but I haven't been successful. Actually, I am getting doubtfull if
possible at all.

Here is the message as send by the server:

<env:Envelope xmlns:env='http ://schemas.xmlsoap .org/soap/envelope/'>
<env:Header/>
<env:Body>
<env:Fault>
<faultcode>env: Client</faultcode>

<faultstring>co rp.cpwr.hybrid1 1.application.b usiness.common. MyDomOpSvcExcep tion:
User Defined Exception: MyDomOpSvcExcep tion</faultstring>
<detail>
<ns1:MyDomOpSvc Exception
xmlns:ns1='http ://common.business .application.hy brid11.cpwr.cor p'
xmlns:xsi='http ://www.w3.org/2001/XMLSchema-instance'>
<ns_key:key
xmlns:ns_key='h ttp://application.alt uradev.compuwar e.com'>UDEXC_My DomOpSvcExcepti on</ns_key:key>
</ns1:MyDomOpSvcE xception>
</detail>
</env:Fault>
</env:Body>
</env:Envelope>
In my client code (in the class that extends
WebServicesClie ntProtocol), I defined a class with a signature like
this:

[System.Serializ ableAttribute()]
[System.Xml.Seri alization.XmlTy peAttribute(Nam espace =
"http://common.business .application.hy brid11.cpwr.cor p")]
public abstract partial class MyDomOpSvcExcep tion
{

wich contains a key property. Before the client class definition I
added the following annotation:
[System.Xml.Seri alization.XmlIn cludeAttribute( typeof(MyDomOpS vcException))]
This however doesn't help: I still get SoapExceptions, and the
innerexception is still null.

Anybody any clue?

Thanks in advance,
Nol

Jun 23 '06 #1
0 1454

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9780
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the response. As a result of seraching news groups I guessed that the SOAP response defines an array element in a way that causes the dotnet...
1
3722
by: parrot toes | last post by:
I tried to post this question before, but there was an error when posting. I case it did get posted and in order to avoid duplication, I'll just repost a summary. I have written a dotnet client that accesses a Axis provided web service. The client uses the code generated, using wsdl.exe, from the wsdl file provided by the web service...
8
3452
by: ashoksrini | last post by:
Hi All, I have the below requirement and would like to get some feeback from the group on the best way to implement: 1. I have WSDL defined exposing few web services. 2. We dont have a requirement to have a server web service class. (reasons below) 3. I want to develop something like this - when client makes a web service call, on the...
0
4337
by: Matt Wood | last post by:
Hi, I have written a Web Service for a customer which expects a SOAP message with Document/Literal encoding, and uses RoutingStyle=SoapServiceRoutingStyle.RequestElement to route the SOAP body message to my Web Method. The Web Method expects a string as its parameter and then feeds that string to an XML deserializer which maps the XML...
6
2110
by: A.M-SG | last post by:
Hi, We are developing a SmartClient application and we are planning to expose business objects layer to SmartClient application by using ASP.NET SOAP web services.
3
10276
by: JRey | last post by:
Does .Net generate the classes for Faults when they are specified in the WSDL. I tried defining them and then generating a proxy, and it did not appear to do it. On the Java side it did generate the class and the ability to serialize that class when putting it on the wire. I was hoping a .Net client would create the appropriate exception...
4
4466
by: Nol de Wit | last post by:
(this is a re-post of a message I've posted last friday, but now from my MSDN subscription account, hoping MSDN support will pick this up...) Hi all, My webservice throws an exception, which is translated into a soap Fault in the soap message body. See below for the actual message format as it is send by the server. On the (dotNet) client...
3
5621
by: Tomsawyer2kin_hotmail | last post by:
Hi, I created a custom Exception Class as Public Class CSTException : Inherits System.ApplicationException ' required to over ride the base class method Sub New(ByVal ExceptionCode As AppExCodes) MyBase.New(CStr(ExceptionCode)) End Sub end class
3
13899
by: =?Utf-8?B?SGVtaWw=?= | last post by:
Hi, I have written a web service for accessing data from a database. I have a method in the webservice which returns a dataset. I am trying to implement error handling by using the try...catch...finally structure. Now, the method's logic in the try block returns a dataset while the the code in the 'catch' block throws an exception...
0
7396
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7805
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7751
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4943
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3449
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3440
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
700
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.