On the Stre@m

Technical
...
The serpent is crawling inside of
your ear
He says you must vote for what you
want to hear
Dont matter whats wrong as long as
youre alright
So pull yourself stupid and rob
yourself blind
(dickinson/gers)

SOAP error message
Getting out the message from SOAP on error.

I get from call.invoke() SOAPException - Parsing error. The message received was not a SOAP envelope so SAX throws an error reported through SOAPException. I want to get my hands on that message. I really needed because is an error from PHP reported as html.
To get the message out you can do something like this:

SOAPHTTPConnection shc = new SOAPHTTPConnection();
Call call = new Call();
call.setSOAPTransport(shc);
try {
  resp = call.invoke(url, "");
} catch (SOAPException e) {
  StringBuffer sb = new StringBuffer();
  SOAPContext sc = shc.getResponseSOAPContext();
  try {
    for(int i=0; i<sc.getCount(); i++) {
      MimeBodyPart mbp = sc.getBodyPart(i);
      sb.append(mbp.getContent());
    }
  } catch (Exception ex) {}
}

This is not 100% rigorous because type checking for each MimeBodyPart must be done. But you get the point.
Page 1 of 1