Reputation: 31
I am using IBM websphere 8.0 and have a webservice deployed on server with MTOM enabled using annotation @MTOM(enabled=true,threshold=0). I can see MTOM working for the sending attachment but for webservice doesn't use MTOM when sending attachment in the response. The webservice client has MTOM enabled as well. I tried using normal java jax-ws client as well as SoapUI. Following is the sample response from server. Attachments are always inline.
HTTP/1.1 200 OK
X-Powered-By: Servlet/3.0
Content-Type: text/xml; charset=UTF-8
Content-Language: en-US
Transfer-Encoding: chunked
Date: Tue, 05 Jul 2016 18:17:12 GMT
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns3:processRequestResponse >
<ns5:Response>
<ns5:MessageHeader>
<ns5:MessageType>RECEIPT.DOWNLOAD</ns5:MessageType>
<ns5:MessageVersion>1</ns5:MessageVersion>
<ns5:MessageID>1</ns5:MessageID>
<ns5:DateTimeStamp>2016-07-05T12:17:12</ns5:DateTimeStamp>
</ns5:MessageHeader>
<ns5:ReplyHeader>
<ns5:ReplyStatusCode>0</ns5:ReplyStatusCode>
<ns5:ReplyStatusValue>SUCCESS</ns5:ReplyStatusValue>
</ns5:ReplyHeader>
<ns5:Payload>
<ns6:DownloadAttachmentResponse/>
</ns5:Payload>
<ns5:receiptImages>/9j/4AAQSkZJRgABAgAAAQABAAD</ns5:receiptImages>
<ns5:receiptImages>/9j/4AAQSkZJRgABAgAAAQABAAD</ns5:receiptImages>
</ns5:Response>
</ns3:processRequestResponse>
</soapenv:Body>
</soapenv:Envelope>
This is how my response object looks like
`@XmlRootElement(name = "Response",namespace="http://response.inboundgateway.ws.axol.cps.application.usbank.com/")
@XmlSeeAlso(DownloadAttachmentResponse.class)
public class Response {
@XmlElement(name = "MessageHeader", required = true)
protected Response.MessageHeader messageHeader;
@XmlElement(name = "ReplyHeader", required = true)
protected ReplyHeaderType replyHeader;
@XmlElement(name = "Payload", required = true)
protected Response.Payload payload;
@XmlMimeType("image/jpeg")
protected List<Image> receiptImages;`
Upvotes: 1
Views: 498
Reputation: 5320
Make sure you haven't disabled MTOM in webservices.xml, which would override the annotation-based config.
From the documentation here.
For JAX-WS web services, the use of the webservices.xml deployment descriptor is optional because you can use annotations to specify all of the information that is contained within the deployment descriptor file. You can use the deployment descriptor file to augment or override existing JAX-WS annotations. Any information that you define in the webservices.xml deployment descriptor overrides any corresponding information that is specified by annotations.
Upvotes: 1