Now, the above code generates the required Soap message and uploads the file successfully. However, I also need to create a Soap header and add it to the Soap message to send over some metadata that the service requires. Before using MTOM, I used SAAJ in my client and I could construct the Soap header and add it to the envelope without any issue. However, With the provided JAXWS classes at above, I can only send a message Body and there is no object to attach the Soap header to. So I need to know how I can send Soap Headers with MTOM messages in a Java client. I don't know how to use SAAJ to do that. This issue is really preventing me from progressing in a time sensitive project and I appreciate your help in resolving the issue. Thanks.
FileService service = new FileService(new URL(FileEndpoint), new QName("http://www.atlanta.com/FileService/", "FileService")); MTOMFeature features = new MTOMFeature(); FileServicePortType port = service.getFileServicePort(features); Map<String, Object> ctxt=((BindingProvider)port).getRequestContext(); ctxt.put(HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192); //Create request UploadFileWithAttachmentRequest request = new UploadFileWithAttachmentRequest(); //Instantiate and add all required objects including the binary file to the request FileXMLType fileXml = port.uploadFileWithAttachment(request);