- Sending attachment: MTOM / XOP vs SWA and inline attachment, by Steve Djajasaputra
- Osb 10gR3 and SwA and Mtom, by Roger van Kimmenade, this is about sending messages using MTOM. But unfortunately the WSDL's are not XML-encoded and therefor only visible in the page-URL.
So let's work this out on a step-by-step basis.
XSD/WSDL
I'll start with a simple XSD:<?xml version="1.0" encoding="windows-1252" ?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.darwin-it.nl/MTOM" targetNamespace="http://www.darwin-it.nl/MTOM" elementFormDefault="qualified"> <xsd:element name="mtomRequest" type="MtomRequestType"/> <xsd:complexType name="MtomRequestType"> <xsd:sequence> <xsd:element name="document" type="xsd:base64Binary"/> </xsd:sequence> </xsd:complexType> <xsd:element name="mtomResponse" type="MtomResponseType"/> <xsd:complexType name="MtomResponseType"> <xsd:sequence> <xsd:element name="document" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:schema>
In JDeveloper, this looks like:
The key is the 'xsd:base64Binary' type of the request document. In the response I have a string: in this example I'll base64-encode the attachment using a java-class. Just to show how to process the document. But in my project this is what I need to do.
The WSDL is just as easy, plain synchronous Request-Response:
<wsdl:definitions name="MTOMService" targetNamespace="http://oracle.com/sca/soapservice/ContentServer/MTOMService/MTOMService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:inp1="http://www.darwin-it.nl/MTOM" xmlns:tns="http://oracle.com/sca/soapservice/ContentServer/MTOMService/MTOMService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="http://www.darwin-it.nl/MTOM" schemaLocation="../xsd/MTOMRequestResponse.xsd"/> </xsd:schema> </wsdl:types> <wsdl:message name="requestMessage"> <wsdl:part name="part1" element="inp1:mtomRequest"/> </wsdl:message> <wsdl:message name="replyMessage"> <wsdl:part name="part1" element="inp1:mtomResponse"/> </wsdl:message> <wsdl:portType name="execute_ptt"> <wsdl:operation name="execute"> <wsdl:input message="tns:requestMessage"/> <wsdl:output message="tns:replyMessage"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="execute_pttSOAP11Binding" type="tns:execute_ptt"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="execute"> <soap:operation style="document" soapAction="http://oracle.com/sca/soapservice/ContentServer/MTOMService/MTOMService/execute"/> <wsdl:input> <soap:body use="literal" parts="part1"/> </wsdl:input> <wsdl:output> <soap:body use="literal" parts="part1"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="execute_ptt"> <wsdl:port name="execute_pttPort" binding="tns:execute_pttSOAP11Binding"> <soap:address location="http://www.example.com"/> </wsdl:port> </wsdl:service> </wsdl:definitions>Did you know that in JDeveloper it is really easy to create this WSDL? Just, create a SOA Project, drag and drop a Webservice on the exposed services lane, define a wsdl as synchronous, with a request and response message. Then open the wsdl in the wsdl editor and drag the operations to the binding pane and then the binding to the services pane:
The SoapUI Part
Now, create a new SoapUI project based on this WSDL. It turns out that SoapUI interprets this base64Binary field and creates special content:This body refers to an attachment, that is not yet added:
<mtom:mtomRequest> <mtom:document>cid:915251933163</mtom:document> </mtom:mtomRequest>Let's add an image to it, by opening the 'Attachments' tab and clicking on the plus-button: You can select the 'Part' to which the attachment is to be linked. Doing so will change the 'Type' into 'CONTENT'. Edit either the 'ContentID' or the id in the document-element (indicated by 'cid:') to match eachother.
At this point, you can create a mock-service on the request and set the host of the mockservice to 'localhost' and 'MTOMService' in the mock-service editor:
Then you can right-click on the Mock-server and select 'Add endpoint to interface'.
Running the Request, will send the following message to the Mock Service:
(Altough the title is 'Response 1', what you see here is the request received by the Mock Service).
Apparently SoapUI base64 encoded the attachment and embedded it into the document-element.
Now you can enable MTOM on the request. Select the Request and go to the properties pane:
When running the request again SoapUI won't base 64 encode the attachment but send it as a compressed MIME/Multipart-attachment, with a reference in the document:
In the http-log you'll find:
POST /MTOMService HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@soapui.org>"; start-info="text/xml"; boundary="----=_Part_11_531670487.1435664879005" SOAPAction: "http://oracle.com/sca/soapservice/ContentServer/MTOMService/MTOMService/execute" MIME-Version: 1.0 Content-Length: 39605 Host: localhost:8080 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) ------=_Part_11_531670487.1435664879005 Content-Type: application/xop+xml; charset=UTF-8; type="text/xml" Content-Transfer-Encoding: 8bit Content-ID: <rootpart@soapui.org> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mtom="http://www.darwin-it.nl/MTOM"> <soapenv:Header/> <soapenv:Body> <mtom:mtomRequest> <mtom:document><inc:Include href="cid:915251933163" xmlns:inc="http://www.w3.org/2004/08/xop/include"/></mtom:document> </mtom:mtomRequest> </soapenv:Body> </soapenv:Envelope> ------=_Part_11_531670487.1435664879005 Content-Type: image/jpeg; name=SoapUIMTOMRequest.jpg Content-Transfer-Encoding: binary Content-ID: <915251933163> Content-Disposition: attachment; name="SoapUIMTOMRequest.jpg"; filename="SoapUIMTOMRequest.jpg" [0xff][0xd8][0xff][0xe0][0x0][0x10]JFIF[0x0][0x1][0x1][0x0][0x0][0x1][0x0][0x1][0x0][0x0][0xff][0xdb][0x0]C[0x0][0x6][0x4][0x5][0x6][0x5][0x4][0x6][0x6][0x5][0x6][0x7][0x7][0x6][0x8] [0x10] [0x9][0x9] [0x14][0xe][0xf][0xc][0x10][0x17][0x14][0x18][0x18][0x17][0x14][0x16][0x16][0x1a][0x1d]%[0x1f][0x1a][0x1b]#[0x1c][0x16][0x16] , #&')*)[0x19][0x1f]-0-(0%()([0xff][0xdb][0x0]C[0x1][0x7][0x7][0x7] [0x8] [0x13] [0x13]([0x1a][0x16][0x1a](((((((((((((((((((((((((((((((((((((((((((((((((([0xff][0xc0][0x0][0x11][0x8][0x0][0xdc][0x3]7[0x3][0x1]"[0x0][0x2][0x11][0x1][0x3][0x11][0x1][0xff][0xc4][0x0][0x1b][0x0][0x1][0x0][0x2][0x3][0x1][0x1][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x5][0x6][0x2][0x3][0x4][0x1][0x7][0xff][0xc4][0x0]P[0x10][0x0][0x1][0x2][0x5][0x2][0x3][0x4][0x5][0x8][0x6][0x8][0x4][0x4][0x6][0x3][0x0][0x1][0x2][0x3][0x0][0x4][0x5][0x11][0x12][0x13]![0x6]"#[0x14][0x15]1QAVa[0x95][0xd2][0x7]2[0x81][0x92][0xa5][0xb3][0xd3][0xd4][0x16]37Ru[0x94]45Bqt[0xb1][0xb4][0xd1]$6r[0x91]%Dbs[0x17]&C[0xa1][0xc1][0xe1]cd[0xb2][0xff][0xc4][0x0][0x19][0x1][0x1][0x1][0x1][0x1][0x1][0x1][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0x1][0x2][0x3][0x4][0x5][0xff][0xc4][0x0]5[0x11][0x0][0x1][0x3][0x0][0x8][0x4][0x6][0x2][0x2][0x2][0x2][0x3][0x1][0x0][0x0][0x0][0x0][0x1][0x2][0x11][0x3][0x12]!1AQa[0xf0][0x4][0x14]q[0xc1][0x13]"[0x81][0x91][0xa1][0xd1][0xb1][0xe1]2[0xf1]Bb[0x5][0x92]#r[0xd2]R[0xff][0xda][0x0][0xc][0x3][0x1][0x0][0x2][0x11][0x3][0x11][0x0]?[0x0][0xfb];[0xf2][0x8d]O|[0xa3][0x19][0x19][0x85]L[0x9]4[0xd2];@i[0x99][0x87][0x19][0x19][0x87][0xad][0x97]![0x1b][0xd8][0xda];;[0xbf][0x87][0xae][0xa0]{[0xc0][0x14][0xa8][0xa0][0x85]O[0xcd][\r][0xc1][0xb1][0xf1]W[0xb3][0xc7][0xd3][0xe3][0x1a][0xd8][0xfd][0xaa][0xb9][0xfc][0x8][0xfd][0xfc]j[0x9d][0xfe][0x98][0xff][0x0][0xfe][0xe2][0xbf][0xce]=[0x1c]=[0x12]R[0xaa][0xa2][0x9c])[0xe9]V[0x8d][0x11]P[0xea][0xee][0xfe][0x1d][0xf3][0x9f][0xf7][0x84][0xd7][0xc7][0xe][0xef][0xe1][0xdf]9[0xff][0x0]xM|q[E~[0x9a][0xb9][0x99][0xb6][0xb5][0xd6][0x94][0xca][0xa5]ky[0xf5][0xb2][0xb4][0xcb][0xa4] [0xd9]}b4[0xc9]I[0xb8] *[0xe0][0xa5]W[0xf9][0xa6][0xdd][0x14][0xba][0x94][0xad]R]OI[0xad]d!E[0xb]C[0x8d])[0xa7][0x1b]U[0x81][0xb2][0x90][0xb0][0x14][0x93]b[\r][0x88][0x17][0x4][0x1f][0x2][0xc]z[0xf9]&[0xea]y[0xf9][0x9a]D[0xc0][0x9c][0xee][0xfe][0x1d][0xf3][0x9f][0xf7][0x84][0xd7][0xc7][0xe][0xef][0xe1][0xdf]9[0xff][0x0]xM|q^[0xab][0xd7])4].[0xf8][0xaa]HHk_O[0xb5]L![0xac][0xed]k[0xdb]"/k[0x8f][0xf]1[0x1d]4[0xf9][0xe9]J[0x94][0x9b]st[0xe9][0xa6]&[0xe5]\[0xbe][0xf]0[0xe0]q [0xb1] [0xd9]Ccb[0x8][0xfa]#<[0xa5][0x1c][0xc4][0xa8][0xe6][0x9f]|[0x13][0x1d][0xdf][0xc3][0xbe]s[0xfe][0xf0][0x9a][0xf8][0xe1][0xdd][0xfc];[0xe7]?[0xef][0x9][0xaf][0x8e]#[0xe1][0x17][0x93]fjNm[0xf9]!![0xdd][0xfc];[0xe7]?[0xef][0x9][0xaf][0x8e][0x1d][0xdf][0xc3][0xbe]s[0xfe][0xf0][0x9a][0xf8][0xe2]>[0x10][0xe4][0xd9][0x9a][0x8e]m[0xf9]!![0xdd][0xfc];[0xe7]?[0xef][0x9][0xaf][0x8e][0x1d][0xdf][0xc3][0xbe]s[0xfe][0xf0][0x9a][0xf8][0xe2]>[0x10][0xe4][0xd9][0x9a][0x8e]m[0xf9]!![0xdd][0xfc];[0xe7]?[0xef][0x9][0xaf][0x8e][0x1d][0xdf][0xc3][0xbe]s[0xfe][0xf0][0x9a][0xf8][0xe2][0x1d][0xf9][0xe9]F'%[0xa5][0x1f][0x9a]a[0xa9][0xa9][0xac][0xb4][0x19][[0x81]+w[0x11]u`[0x93][0xba][0xac]76[0xf0][0x8d][0xb3] [0xc6]Y[0xf5]j-[0xab]4[0xbe]t7[0xa8][0xa4][0xf2][0x9d][0xd2][0x9c]Uuy[0xb][0x1d][0xed][0xe]M[0x99][0xa9]y[0xa7][0xe4][0x84][0x9f]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xce]Q[0x9a][0x97][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x87]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8[0x87][0x9a][[0xe8][0xed]Yj[0xb3][0x82][0x14][0x95]`[0x82][0xbd][0x4]u[0xb1])[0xe9][0x1d]G[0x8d][0x93][0xcb][0xbd][0xb6][0xfa]SK}[0x1d][0xab]-VpB[0x92][0xac][0x10]W[0xa0][0x8e][0xb6]%=#[0xa8][0xf1][0xb2]yw[0xb6][0xdf]K[0x94]f[0xa3][0x99]~[0x84][0xc7]w[0xf0][0xef][0x9c][0xff][0x0][0xbc]&[0xbe]8w[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x88]y[0xa5][0xbe][0x8e][0xd5][0x96][0xab]8!IV[0x8]+[0xd0]G[[0x12][0x9e][0x91][0xd4]x[0xd9]<[0xbb][0xdb]o[0xa5]4[0xb7][0xd1][0xda][0xb2][0xd5]g[0x4])*[0xc1][0x5]z[0x8][0xeb]bS[0xd2]:[0x8f][0x1b]'[0x97]{m[0xf4][0xb9]Fj9[0x97][0xe8]Lw[0xe][0xf9][0xcf][0xfb][0xc2]k[0xe3][0x84]G[0xb2][0xa7][0xd3]>B[0x92][0x96][0xf0]8[0xa9].$[0xa9][0xb6]Qwq$[0xe9]s[0xb8][0xab]&[0xe9][0xbf]([0xff][0x0][0xee][0x8c][0xaf] [0xc4][0xcf]~[0x85]N%[0xda]o[0xd4][0xeb]c[0xf6][0xaa][0xe7][0xf0]#[0xf7][0xf1][0xaa]w[0xfa]c[0xff][0x0][0xfb][0x8a][0xff][0x0]8[0xda][0xc7][0xed]U[0xcf][0xe0]G[0xef][0xe3]T[0xef][0xf4][0xc7][0xff][0x0][0xf7][0x15][0xfe]q[0x8e][0xf][0xf9])[0xae].[0xe4]>r[0x95]PMG[0x89][0x9e][0xa9][0xbd]:[0xe4][0xbc][0xd4][0xb4][0xc8][0x98]q[0xd6][0xdb]m[0xb7][0x98]d[0xe9][0xbe][0x94][0xe8][0x80][0xe2][0xb4][0xc9][0x8][0x5][0xc0]V[0x7][0xea][0xc9][0x5]D[0xcd][0xf0][0x13][0xb2]st[0x97][0xa7]d[0xdd][0x9a]}[0xc9][0x97][0xca][0xdf]~eM)N[0xad])J[0x1][0xc9][0x9e][0x92][0x80]JP[0x9b][0xb7][0xb7]-[0x8f]0Tl[0xfd][0xc][0xe1][0xf0][0xf4][0xf3][0xc9][0xa6]2[0x87][0xa7][0x9b][0x98]je[0xc4][0x12][0x95][0xbc][0x87][0xd5][0x93][0x81]J[0x6][0xe6][0xe7][0xc3][0xd2][0x9f][0x4][0xd8]m[0x16][0x4][0xa4]$XG[0xd3]s[0x91]n[0xde][0xf1]<[0xae]rD![0xf2]?[0x96]t:[0xe7][0x1d][0xf0] [0x18][0xa1][0xb1]_p[0xf7][0x85][0xa9][0xcf][0xad][0x8]C[0xdd]$x[0x95][0x82][0x91]o[0x9d][0xb8][0xfe][0xcf][0x9c]Gp[0x85]~_[0x85]>F8[0x87][0x8a][0xa8][0x89][0x90][0x98]T[0xd4][0xfb][0x93][0xa8][0x91]d[0x94][0xb7]"[0xb7]V[0xdb]ia[[0x2]p[0x5]$[0x80][0x13]q[0xb0][0xd8][0x85][0x1f][0xae][0xce][0xd1]i[0xf3][0xd5]zmRj_9[0xea]n[0xaf]ew5[\r]=D[0xe2][0xbd][0x81][0xb1][0xb8][0x16][0xdc][0x1b]z#[0x9e]O[0x85][0xe8][0x92]s[0x95][0x99][0x99]jk[0x8]r[0xb1]n[0xde][0x8]%[0x13][0x16]
Where I removed all the new-line and timing codings, for readability. This is what actually goes 'over the line'.
The OSB Part
Now we're ready for the OSB part. Create a new OSB project and add the wsdl and xsd to it. If you created the wsdl, like I did, in JDeveloper, you can create the OSB project with the same name in the same folder as the JDeveloper project.Create a new Proxy Service, and name it 'MTOMService' for instance. Base it on the MTOMService wsdl, created above.
I added a Pipeline, with stages and alerts to log the $attachments and $body variables. However, it turns out that since we're using MTOM via a base64Binary-element, the Attachments variable is empty. The body variable contains the message as seen in SoapUI.
Now, the most interesting part here is: 'How to get to the attachment-content?' Using 'Soap with Attachments' (SwA), the $attachments variable gives access to the binary content, with an expression like:
$attachments/ctx:attachment[ctx:Content-ID/text()=$contentId]/ctx:body/ctx:binary-content
Where 'ctx:' is an internal namespace of OSB:
But since the $attachments is empty, this won't work. It is the base64Binary element that gives access to the content, in just the same way. So the expression is:
$body//mtom:document/ctx:binary-content
I added an assign with this as an expression to a seperate variable called 'documentBin'.
Then I added a Java Callout to my Base64-encoding method. For this I used the class described in my previous article. I jarred it and added the jar to my project. The input of this class is a '
byte
[] bytes
' and the output is a 'String' for wich I used the variable 'documentB64'. Then I added a replace with the following to pass back the response:<mtom:mtomResponse xmlns:mtom="http://www.darwin-it.nl/MTOM">
<mtom:document>{$documentB64}</mtom:document>
</mtom:mtomResponse>
Then, an important setting: enable MTOM: go to the Message Handling tab of the proxy service:
Check the box 'Enabled' of 'XOP/MTOM Support'. Leave radio-button to 'Include Binary Data by Reference'. Save the proxy service.
The proof in the eating
Now, publish it to a running OSB server and change the Endpoint URL within SoapUI to the OSB Service.Running the SoapUI Request via OSB results in the following response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header xmlns:mtom="http://www.darwin-it.nl/MTOM"/> <soapenv:Body xmlns:mtom="http://www.darwin-it.nl/MTOM"> <mtom:mtomResponse> <mtom:document>/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwg....</mtom:document> </mtom:mtomResponse> </soapenv:Body> </soapenv:Envelope>
The Alert of the documentB64 variable shows: