Problems creating an SAAJ object model

I tried sending a SOAP request in jquery to a 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>

how i did this is to pass a pair of tokens to another function that create a SOAP request based on these tokens. one of the tokens is an Html line 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 escape the html string from this token, the SOAP request succeeded, but the whole string spoiled by all escaped characters and the third party needs this html string to render the template, so I can not send the escaped version anyway. Is there a way that I can safely pass an html string without query failing?

+4
source share
3 answers

The error "Problems creating the SAAJ object model" usually occurs when a soap request cannot be analyzed 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 the html tags to the soap envelope, so you may have problems escaping html tags . It is good practice to pass the BASE64 string to the soap request for this kind of data.

+5
source

Please add a title such as "Content-type text / xml; charset = utf-8".

0
source
-2

Source: https://habr.com/ru/post/1546756/


All Articles