473,770 Members | 4,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to retrieve soap fault messages returned by AXIS server in .Net client

Hi,

I have a web service application that uses AXIS at the server side and
C# at the client side. the C# client code was generated using wsdl.exe.
When AXIS raised an exception, it sends the soap exception back to
client with HTTP 500 internal server error:

HTTP/1.1 500 Internal Server Error

Date: Wed, 14 Dec 2005 00:18:16 GMT

Content-Type: text/xml; charset=utf-8

Transfer-Encoding: chunked

01de
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelo pe
xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body >
<soapenv:Faul t>
<faultcode>soap env:Server.user Exception</faultcode>

<faultstring>co m.foo.command.e xception.Duplic ateDataExceptio n: License
is already in use</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelop e>0000
When C# client code reads the reasponse, it raises a WebException and
stops reading the saop body, I wonder if there is anyway for me to read
the faultCode and faultString when such exception is raised.

Thanks

Paul

Dec 15 '05 #1
1 9859

You can use the WebException.Re sponse property to get a stream and then read
from that. But that's not really a nice way to do it. Most likely there is a
smarter way!

If you skip the HTTP level classes and use SoapClient instead I think you
will get a proper exception with .FaultString properties etc.

rgrds,
martin

"Paul" wrote:
I have a web service application that uses AXIS at the server side and
C# at the client side. the C# client code was generated using wsdl.exe.
When AXIS raised an exception, it sends the soap exception back to
client with HTTP 500 internal server error:

HTTP/1.1 500 Internal Server Error

Date: Wed, 14 Dec 2005 00:18:16 GMT

Content-Type: text/xml; charset=utf-8

Transfer-Encoding: chunked

01de
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelo pe
xmlns:soapenv=" http://schemas.xmlsoap .org/soap/envelope/"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body >
<soapenv:Faul t>
<faultcode>soap env:Server.user Exception</faultcode>

<faultstring>co m.foo.command.e xception.Duplic ateDataExceptio n: License
is already in use</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelop e>0000
When C# client code reads the reasponse, it raises a WebException and
stops reading the saop body, I wonder if there is anyway for me to read
the faultCode and faultString when such exception is raised.

Thanks

Paul

Feb 14 '06 #2

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

Similar topics

2
4457
by: Artur | last post by:
Hi Newsgroup, im currently working on programming a asp.net application consuming an Webservice hosted on Apache/Axis. I have generated WSDL and Proxy classes from VisualStudio.net. But when trying to fire up one method i get following error: System.Web.Services.Protocols.SoapHeaderException: Method 'tns:prodsearch' not implemented
15
3089
by: MR | last post by:
i need to develop a SOAP client, Since I have never personally done one I would like to make sure that I am going about it correctly. The client is a Windows (probably 2k3) application that communicates over HTTPS SOAP. The remote server is Unix based and implements Axis, which I know nothing about What are the steps I need to create this client? I will be developing in C# and I have the XML schema of the SOAP messages. How do I get...
3
9795
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 deserialization routines to put the content in a generic object array (object) BUT the content is supposed to...
3
4253
by: Moshe Kravchik | last post by:
Hi! We have a Web Service written in ATL Server and a client written in Java using Axis. When something goes wrong on the server side, it returns an HRESULT of the error which is translated into the SoapFault. The problem is that the SoapFault is interpreted by Axis not as a SoapFaultException, but as a more generic AxisFault exception with all the info we put in the soap fault lost. Has anyone manage to get this to work? Please...
3
10296
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 class defined in the WSDL and deserialize the message into the appropriate exception class.
0
1331
by: GAURAV KRISHNA | last post by:
Hello, I'm trying to build a C# client to consume an AXIS Web Service (running SOAP over HTTP). The Web Service encodes full server-side exception traces in the Soap Fault > Detail element using complex type structures declared in the WSDL file. I have had absolutely no luck working out how I can deserialize the custom server exception object out of the detail element. I have tried XmlSerializer as suggested in the mailing list with...
5
4163
by: vthakur | last post by:
Hello: I have a Axis Web Service that sets the sessionid in the SOAP header for persisting the session. The client is a .Net client that processes the header as an Unknown Header. It sets the session id received from the Service request on subsequent requests to the service. However the Axis Web service does not process the SOAP header received from the .Net client and creates a new session id for each request from the .Net client. Below...
0
5608
by: info | last post by:
Dear all, is the first time that I use SOAP, and i must say that i'm having several problems. this is SOAP message that expects the server =================XML EXPECTED FROM THE SERVER================ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
0
3137
by: Default User | last post by:
I work on creating test cases for a SOAP-based set of servers, using soapUI. I received and updated set of WSDL and schema files, and when I made new tests and mock server operations, all of the ones that had been working now returned a SOAP fault. The faults look something like: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Body> <soap:Fault> <soap:Code>
0
10237
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10071
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9882
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6690
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.