Hi everyone. I want to have a webservice client that reads in a file (could be everything) and sends it to my webservice over SOAP with Attachments. I am able to create the sources and everything for the client directly from the wsdl. The message when sending is created as follows:
POST /ftpSoap/ HTTP/1.1
Content-Type: multipart/related; boundary="uuid:5828c7f2-75
Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
User-Agent: JAX-WS RI 2.1.4-b01-
<?xml version="1.0" encoding="UTF-8"?><S:Envel
File folder="componentTest" name="Browser282b2.zip"/><
[binary data begins here]
To me this looks like it should. But back to the problem: When on the server side jax-ws tries to read the message (create the envelope object), I get the following error message:
java.io.IOException: Unexpected characters before XML declaration
Can anybody tell me, why I get this error? Should I have to tell the SOAP Body, or SOAP message object somehow, that it is multipart? but there is no method to do so. I am a bit desperate, since you can not really debug this.
The Code on the Server looks like this:
SOAPMessage soapMessage = MessageFactory.newInstance
SOAPPart soapPart = message.getSOAPPart();
SOAPBody soapBody = soapPart.getEnvelope().get
Do I have to set the MimeHeaders in a different way? Do I have to manually extract the SOAP part from the request? OR is it in the end just an encoding problem?
Any help is greatly appreciated.