problems creating SAAJ object model

user468587 picture user468587 · Jul 2, 2014 · Viewed 24.3k times · Source

i tried to send a SOAP request in jquery to third party but always got this error:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Problems creating SAAJ object model</faultstring></soap:Fault></soap:Body></soap:Envelope>

the way i did it is to pass couple of tokens to another function ,which create SOAP request based on those token. one of the token is a Html string like this:

<tr><td width="2" bgcolor="#ffffff"><\/td><td width="1" bgcolor="#d8dbe3"><\/td><td width="2" bgcolor="#ffffff"><\/td><td width="15" bgcolor="#f5f6f8"><\/td><td width="535" bgcolor="#f5f6f8"><table width="535" cellspacing="0" cellpadding="0" border="0" bgcolor="#f5f6f8"><tr><td width="80"><table width="80" height="96" bgcolor="#999999" cellspacing="0" cellpadding="0" border="0" align="center"><tr><td width="80" height="1" colspan="3"><\/td><\/tr><tr><td width="1" bgcolor="#999999"><\/td>....

whenever i added this token, the SOAP request failed. I tried to escaped this html string token, SOAP request succeeded but the whole string messed up with all the escaped characters and third party need this html string to render template, so i cannot sent the escaped version anyway. is there any way i can safely pass the html string without crashing the request?

Answer

Dmitry Pod picture Dmitry Pod · Mar 17, 2015

Error "Problems creating SAAJ object model" usually occurs when soap-request cannot be parsed on the server side. In the log-file on the server you can see something like

Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '>' (code 62) (expected a name start character)
 at [row,col {unknown-source}]: [18,6]

You pass html tags to the soap envelope, so problems can be with escaping html-tags. It's a good practice to pass BASE64 string within soap-request for such kind of data