title: Error consuming SOAP 1.1 operation send attachment using MTOM optimization
body: <p>I'm trying to consume a SOAP service that receives a message with an attachment. With SoapUI I made the call the service with success, but using WSO2 Integrator I receive the follow response error from server:</p>
  
  <p></p>
  
  <pre><code>OSB-382000: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&amp;lt;'
   at [row,col {unknown-source}]: [1,1]&lt;/faultstring&gt;&lt;detail&gt;&lt;con:stack-trace xmlns:con="http://www.bea.com/wli/sb/context"&gt;com.bea.wli.sb.service.handlerchain.HandlerException: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&amp;lt;'
   at [row,col {unknown-source}]: [1,1]
      at com.bea.wli.sb.service.disi.handlerchain.handlers.InboundDISIHandler.dispatch(InboundDISIHandler.java:148)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.disi.handlerchain.handlers.InboundWssPhase1DISIHandler.dispatch(InboundWssPhase1DISIHandler.java:100)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.InboundMessageContentHandler.dispatch(InboundMessageContentHandler.java:169)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.CheckAccessControl.dispatch(CheckAccessControl.java:65)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.UpdateInboundTransportStatistics.dispatch(UpdateInboundTransportStatistics.java:64)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.InboundMessageTracing.dispatch(InboundMessageTracing.java:80)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.DefaultInboundErrorHandler.dispatch(DefaultInboundErrorHandler.java:44)
      at com.bea.wli.sb.service.handlerchain.InboundHandlerChain.dispatch(InboundHandlerChain.java:134)
      at com.bea.wli.sb.transports.TransportDispatcherClient.dispatch(TransportDispatcherClient.java:91)
      at com.bea.wli.sb.transports.TransportManagerImpl.receiveMessage(TransportManagerImpl.java:352)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase.invokePipeline(RequestHelperBase.java:200)
      at com.bea.wli.sb.transports.http.wls.HttpTransportServlet$RequestHelperWLS.invokePipeline(HttpTransportServlet.java:228)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase$1.run(RequestHelperBase.java:175)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase$1.run(RequestHelperBase.java:173)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
      at com.bea.wli.sb.util.security.SecurityUtils.executeAs(SecurityUtils.java:102)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase.securedInvoke(RequestHelperBase.java:172)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase.service(RequestHelperBase.java:124)
      at com.bea.wli.sb.transports.http.wls.HttpTransportServlet.service(HttpTransportServlet.java:129)
      at weblogic.servlet.FutureResponseServlet.service(FutureResponseServlet.java:24)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:220)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
      at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
      at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
  </code></pre>
  
  <p>I suspect that the error is due the HTTP headers, but I can't find any other reference to change those headers to look like the SoapUI ones. Some headers are equals, others not. I tried to set some header to make these same as in SoapUI, no success.</p>
  
  <p>Following are the resource that I'm using (removed all logs to fit here). Payload is resumed due sensitive data, but assume that SOAP envelope generated by WSO2 Integrator is ok, since the same envelope submitted from SoapUI is received without any error from server:</p>
  
  <p>Endpoint:</p>
  
  <p></p>
  
  <pre><code>&lt;endpoint xmlns="http://ws.apache.org/ns/synapse" name="envio_informacao_res_dados_clinicos"&gt;
      &lt;address uri="http://xpto.com.br/service?WSDL" format="soap11" optimize="mtom"&gt;
          &lt;enableSec policy="wssSecurityRES"/&gt;
      &lt;/address&gt;
  &lt;/endpoint&gt;
  </code></pre>
  
  <p>Sequence (to set the attachment to payload):</p>
  
  <p></p>
  
  <pre><code>&lt;sequence xmlns="http://ws.apache.org/ns/synapse" name="attachment"&gt;
      &lt;property name="attachmentContent" expression="get-property('ATTACHMENT_CONTENT')"/&gt;
      &lt;property name="attachmentContentID" expression="get-property('ATTACHMENT_CONTENT_ID')"/&gt;
      &lt;class name="br.com.modoagil.MTOMAttachmentFilesMediator"/&gt;
  &lt;/sequence&gt;
  </code></pre>
  
  <p>Proxy service (for test only):</p>
  
  <p></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;proxy xmlns="http://ws.apache.org/ns/synapse" name="AttachmentFileProxyService" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"&gt;
    &lt;target&gt;
      &lt;inSequence&gt;
        &lt;property name="ATTACHMENT_CONTENT" expression="$body/*" /&gt;
        &lt;property name="ATTACHMENT_CONTENT_ID" value="AnexoLaboratorio.xml" /&gt;
        &lt;payloadFactory media-type="xml"&gt;
          &lt;format&gt;
            &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://xpto.com.br/schemas/servico/envio/informacao/res/v1.00" xmlns:v17="http://xpto.com.br/schemas/comum/tipos/complexos/anexos/v1.00" xmlns:xm="http://www.w3.org/2005/05/xmlmime"&gt;
              &lt;soapenv:Header /&gt;
              &lt;soapenv:Body&gt;
                &lt;v1:requisicaoEnvioInformacaoRES&gt;
                  &lt;v1:cabecalhoRequisicao&gt;
                    &lt;!-- omitted --&gt;
                  &lt;/v1:cabecalhoRequisicao&gt;
                  &lt;v1:corpoRequisicao&gt;
                    &lt;v1:beneficiario&gt;
                      &lt;!-- omitted --&gt;
                    &lt;/v1:beneficiario&gt;
                    &lt;v1:profissional&gt;
                      &lt;!-- omitted --&gt;
                    &lt;/v1:profissional&gt;
                    &lt;v1:informacaoClinica&gt;
                      &lt;v17:anexoComposicao xm:contentType="application/xml" xm:expectedContentTypes="application/xml" /&gt;
                      &lt;!-- omitted --&gt;
                    &lt;/v1:informacaoClinica&gt;
                  &lt;/v1:corpoRequisicao&gt;
                &lt;/v1:requisicaoEnvioInformacaoRES&gt;
              &lt;/soapenv:Body&gt;
            &lt;/soapenv:Envelope&gt;
          &lt;/format&gt;
          &lt;args /&gt;
        &lt;/payloadFactory&gt;
        &lt;sequence key="attachment" /&gt;
        &lt;header name="Action" action="remove" /&gt;
        &lt;property name="SOAPAction" action="remove" /&gt;
        &lt;property name="FORCE_HTTP_1.0" value="true" scope="axis2" /&gt;
        &lt;property name="SOAPAction" value="envio_informacao_res" scope="transport" /&gt;
        &lt;property name="Proxy-Authorization" scope="transport" expression="fn:concat('Basic ', base64Encode('ZZZZ:YYYY'))" /&gt;
        &lt;send&gt;
          &lt;endpoint key="envio_informacao_res_dados_clinicos" /&gt;
        &lt;/send&gt;
      &lt;/inSequence&gt;
      &lt;outSequence&gt;
        &lt;property name="enableMTOM" value="true" scope="axis2" /&gt;
        &lt;send /&gt;
      &lt;/outSequence&gt;
    &lt;/target&gt;
  &lt;/proxy&gt;
  </code></pre>
  
  <p>Custom Mediator:</p>
  
  <p></p>
  
  <pre><code>import java.io.IOException;
  import java.nio.charset.Charset;
  import java.nio.file.Files;
  import java.nio.file.Path;
  
  import javax.activation.DataHandler;
  import javax.activation.FileDataSource;
  import javax.xml.namespace.QName;
  
  import org.apache.axiom.om.OMElement;
  import org.apache.axiom.om.OMFactory;
  import org.apache.axiom.om.OMText;
  import org.apache.axiom.soap.SOAPBody;
  import org.apache.synapse.MessageContext;
  import org.apache.synapse.SynapseException;
  import org.apache.synapse.mediators.AbstractMediator;
  
  public class MTOMAttachmentFilesMediator extends AbstractMediator {
  
      @Override
      public boolean mediate(final MessageContext context) {
          this.addAttachmentToRequest(context);
          return true;
      }
  
      private void addAttachmentToRequest(final MessageContext context) {
          final String attachmentContent = (String) context.getProperty("attachmentContent");
          final String attachmentContentID = (String) context.getProperty("attachmentContentID");
  
          Path tempContentFile = null;
          try {
              tempContentFile = Files.createTempFile(attachmentContentID + "-" + System.currentTimeMillis(), ".bin");
              Files.write(tempContentFile, attachmentContent.getBytes(Charset.defaultCharset()));
          } catch (final IOException e) {
              super.handleException("Error while creating attachment file: " + e.getMessage(), e, context);
          }
  
          if (tempContentFile == null) {
              throw new SynapseException("Temporary attachment file must not be null here");
          }
  
          final SOAPBody body = context.getEnvelope().getBody();
          final OMElement requisicaoEnvioInformacaoRES = body.getFirstElement();
          final OMElement corpoRequisicao = (OMElement) requisicaoEnvioInformacaoRES.getChildrenWithName(new QName("corpoRequisicao")).next();
          final OMElement informacaoClinica = (OMElement) corpoRequisicao.getChildrenWithName(new QName("informacaoClinica")).next();
  
          final OMFactory factory = informacaoClinica.getOMFactory();
  
          final OMElement anexoComposicao = (OMElement) informacaoClinica.getChildrenWithName(new QName("anexoComposicao")).next();
          final FileDataSource fileDataSource = new FileDataSource(tempContentFile.toFile());
          final DataHandler dataHandler = new DataHandler(fileDataSource);
          final OMText bynaryNode = factory.createOMText(dataHandler, true);
          bynaryNode.setContentID(attachmentContentID);
          anexoComposicao.addChild(bynaryNode);
      }
  
  }
  </code></pre>
  
  <p>SoapUI "full request/response":</p>
  
  <p></p>
  
  <pre><code>POST /service?WSDL HTTP/1.1
  Accept-Encoding: gzip,deflate
  Content-Type: multipart/related; type="application/xop+xml"; start="&lt;rootpart@soapui.org&gt;"; start-info="text/xml"; boundary="----=_Part_10_1408830521.1496694507193"
  SOAPAction: "envio_informacao_res"
  Authorization: Basic omitted
  MIME-Version: 1.0
  Content-Length: 33427
  Host: xpto.com.br.br:7300
  Connection: Keep-Alive
  User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
  
  ------=_Part_10_1408830521.1496694507193
  
  Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
  Content-Transfer-Encoding: 8bit
  Content-ID: &lt;rootpart@soapui.org&gt;
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://xpto.com.br/schemas/servico/envio/informacao/res/v1.00" xmlns:v17="http://xpto.com.br/schemas/comum/tipos/complexos/anexos/v1.00" xmlns:xm="http://www.w3.org/2005/05/xmlmime"&gt;
      &lt;soapenv:Header&gt;
          &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
              &lt;wsse:UsernameToken wsu:Id="UsernameToken-CAD2037163FCADC4A5149669450719220"&gt;
                  &lt;wsse:Username&gt;omitted&lt;/wsse:Username&gt;
                  &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"&gt;omitted&lt;/wsse:Password&gt;
                  &lt;wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"&gt;omitted==&lt;/wsse:Nonce&gt;
                  &lt;wsu:Created&gt;2017-06-05T20:28:27.192Z&lt;/wsu:Created&gt;
              &lt;/wsse:UsernameToken&gt;
          &lt;/wsse:Security&gt;
      &lt;/soapenv:Header&gt;
      &lt;soapenv:Body&gt;
          &lt;v1:requisicaoEnvioInformacaoRES&gt;
              &lt;v1:cabecalhoRequisicao&gt;
                  &lt;!-- omitted --&gt;
              &lt;/v1:cabecalhoRequisicao&gt;
              &lt;v1:corpoRequisicao&gt;
                  &lt;v1:beneficiario&gt;
                      &lt;!-- omitted --&gt;
                  &lt;/v1:beneficiario&gt;
                  &lt;v1:profissional&gt;
                      &lt;!-- omitted --&gt;
                  &lt;/v1:profissional&gt;
                  &lt;v1:informacaoClinica&gt;
                      &lt;v17:anexoComposicao xm:contentType="application/xml" xm:expectedContentTypes="application/xml"&gt;
                          &lt;inc:Include xmlns:inc="http://www.w3.org/2004/08/xop/include" href="cid:AnexoLaboratorio.xml" /&gt;
                      &lt;/v17:anexoComposicao&gt;
                      &lt;!-- omitted --&gt;
                  &lt;/v1:informacaoClinica&gt;
              &lt;/v1:corpoRequisicao&gt;
          &lt;/v1:requisicaoEnvioInformacaoRES&gt;
      &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  
  ------=_Part_10_1408830521.1496694507193
  
  Content-Type: text/xml; charset=us-ascii; name=AnexoLaboratorio.xml
  Content-Transfer-Encoding: 7bit
  Content-ID: &lt;AnexoLaboratorio.xml&gt;
  Content-Disposition: attachment; name="AnexoLaboratorio.xml"; filename="AnexoLaboratorio.xml"
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Clinical_Summary_Events xmlns:oe="http://schemas.openehr.org/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.oceanehr.com/templates" archetype_node_id="openEHR-EHR-COMPOSITION.encounter.v1" template_id="clinical-summary-events" type="COMPOSITION" xsi:schemaLocation="http://schemas.oceanehr.com/templates templates/clinical-summary-events.xsd"&gt;
    &lt;!-- omitted --&gt;
  &lt;/Clinical_Summary_Events&gt;
  
  ------=_Part_10_1408830521.1496694507193--
  
  ##### RESPONSE #####
  
  HTTP/1.1 200 OK
  Server: Oracle-Traffic-Director/11.1.1.9
  Date: Mon, 05 Jun 2017 20:28:30 GMT
  Content-length: 3463
  Content-type: text/xml; charset=UTF-8
  X-oracle-dms-ecid: XeMsH1O_000000000
  Via: 1.1 net-QA
  Proxy-agent: Oracle-Traffic-Director/11.1.1.9
  
  &lt;soapenv:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soapenv:Header/&gt;&lt;soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;ptucsseir:respostaEnvioInformacaoRES xmlns:ptucsseir="http://xpto.com.br/schemas/servico/envio/informacao/res/v1.00"&gt; &lt;!-- omitted --&gt;&lt;/ptucsseir:respostaEnvioInformacaoRES&gt;&lt;/soap-env:Body&gt;&lt;/soapenv:Envelope&gt;"
  </code></pre>
  
  <p>WSO2 EI "full request/response": </p>
  
  <p></p>
  
  <pre><code>POST /service?WSDL HTTP/1.0
  SOAPAction: envio_informacao_res
  Accept-Encoding: gzip,deflate
  Proxy-Authorization: Basic omitted
  Content-Type: text/xml; charset=UTF-8
  Content-Length: 41934
  Host: xpto.com.br:7300
  Connection: Keep-Alive
  User-Agent: Synapse-PT-HttpComponents-NIO
  
  --MIMEBoundary_20282c2967f861ead2423a50af020431e31644c6c1d1eeb6
  
  Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
  Content-Transfer-Encoding: binary
  Content-ID: &lt;0.30282c2967f861ead2423a50af020431e31644c6c1d1eeb6@apache.org&gt;
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://xpto.com.br/schemas/servico/envio/informacao/res/v1.00" xmlns:v17="http://xpto.com.br/schemas/comum/tipos/complexos/anexos/v1.00" xmlns:xm="http://www.w3.org/2005/05/xmlmime"&gt;
      &lt;soapenv:Header&gt;
          &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1"&gt;
              &lt;wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1"&gt;
                  &lt;wsse:Username&gt;omitted&lt;/wsse:Username&gt;
                  &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"&gt;omitted&lt;/wsse:Password&gt;
                  &lt;wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"&gt;omitted&lt;/wsse:Nonce&gt;
                  &lt;wsu:Created&gt;2017-06-06T15:01:38.098Z&lt;/wsu:Created&gt;
              &lt;/wsse:UsernameToken&gt;
          &lt;/wsse:Security&gt;
      &lt;/soapenv:Header&gt;
      &lt;soapenv:Body&gt;
          &lt;v1:requisicaoEnvioInformacaoRES&gt;
              &lt;v1:cabecalhoRequisicao&gt;
                  &lt;!-- omitted --&gt;
              &lt;/v1:cabecalhoRequisicao&gt;
              &lt;v1:corpoRequisicao&gt;
                  &lt;v1:beneficiario&gt;
                      &lt;!-- omitted --&gt;
                  &lt;/v1:beneficiario&gt;
                  &lt;v1:profissional&gt;
                      &lt;!-- omitted --&gt;
                  &lt;/v1:profissional&gt;
                  &lt;v1:informacaoClinica&gt;
                      &lt;v17:anexoComposicao xm:contentType="application/xml" xm:expectedContentTypes="application/xml"&gt;
                          &lt;xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:AnexoLaboratorio.xml" /&gt;
                      &lt;/v17:anexoComposicao&gt;
                      &lt;!-- omitted --&gt;
                  &lt;/v1:informacaoClinica&gt;
              &lt;/v1:corpoRequisicao&gt;
          &lt;/v1:requisicaoEnvioInformacaoRES&gt;
      &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  
  --MIMEBoundary_20282c2967f861ead2423a50af020431e31644c6c1d1eeb6
  
  Content-Type: application/octet-stream
  Content-Transfer-Encoding: binary
  Content-ID: &lt;AnexoLaboratorio.xml&gt;
  
  &lt;Clinical_Summary_Events xmlns="http://schemas.oceanehr.com/templates" xmlns:oe="http://schemas.openehr.org/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" archetype_node_id="openEHR-EHR-COMPOSITION.encounter.v1" template_id="clinical-summary-events" type="COMPOSITION" xsi:schemaLocation="http://schemas.oceanehr.com/templates templates/clinical-summary-events.xsd"&gt;
      &lt;!-- omitted --&gt;
  &lt;/Clinical_Summary_Events&gt;
  
  --MIMEBoundary_20282c2967f861ead2423a50af020431e31644c6c1d1eeb6--
  
  ##### RESPONSE #####
  
  --MIMEBoundary_00282c2967f861ea3c123a50af020431f31644c6c1d1eeb6
  Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
  Content-Transfer-Encoding: binary
  Content-ID: &lt;0.10282c2967f861ea3c123a50af020431f31644c6c1d1eeb6@apache.org&gt;
  
  &lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soapenv:Body&gt;&lt;soapenv:Fault&gt;&lt;faultcode&gt;soapenv:Server&lt;/faultcode&gt;&lt;faultstring&gt;OSB-382000: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&amp;lt;'
   at [row,col {unknown-source}]: [1,1]&lt;/faultstring&gt;&lt;detail&gt;&lt;con:stack-trace xmlns:con="http://www.bea.com/wli/sb/context"&gt;com.bea.wli.sb.service.handlerchain.HandlerException: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&amp;lt;'
   at [row,col {unknown-source}]: [1,1]
      at com.bea.wli.sb.service.disi.handlerchain.handlers.InboundDISIHandler.dispatch(InboundDISIHandler.java:148)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.disi.handlerchain.handlers.InboundWssPhase1DISIHandler.dispatch(InboundWssPhase1DISIHandler.java:100)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.InboundMessageContentHandler.dispatch(InboundMessageContentHandler.java:169)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.CheckAccessControl.dispatch(CheckAccessControl.java:65)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.UpdateInboundTransportStatistics.dispatch(UpdateInboundTransportStatistics.java:64)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.InboundMessageTracing.dispatch(InboundMessageTracing.java:80)
      at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:131)
      at com.bea.wli.sb.service.handlerchain.handlers.DefaultInboundErrorHandler.dispatch(DefaultInboundErrorHandler.java:44)
      at com.bea.wli.sb.service.handlerchain.InboundHandlerChain.dispatch(InboundHandlerChain.java:134)
      at com.bea.wli.sb.transports.TransportDispatcherClient.dispatch(TransportDispatcherClient.java:91)
      at com.bea.wli.sb.transports.TransportManagerImpl.receiveMessage(TransportManagerImpl.java:352)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase.invokePipeline(RequestHelperBase.java:200)
      at com.bea.wli.sb.transports.http.wls.HttpTransportServlet$RequestHelperWLS.invokePipeline(HttpTransportServlet.java:228)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase$1.run(RequestHelperBase.java:175)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase$1.run(RequestHelperBase.java:173)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
      at com.bea.wli.sb.util.security.SecurityUtils.executeAs(SecurityUtils.java:102)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase.securedInvoke(RequestHelperBase.java:172)
      at com.bea.wli.sb.transports.http.generic.RequestHelperBase.service(RequestHelperBase.java:124)
      at com.bea.wli.sb.transports.http.wls.HttpTransportServlet.service(HttpTransportServlet.java:129)
      at weblogic.servlet.FutureResponseServlet.service(FutureResponseServlet.java:24)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:220)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
      at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
      at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
  Caused by: com.sun.xml.ws.protocol.soap.MessageCreationException: Couldn't create SOAP message due to exception: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&amp;lt;'
   at [row,col {unknown-source}]: [1,1]
      at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:319)
      at com.sun.xml.ws.api.message.MessageContextFactory.createContext(MessageContextFactory.java:130)
      at com.oracle.webservices.impl.disi.context.DISIMessageContextFactory.createContext(DISIMessageContextFactory.java:114)
      at com.oracle.webservices.impl.disi.service.DISIAdapter$2.createContext(DISIAdapter.java:227)
      at com.bea.wli.sb.service.disi.handlerchain.handlers.InboundDISIHandler.dispatch(InboundDISIHandler.java:88)
      ... 47 more
  Caused by: com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&amp;lt;'
   at [row,col {unknown-source}]: [1,1]
      at com.sun.xml.ws.streaming.XMLStreamReaderUtil.wrapException(XMLStreamReaderUtil.java:326)
      at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:99)
      at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextContent(XMLStreamReaderUtil.java:169)
      at com.sun.xml.ws.streaming.XMLStreamReaderUtil.nextElementContent(XMLStreamReaderUtil.java:104)
      at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:215)
      at com.oracle.webservices.impl.encoding.StreamDecoderImpl.decode(StreamDecoderImpl.java:64)
      at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:249)
      at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:166)
      at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:314)
      ... 51 more
  Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&amp;lt;'
   at [row,col {unknown-source}]: [1,1]
      at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
      at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052)
      at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
      at com.sun.xml.ws.util.xml.XMLStreamReaderFilter.next(XMLStreamReaderFilter.java:96)
      at com.sun.xml.ws.streaming.XMLStreamReaderUtil.next(XMLStreamReaderUtil.java:80)
      ... 58 more
  &lt;/con:stack-trace&gt;&lt;/detail&gt;&lt;/soapenv:Fault&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;
  --MIMEBoundary_00282c2967f861ea3c123a50af020431f31644c6c1d1eeb6--
  </code></pre>
  
  <p>So, does anyone have a similar problem to do SOAP/MTOM request with WSO2 EI/WSO2 ESB?</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>WSO2 Integration version: <code>6.1.1</code></p>
  
  <p>WSO2 EI is running with default configuration, no configuration was changed, not even properties to enable MTOM in <code>axis2.xml</code> configuration file.</p>