The error is as follows: [com.ctc.wstx.exc.WstxLazyException] Illegal character entity: expansion character (code 0x1a\r\n at [row,col {unknown-source}]: [1,8035]
This is my WebService in Springboot with its WebMethod which receives an array of Polizas from which one of its fields contains an invalid character:
@WebService(targetNamespace = "http://example.org.co/", name = "PolizaSoap")
@XmlSeeAlso({ObjectFactory.class})
public interface PolizaSoap {
@WebMethod(operationName = "Polizas", action = "http://example.org.co/Polizas")
@RequestWrapper(localName = "Polizas", targetNamespace = "http://example.org.co/", className = "com.example.Polizas")
@ResponseWrapper(localName = "PolizasResponse", targetNamespace = "http://example.org.co/", className = "com.example.PolizasResponse")
@WebResult(name = "PolizasResult", targetNamespace = "http://example.org.co/")
public ArrayOfPolizas Polizas(
@WebParam(name = "param1", targetNamespace = "http://example.org.co/")
java.lang.String param1,
@WebParam(name = "param2", targetNamespace = "http://example.org.co/")
java.lang.String param2,
@WebParam(name = "param3", targetNamespace = "http://example.org.co/")
java.lang.String param3
);
}
I have tried all kinds of interceptor (ClientInterceptor), filters (WebFilter), handler (SOAPHandler, HandlerInterceptor) and none have worked for me, the error occurs instantly and I have not found a way to obtain the XML response with the invalid character to be able to modify it and so everything works.
I'm beginning to think it's impossible to do, is there any other alternative that doesn't involve asking the response provider to correct it?. How can I intercept a XML response with invalid character (0x1a) without/before trigger a WebServiceException?
EDIT: Does anyone know if it is possible to use a FilterInputStream to correct the "XML" that comes with invalid characters before throwing an exception?