You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Rich Catlett <ri...@more.net> on 2001/08/03 19:46:56 UTC
determining if the soap call was successful or not
I'm writing a soap messaging client, I created the envelope, I created
the message, and then I sent the message. The service will be returning
an envelope so I used the message.recieveEnvelope() method, and then the
envelope.getBody() method to get the body. This is where I get a little
lost. I want to determine if the body contains a soap fault or the XML
data of a success. Do I
1. use the body.getAttribute() method to check for a SOAP-ENV:fault such
as the following
if (body.getAttribute(new QName("SOAP-ENV:Fault")) == null) {
// success
return body.toString(); // body being the XML data from a successful
response
}else {
// extract the fault string and first line of the stacktrace and return
I'm not sure how I might do this either, could I use the getAttribute
method again, I'm guessing that the QName might go something like this
body.getAttribute(new QName("SOAP-ENV:Fault(some sort of
connector)faultstring"));
or should I use the body.getBodyEntries() and then search the resluting
vector for the faultstring and stacktrace entries.
2. use the body.getBodyEntries() method, search for a SOAP-ENV:Fault
entry, if there is not one return the body.toString(), else if there is
a SOAP-ENV:Fault entry search for falutstring and stacktrace entries and
return those.
Thanks for your help in advance.
Rich Catlett