Title: How to extract values from SOAP message?
Stuff it in xerces.  It's just xml after all...
----- Original Message -----
Sent: Tuesday, September 16, 2003 2:53 PM
Subject: How to extract values from SOAP message?

Hello, fellow developers!

I have SOAPFault message in the following form:

<SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
        <SOAP-ENV:Body>
                <SOAP-ENV:Fault
                        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"                                              xmlns="http://schemas.xmlsoap.org/soap/envelope/">

                        <faultcode>Client</faultcode>
                        <faultstring>Soap Client error.</faultstring>
                        <detail>
                                <RequestName>ExecuteReport</RequestName>
                                <ErrorCode>6035</ErrorCode>
                                <Description>
                                        <Message>Your login session has expired. Please login again.                                            (Login time out in hours)

                                        </Message>
                                        <Parameter1>24</Parameter1>
                                </Description>
                        </detail>
                </SOAP-ENV:Fault>
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Is there any way to extract "faultstring" and "Description" information from a message? I tried to find this info on the Internet but haven't found anything yet.

I need something like a_message.getValue("Fault/faultstring") or
        a_message.getValue("Fault/detail/Description/Message")

Now I use something like that:

Iterator a_iterator = a_responseBody.getChildElements();


            while (a_iterator.hasNext()) {
                Object a_obj = a_iterator.next();

                if (a_obj instanceof SOAPElement) {
                    SOAPElement a_element = (SOAPElement) a_obj;
                    Iterator a_iter = a_element.getChildElements();
                    while (a_iter.hasNext()) {
                        Object a_ello = a_iter.next();
                        if (a_ello instanceof SOAPElement) {
                            SOAPElement a_el = (SOAPElement) a_ello;
                            a_authIdSignature = a_el.getValue();
                            break;
                        }
                    }
                }
            }

But it doesn't seem right.

Thank you in advance!

Andrey

Reply via email to