We are using Springs SaajSoapMessage Factory to attach a large incoming xml (1MB) and send it as a webservice call to another endpoint.
It appears the attachment is getting attached correctly but on the receiving end when we iterate through the attachment the size of the attached file is around 8 KB only.
Looks like the remaining xml is getting trucated.
1.> Is there any size limit on the attachment which we can send over the wire?
2.> Does anyone have any sample code for sending attachments using SoapMessage?
Below are the code snippets
this.webServiceTemplate.setDefaultUri("http://localhost:8888/xml-logger-web/services/");
WebServiceMessageCallback requestCallBack1 = null;
try {
requestCallBack1 = new WebServiceMessageCallback() {
public void doWithMessage(WebServiceMessage message)
throws IOException, TransformerException {
SoapMessage soapMessgae = (SoapMessage) message;
soapMessgae.addAttachment("1", new ByteArrayResource(xml.getBytes()), "application/octet-stream");
}
};
} catch(Exception e){
e.printStackTrace();
System.out.println(e.getMessage());
}
LogResponse logResponse = (LogResponse) this.webServiceTemplate
.marshalSendAndReceive(
//"http://qu-lss-01:7777/xml-logger-web/services/",
"http://localhost:8888/xml-logger-web/services/",
logRequest, requestCallBack1);


Reply With Quote
