I am using SoapUI 5.1.3 version. I am sending below request to the we service.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:upl="http://upload.application.carbon.wso2.org" xmlns:xsd="http://upload.application.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<upl:uploadApp>
<!--Zero or more repetitions:-->
<upl:fileItems>
<!--Optional:-->
<xsd:dataHandler>UEsDBBLjAuMC52MjAxMTA1MjcxNTIxMDAvYXJ0aWZhY3QueG1sUEsFBgAAAAAJAAkAMAMAAC4IAAAAAA==</xsd:dataHandler>
<!--Optional:-->
<xsd:fileName>ESBproject1-1.0.0.car</xsd:fileName>
<!--Optional:-->
<xsd:fileType>jar</xsd:fileType>
</upl:fileItems>
</upl:uploadApp>
</soapenv:Body>
</soapenv:Envelope>
at the web service end, when I check the dataHandler value seems like it is truncated at the end of the string. I inserted file using Insert file as Base64
context menu option. I changed Enable MTOM
property to true. what could be the reason for missing a part of data that sends to web service?
UPDATE
I wrote a HTTP server to capture the soap request without sending it to the web service by changing the url in SoapUI to http://localhost:5000/
. below is the server I wrote
public static void main(String[] args) throws Exception {
ServerSocket server = new ServerSocket(5000);
Socket conn = server.accept();
StringBuilder sb = new StringBuilder();
//getBytes() method returns a byte array for InputStream
ByteArrayInputStream reader = new ByteArrayInputStream(getBytes(conn.getInputStream()));
int ch;
while ( (ch = reader.read()) != -1) {
sb.append((char)ch);
}
System.out.println("Your message: "+sb.toString());
}
after running the HTTP server I sent the above mentioned soap request and I could have seen that http client also received the same request as above. but since I have enabled MTOM, SoapUI request should be modified and HTTP server should received different request from the above soap request. According to MTOM definition as described in this SO question, binary dataHandler value should be moved to out of the envelop. it should be replaced with xop tag and a reference. As an example envelop should be something like below.
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns2:uploadApp xmlns:ns2="http://upload.application.carbon.wso2.org">
<ns2:fileItems>
<ns1:dataHandler xmlns:ns1="http://upload.application.carbon.wso2.org/xsd">
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:[email protected]" />
</ns1:dataHandler>
<ns1:fileName xmlns:ns1="http://upload.application.carbon.wso2.org/xsd">ESBproject1-1.0.0.car</ns1:fileName>
<ns1:fileType xmlns:ns1="http://upload.application.carbon.wso2.org/xsd">jar</ns1:fileType>
</ns2:fileItems>
</ns2:uploadApp>
</soapenv:Body>
</soapenv:Envelope>
my problem now is, is that the correct way to enable MTOM in SoapUI or is this a bug?