Hello!
I am trying to use mtom for sending a binary file from a web service client to a web
service endpoint, using JBoss AS 4.2.2.GA with build in JBossWS 2.0.1.SP2.
I enabled mtom on the endpoint and on the client like it is told in the user guide:
First I added the @BindingType Annotation
| @Stateless
| @TransactionManagement(value=TransactionManagementType.CONTAINER)
| @WebService(name="AdminLibrary",
| serviceName="AdminLibraryService",
| wsdlLocation="META-INF/wsdl/AdminLibraryService.wsdl")
| @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle =
SOAPBinding.ParameterStyle.BARE)
| @BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
| @WebContext(contextRoot = "ALibrary")
| public class AdminLibraryWS {
|
| ...
|
|
Then I used WSProvide to generate the wsdl and did the appropriate changes
|
| <xs:schema
targetNamespace='http://ws.session.ejb.alibrary.seventy8.com/'
version='1.0'
xmlns:tns='http://ws.session.ejb.alibrary.seventy8.com/'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
| <xs:import
schemaLocation='http://www.w3.org/2005/05/xmlmime'
namespace='http://www.w3.org/2005/05/xmlmime'/>
| <xs:element name='ALibraryException'
type='tns:ALibraryException'/>
| <xs:element name='importBook' nillable='true'
type='tns:importBookRequest'/>
| <xs:element name='importBookResponse' nillable='true'
type='tns:importBookResponse'/>
| <xs:complexType name='importBookRequest'>
| <xs:sequence>
| <xs:element minOccurs='0' name='dataHandler'
type='xmime:base64Binary'
xmlns:xmime='http://www.w3.org/2005/05/xmlmime'/>
| <xs:element minOccurs='0' name='userId'
type='xs:string'/>
| </xs:sequence>
|
|
After deploying everything looks fine on the server. So I ran WSConsume
At the clients side I enabled MTOM as follows:
|
| SOAPBindingbinding = (SOAPBinding)((BindingProvider)port).getBinding();
| binding.setMTOMEnabled(true);
|
|
When I test this service and check the SOAP Message, the binary content is transmitted
inline.
|
| POST /ALibrary-ALibrary./AdminLibraryWS HTTP/1.1
| SOAPAction: ""
| Content-Type: text/xml; charset=UTF-8
| JBoss-Remoting-Version: 22
| User-Agent: JBossRemoting - 2.2.2.SP1 (Bluto)
| Host: 127.0.0.1:4040
| Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
| Connection: keep-alive
| Content-Length: 284493
|
| <env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:...
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
xmlns:ns1="http://ws.session.ejb.alibrary.seventy8.com/"><...
|
| ...
|
|
DAAMwAuADAANAAuADIAMAAwADcAIAAgADIAMQA6ADMANQA6ADAANwAgACAAQgB1AGkAbABkACAAdAB5AHAAZQA6ACAAUwBIAEkAUAAgAFUATgBJAgA=</dataHandler><userId>user1</userId></ns1:importBook></env:Body></env:Envelope>
|
|
Is there anything further I have to do to enable MTOM at the client?
WSConsume generates a class named Base64Binary which includes a byte-array and a field
called contentType.
IMO the type should be DataHandler instead, or am I wrong?
best regards
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120639#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...