简体   繁体   中英

Springws and MTOM client KO when pass through a balancer

I have a problem with a client that sends a pdf binary document with MTOM enabled to a soapservice. The service is correctly exposed and served. When i call the endpoint of the server that expose the service all goes ok, when i call the same service through a "service gateway" it sends back a "bad request" after it receive all the request.

>Accept-Encoding: gzip
>Content-Type: multipart/related;type="application/xop+xml";start-info="text/xml"
>Content-Disposition: attachment
>Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
>SOAPAction: "http://ws.documents...."
>Content-Type: Multipart/Related; boundary="----=_Part_1_1067527082.1584978884916"; >type="application/xop+xml"; start-info="text/xml"
>Cache-Control: no-cache
>Pragma: no-cache
>User-Agent: Java/1.8.0_222
>Host: service.xx.yy:8080
>Connection: keep-alive
>Content-Length: 105614


....
> This is the trace of the service gateway:
> v^[¹‹‘HTTP/1.1 400 [ISC.0064.9101] Bad Request Connection: close
> Content-Length: 0

The same service gateway is a passthrough of all other services without mtom and all goes ok. The weird thing is that when i call with soapui with attachment and MTOM enabled through the service gateway the call ends correctly. This is the core of the code:

response = (JAXBElement<CreateDocumentsResponseType>) wst.marshalSendAndReceive(uri,request);
  1. Where wst is a normal WebServiceTemplate instance with MTOM enabled
  2. request is the envelope marshalled with the document already packed with datahandler.

Before send the message, i made an interceptor to set the request header with custom authentication.

The balancer made a "preflight" that the webservicetemplate don't treat correctly. Created custom interceptor to handle this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM