Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SOAPFault

 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is is specified somewhere (Spec, WS-I BP, or whatever) that a Web Service MUST return a SOAPFault when an error occurs, even if this error is due to some business process (ex : the ID of a business method is 789 while a business rule requires IDs < 123)
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what the "high-level" specifications say about this kind of details, but I believe the applications should be allowed to process errors as errors and exceptions as exceptions. In other words, I'm pretty confident that SOAPFault is not required for application-level validation errors.
 
JeanLouis Marechaux
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Lasse.
What do you think about always returning SOAPFaults ?
I mean, a SOAPFault when a real error occurs, and business XML message contained in a SOAPFault (Element detail) when a business error occurs
[ April 01, 2004: Message edited by: Jean-Louis Marechaux ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jean-Louis Marechaux:
What do you think about always returning SOAPFaults ?
I mean, a SOAPFault when a real error occurs, and business XML message contained in a SOAPFault (Element detail) when a business error occurs
Well, I'd have to see the two alternatives side-by-side since the difference here is mostly a matter of taste regarding how the error handling code is structured. In general, I'd probably be happy with either approach.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question, how do I send SOAP fault message from the web service? Do I need to throw an exception so that it gets propagated as SOAP fault message? Can some one give me code sameple to send SOAP fault message.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've done that once with SAAJ (I think) by simply creating an envelope object, calling addFault(mySoapFaul) on it (after first creating the SOAPFault object, of course), and sending the response envelope as usual.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to translate the SOAP fault message to a specific Exception at the client?
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
I have a question, how do I send SOAP fault message from the web service? Do I need to throw an exception so that it gets propagated as SOAP fault message? Can some one give me code sameple to send SOAP fault message.


An example is available here http://cvs.apache.org/viewcvs.cgi/ws-axis/java/samples/faults/ for apache axis, which you can re-use for other implementations as well.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Is it possible to translate the SOAP fault message to a specific Exception at the client?
I don't know whether there's a standard way of mapping SOAPFaults to exception classes, but the specification certainly makes it possible (the fault element in SOAP allows using custom "details" of which namespace/element name could be mapped to a Java exception class, for example).
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Balaji Loganathan:


An example is available here http://cvs.apache.org/viewcvs.cgi/ws-axis/java/samples/faults/ for apache axis, which you can re-use for other implementations as well.

Balaji
The link does not work for me.
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The link is now working fine.
How is the operation tag in deploy.wsdd different from the one in WSDL file
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/samples/faults/deploy.wsdd?rev=1.1&view=markup
[ April 05, 2004: Message edited by: Pradeep Bhat ]
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:
I don't know whether there's a standard way of mapping SOAPFaults to exception classes, but the specification certainly makes it possible (the fault element in SOAP allows using custom "details" of which namespace/element name could be mapped to a Java exception class, for example).

Thanks Lasse!
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does the SOAP fault message have only one part?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pradeep Bhat:
Why does the SOAP fault message have only one part?
My guess would be that the team who created the specification didn't think it would be necessary to allow such flexibility for SOAP faults...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic