I am currently evaluating spring-ws 1.5.9 for a webservice, that has to send medium sized binary attachments (pdfs and images).
I wrote a sample service with an operation 'getPdfDocument', that should return a pdf document of about 160k. I tried to follow the mtom-sample and as far as I can see, I did everything that is suggested.
As long, as I don´t enable mtom, everything works fine. The binary data gets transmitted inline the message body and the client can access it. But when i enable mtom, the clientside datahandler does not contain any data.
I´ve enabled message tracing for server and client and the messages seem to be correct in both scenarios. With mtom disabled, the data is transmitted b64-encoded within the message body. With mtom enabled, i can see the binary data as attachment in a separate message part, both for client and server. From message tracing point of view, everything looks fine.
The problem is, that with mtom enabled, the binary data is not available for my client. In both scenarios i use the following code to write the data to a file. Without mtom the file contains a valid pdf document, but with mtom enabled, the file has a size of 0 bytes. No exceptions or warnings are shown, everything looks fine except the fact, that the data is lost.
xsd definition for documentData is:Code:FileOutputStream fout = new FileOutputStream(...); DataHandler dataHandler = result.getDocumentData(); dataHandler.writeTo(fout); fout.flush();
I´m using SaajSoapMessageFactory and jaxb2 marshallers both on server and client and I´m working with the libraries included in the spring-ws distribution. It seems that for some reason attachment data is not correctly bound to the datahandler, but after two days of trying and looking through various forums, I still don´t have a clue whats wrong.Code:... <xsd:sequence> <xsd:element name="documentData" type="xsd:base64Binary" xmime:expectedContentTypes="application/octet-stream"/> </xsd:sequence> ...
The fallback strategy would be not using mtom, but given the attachments size and the fact, that our service will have heavy traffic, I´m not happy with that approach. Any help would be highly appreciated.
Andreas
Edit: I forgot to mention that the service is running under WAS 7.0.0.5 with parent-last classloading and the following libs attached from the spring-ws distribution: activation-1.1.1, jaxb-api-2.1, jaxb-impl.2.1.5, mail-1.4.1, saaj-api-1.3, saaj-impl-1.3.2, sping-ws-1.5.9-all and the spring-2.5.6 libs.


Reply With Quote
