Hi, I am using WebLogic 11g and have a web service that uploads attachment using MTOM. The service can be invoked via SoapUI successfully. I also need to call the service via a Java client, and that also works without any issues. To do that, I use the auto-generated classes by JAXWS and generate and send a message like below:
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);
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 and MTOM together 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.
Edited by: John23 on Apr 17, 2013 7:57 AM