MTOM - Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] - soap

I'm trying to send multipart/related request through postman. But I'm getting error:
<soap:Reason>
<soap:Text xml:lang="en">Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]</soap:Text>
</soap:Reason>
Endpoint: POST https://sdummy.test.net/enterprise/soap?ServiceName=IntegrationManagementService
Headers I'm using:
Content-Type:multipart/related; start="<rootpart*7661941e-06d9-4961-af10-db612c7ffcc4#example.jaxws.sun.com>"; type="application/xop+xml"; boundary="uuid:7661941e-06d9-4961-af10-db612c7ffcc4"; start-info="text/xml"
Soapaction:http://www.taleo.com/ws/integration/toolkit/2011/05/management/IntegrationManagementService#submitLargeDocument
Accept:text/xml, multipart/related, text/html, image/gif, image/jpeg, *;q=.2, */*; q=.2
User-Agent:Oracle JAX-WS 2.1.5
Transfer-Encoding:chunked
Host:sdummy.test.net
Payload:
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4#example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/03/addressing" xmlns:tns="http://www.taleo.com/ws/integration/toolkit/2011/05/management">
<SOAP-ENV:Header>
<wsa:MessageID>ps_sd_7701</wsa:MessageID>
<wsa:Action>http://www.taleo.com/ws/integration/toolkit/2005/07/action/import</wsa:Action>
<wsa:ReplyTo>
<wsa:Address>http://www.taleo.com/ws/integration/toolkit/2005/07/addressing/queue</wsa:Address>
</wsa:ReplyTo>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsa:submitLargeDocument>
<wsa:Document>
<Include xmlns="http://www.w3.org/2004/08/xop/include" href="cid:51349b7a-562a-4e98-ab8c-736cfecb03eb#example.jaxws.sun.com"/>
</wsa:Document>
</wsa:submitLargeDocument>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id:<51349b7a-562a-4e98-ab8c-736cfecb03eb#example.jaxws.sun.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: binary
<ImportEntities>
<Candidate>
<EmailAddress>test11#mailinator.com</EmailAddress>
</Candidate>
</ImportEntities>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4--
Postman Generated cURL command:
curl --location --request POST 'https://stghilton.taleo.net/enterprise/soap?ServiceName=IntegrationManagementService' \
--header 'Content-Type: multipart/related; start="<rootpart*7661941e-06d9-4961-af10-db612c7ffcc4#example.jaxws.sun.com>"; type="application/xop+xml"; boundary="uuid:7661941e-06d9-4961-af10-db612c7ffcc4"; start-info="text/xml"' \
--header 'Soapaction: http://www.taleo.com/ws/integration/toolkit/2011/05/management/IntegrationManagementService#submitLargeDocument' \
--header 'Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *;q=.2, */*; q=.2' \
--header 'User-Agent: Oracle JAX-WS 2.1.5' \
--header 'Transfer-Encoding: chunked' \
--header 'Host: stghilton.taleo.net' \
--header 'Authorization: Basic UGhlbm9tOj80K2pTSlAz' \
--data-raw '--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4#example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='\''1.0'\'' encoding='\''UTF-8'\''?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/03/addressing" xmlns:tns="http://www.taleo.com/ws/integration/toolkit/2011/05/management">
<SOAP-ENV:Header>
<wsa:MessageID>ps_sd_7701</wsa:MessageID>
<wsa:Action>http://www.taleo.com/ws/integration/toolkit/2005/07/action/import</wsa:Action>
<wsa:ReplyTo>
<wsa:Address>http://www.taleo.com/ws/integration/toolkit/2005/07/addressing/queue</wsa:Address>
</wsa:ReplyTo>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsa:submitLargeDocument>
<wsa:Document>
<Include xmlns="http://www.w3.org/2004/08/xop/include" href="cid:51349b7a-562a-4e98-ab8c-736cfecb03eb#example.jaxws.sun.com"/>
</wsa:Document>
</wsa:submitLargeDocument>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id:<51349b7a-562a-4e98-ab8c-736cfecb03eb#example.jaxws.sun.com>
Content-Type: text/xml; charset=ISO-8859-1
Content-Transfer-Encoding: binary
<ImportEntities>
<Candidate>
<EmailAddress>test11#mailinator.com</EmailAddress>
</Candidate>
</ImportEntities>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4--'
Can someone help me with this please?

From a purely technical point of view the only error I can see is your handling of the multipart structure.
More precisely, you need to skip a line (blank line) between the headers of each part and their body, e.g change the 3 lines :
Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4#example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='\''1.0'\'' encoding='\''UTF-8'\''?>
To 4 lines :
Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4#example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='\''1.0'\'' encoding='\''UTF-8'\''?>
At each part, e.g. also here :
Content-Transfer-Encoding: binary
<ImportEntities>
To
Content-Transfer-Encoding: binary
<ImportEntities>
It is mandatory in multipart content to split the header from the body by a blank line.

Related

Basic auth credentials using headers in soap on groovy

I'm trying to connect to WSDL server, which requires basic auth along with the body. I tried hitting with SOAPUI, and was able to do so. While working for the same in groovy and using wslite package for SOAP call, I'm getting error as "Password required".
I tried the tutorial on https://github.com/jwagenleitner/groovy-wslite, but the method described (in Usage block) didn't help.
I'm using groovy for this.
Below is the raw code from SOAP UI, with response 200OK
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:w="http://xmlns.oracle.com/Enterprise/Tools/schemas/W_CHKLST_CREATE_REQ.1">
<soapenv:Header><wsse:Security soapenv:mustUnderstand="1" 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"><wsse:UsernameToken wsu:Id="UsernameToken-83C962CC24EAB67F1D15586306447678"><wsse:Username>userName</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Password</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">JLTdeK6Yg3D64+2qz5xnbA==</wsse:Nonce><wsu:Created>2019-05-23T16:57:24.767Z</wsu:Created></wsse:UsernameToken></wsse:Security></soapenv:Header>
<soapenv:Body>
<w:helloWorld/>
</soapenv:Body>
</soapenv:Envelope>
which results in a 200OK from SOAPUI
HTTP/1.1 200 OK
Date: Wed, 22 May 2019 21:54:12 GMT
Content-Type: text/xml; charset=UTF-8
Content-Length: 3570
My Groovy Code,
def client = new SOAPClient("URL of WSDL")
def response = client.send(SOAPAction: "someAction",
connectTimeout:10000,
readTimeout:20000,
useCaches:false,
followRedirects:false) {
version SOAPVersion.V1_2 // SOAPVersion.V1_1 is default
soapNamespacePrefix "soapenv" // "soap-env" is default
envelopeAttributes "xmlns:ns":"http://example.weather.org"
header {
security("xmlns:ns20":"http://SecurityOpenXSD"){
"ns20:Username"("username")
"ns20:Password"("password")
}
}
body {
"ns:helloWorld" {
}
}
}
which gives soap xml as
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand='1'
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'>
<wsse:UsernameToken wsu:Id='UsernameToken-83C962CC24EAB67F1D15586299636605'>
<wsse:Username>userName</wsse:Username>
<wsse:Password
Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>
password
</wsse:Password>
<wsse:Nonce
EncodingType='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary'>
JLTdeK6Yg3D64+2qz5xnbA==
</wsse:Nonce>
<wsu:Created>2019-05-23T10:07:52.913Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
But i get error as password required,
<?xml version="1.0" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<Code><Value>SOAP-ENV:Receiver</Value></Code>
<Reason><Text>null</Text></Reason>
<Detail><IBResponse type="error" xmlns=""><DefaultTitle> Error Response</DefaultTitle>
<StatusCode>20</StatusCode>
<DefaultMessage><![CDATA[User Password required]]></DefaultMessage>
</IBResponse></Detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

Error consuming SOAP 1.1 operation send attachment using MTOM optimization

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:
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 '<'
at [row,col {unknown-source}]: [1,1]</faultstring><detail><con:stack-trace xmlns:con="http://www.bea.com/wli/sb/context">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 '<'
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)
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.
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:
Endpoint:
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="envio_informacao_res_dados_clinicos">
<address uri="http://xpto.com.br/service?WSDL" format="soap11" optimize="mtom">
<enableSec policy="wssSecurityRES"/>
</address>
</endpoint>
Sequence (to set the attachment to payload):
<sequence xmlns="http://ws.apache.org/ns/synapse" name="attachment">
<property name="attachmentContent" expression="get-property('ATTACHMENT_CONTENT')"/>
<property name="attachmentContentID" expression="get-property('ATTACHMENT_CONTENT_ID')"/>
<class name="br.com.modoagil.MTOMAttachmentFilesMediator"/>
</sequence>
Proxy service (for test only):
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="AttachmentFileProxyService" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<property name="ATTACHMENT_CONTENT" expression="$body/*" />
<property name="ATTACHMENT_CONTENT_ID" value="AnexoLaboratorio.xml" />
<payloadFactory media-type="xml">
<format>
<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">
<soapenv:Header />
<soapenv:Body>
<v1:requisicaoEnvioInformacaoRES>
<v1:cabecalhoRequisicao>
<!-- omitted -->
</v1:cabecalhoRequisicao>
<v1:corpoRequisicao>
<v1:beneficiario>
<!-- omitted -->
</v1:beneficiario>
<v1:profissional>
<!-- omitted -->
</v1:profissional>
<v1:informacaoClinica>
<v17:anexoComposicao xm:contentType="application/xml" xm:expectedContentTypes="application/xml" />
<!-- omitted -->
</v1:informacaoClinica>
</v1:corpoRequisicao>
</v1:requisicaoEnvioInformacaoRES>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args />
</payloadFactory>
<sequence key="attachment" />
<header name="Action" action="remove" />
<property name="SOAPAction" action="remove" />
<property name="FORCE_HTTP_1.0" value="true" scope="axis2" />
<property name="SOAPAction" value="envio_informacao_res" scope="transport" />
<property name="Proxy-Authorization" scope="transport" expression="fn:concat('Basic ', base64Encode('ZZZZ:YYYY'))" />
<send>
<endpoint key="envio_informacao_res_dados_clinicos" />
</send>
</inSequence>
<outSequence>
<property name="enableMTOM" value="true" scope="axis2" />
<send />
</outSequence>
</target>
</proxy>
Custom Mediator:
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);
}
}
SoapUI "full request/response":
POST /service?WSDL 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_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: <rootpart#soapui.org>
<?xml version="1.0" encoding="UTF-8"?>
<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">
<soapenv:Header>
<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">
<wsse:UsernameToken wsu:Id="UsernameToken-CAD2037163FCADC4A5149669450719220">
<wsse:Username>omitted</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">omitted</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">omitted==</wsse:Nonce>
<wsu:Created>2017-06-05T20:28:27.192Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<v1:requisicaoEnvioInformacaoRES>
<v1:cabecalhoRequisicao>
<!-- omitted -->
</v1:cabecalhoRequisicao>
<v1:corpoRequisicao>
<v1:beneficiario>
<!-- omitted -->
</v1:beneficiario>
<v1:profissional>
<!-- omitted -->
</v1:profissional>
<v1:informacaoClinica>
<v17:anexoComposicao xm:contentType="application/xml" xm:expectedContentTypes="application/xml">
<inc:Include xmlns:inc="http://www.w3.org/2004/08/xop/include" href="cid:AnexoLaboratorio.xml" />
</v17:anexoComposicao>
<!-- omitted -->
</v1:informacaoClinica>
</v1:corpoRequisicao>
</v1:requisicaoEnvioInformacaoRES>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_10_1408830521.1496694507193
Content-Type: text/xml; charset=us-ascii; name=AnexoLaboratorio.xml
Content-Transfer-Encoding: 7bit
Content-ID: <AnexoLaboratorio.xml>
Content-Disposition: attachment; name="AnexoLaboratorio.xml"; filename="AnexoLaboratorio.xml"
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- omitted -->
</Clinical_Summary_Events>
------=_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
<soapenv:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><ptucsseir:respostaEnvioInformacaoRES xmlns:ptucsseir="http://xpto.com.br/schemas/servico/envio/informacao/res/v1.00"> <!-- omitted --></ptucsseir:respostaEnvioInformacaoRES></soap-env:Body></soapenv:Envelope>"
WSO2 EI "full request/response":
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: <0.30282c2967f861ead2423a50af020431e31644c6c1d1eeb6#apache.org>
<?xml version="1.0" encoding="UTF-8"?>
<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">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1">
<wsse:Username>omitted</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">omitted</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">omitted</wsse:Nonce>
<wsu:Created>2017-06-06T15:01:38.098Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<v1:requisicaoEnvioInformacaoRES>
<v1:cabecalhoRequisicao>
<!-- omitted -->
</v1:cabecalhoRequisicao>
<v1:corpoRequisicao>
<v1:beneficiario>
<!-- omitted -->
</v1:beneficiario>
<v1:profissional>
<!-- omitted -->
</v1:profissional>
<v1:informacaoClinica>
<v17:anexoComposicao xm:contentType="application/xml" xm:expectedContentTypes="application/xml">
<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:AnexoLaboratorio.xml" />
</v17:anexoComposicao>
<!-- omitted -->
</v1:informacaoClinica>
</v1:corpoRequisicao>
</v1:requisicaoEnvioInformacaoRES>
</soapenv:Body>
</soapenv:Envelope>
--MIMEBoundary_20282c2967f861ead2423a50af020431e31644c6c1d1eeb6
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <AnexoLaboratorio.xml>
<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">
<!-- omitted -->
</Clinical_Summary_Events>
--MIMEBoundary_20282c2967f861ead2423a50af020431e31644c6c1d1eeb6--
##### RESPONSE #####
--MIMEBoundary_00282c2967f861ea3c123a50af020431f31644c6c1d1eeb6
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.10282c2967f861ea3c123a50af020431f31644c6c1d1eeb6#apache.org>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>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 '<'
at [row,col {unknown-source}]: [1,1]</faultstring><detail><con:stack-trace xmlns:con="http://www.bea.com/wli/sb/context">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 '<'
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 '<'
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 '<'
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 '<'
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
</con:stack-trace></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
--MIMEBoundary_00282c2967f861ea3c123a50af020431f31644c6c1d1eeb6--
So, does anyone have a similar problem to do SOAP/MTOM request with WSO2 EI/WSO2 ESB?
EDIT:
WSO2 Integration version: 6.1.1
WSO2 EI is running with default configuration, no configuration was changed, not even properties to enable MTOM in axis2.xml configuration file.
Found a solution. I just add this property to the proxy:
<property name="messageType" value="multipart/related" scope="axis2"/>
Maybe this is not the best solution, since headers are the same as before and SoapUI apparently generate a more clean request, but now the service receive correctly the message sent by WSO2 EI.
I don't know why, but instead of send attachment in a separated "section", with a XOP inclusion - like before, as logs at question -, now WSO2 EI sends attachment inline on SOAP Envelope - looks like base 64 encoded.
For now it's OK, if this solution cause problem I create other question.

Cannot send Soap Request as String using Retrofit 2.0

I tried sending Soap Request as String using Retrofit 2.0 but it always add myrequestString .
Do you know how to send an String SoapUI format via Retrofit 2.0?
Here is my code:
MyService.java:
#Headers({
"Content-Type: text/xml"
})
#POST
Call<ResponseBody> loadRepo(#Url String url,#Body String body);
String to send request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="">
<soapenv:Header/>
<soapenv:Body>
<web:ValidateLink>
<Request>
...
Request actual:
<string><?xml version=&apos;1.0&apos; encoding=&apos;UTF-8&apos; standalone=&apos;yes&apos; ?><soapenv:Envelope xmlns:au
...
;/soapenv:Body></soapenv:Envelope></string>
Request Expected:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="">
<soapenv:Header/>
<soapenv:Body>
<web:ValidateLink>
<Request>

Moodle: Invalid parameter exception

I'm trying to make a
http://domain.com/webservice/rest/server.php?wstoken=4725a345345435342322a6560b068547297748e17&wsfunction=mod_forum_get_forum_discussions_paginated
with post data:
{
"forumid":2438
}
Headers:
Accept: application/json
Content-Type: application/json
But I get the error:
<?xml version="1.0" encoding="UTF-8" ?>
<EXCEPTION class="invalid_parameter_exception">
<ERRORCODE>invalidparameter</ERRORCODE>
<MESSAGE>Invalid parameter value detected</MESSAGE>
</EXCEPTION>
I have my moodle session as a cookie. What am I doing wrong here?
Maybe try putting forumid in the url?
http://domain.com/webservice/rest/server.php?forumid=2438&wstoken=4725a345345435342322a6560b068547297748e17&wsfunction=mod_forum_get_forum_discussions_paginated
https://tracker.moodle.org/browse/MDL-46458

Invalid SOAPAction in ASP.net Storefront

What is the right SOAPAction for this request to ASPDotNetStoreFront?
< POST http://192.168.122.3/ASPDNSF0/ipx.asmx
User-Agent: libwww-perl/6.05
Content-Type: application/soap+xml; charset="utf-8"
SOAPAction: "http://www.aspdotnetstorefront.com/DoItUsernamePwd"
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap12:Body>
<DoitUsernamePwd xmlns="http://www.aspdotnetstorefront.com/">
<AuthenticationEmail>admin#aspdotnetstorefront.com</AuthenticationEmail>
<AuthenticationPassword>Admin$11</AuthenticationPassword>
<XMLInputRequestString>
<ASPDotNetStorefrontImport Version="7.1">
<Product action="Add">
<Name>my product name</Name>
<SKU>1234</SKU>
<Description><![CDATA[please
add some <b>data</b>]]></Description>
</Product>
</ASPDotNetStorefrontImport>
</XMLInputRequestString>
</DoitUsernamePwd>
</soap12:Body>
</soap12:Envelope>
> HTTP/1.1 500 Internal Server Error
Cache-Control: private
Date: Tue, 17 Sep 2013 22:34:31 GMT
Server: Microsoft-IIS/7.0
Content-Length: 1938
Content-Type: application/soap+xml; charset=utf-8
Client-Date: Tue, 17 Sep 2013 20:34:32 GMT
Client-Peer: 192.168.122.3:80
Client-Response-Num: 1
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 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"><env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"><wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</wsa:Action><wsa:MessageID>urn:uuid:e8b22878-f37a-4362-8167-441ebab5be00</wsa:MessageID><wsa:RelatesTo>urn:uuid:18b7b7e3-7f65-4622-b093-a906a76b3aba</wsa:RelatesTo><wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsse:Security><wsu:Timestamp wsu:Id="Timestamp-cd79b88a-3552-4d91-a8d7-d9e3cff73d73"><wsu:Created>2013-09-17T22:34:31Z</wsu:Created><wsu:Expires>2013-09-17T22:39:31Z</wsu:Expires></wsu:Timestamp></wsse:Security></env:Header><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">System.Web.Services.Protocols.SoapException: Unable to handle request without a valid action parameter. Please supply a valid soap action.
at System.Web.Services.Protocols.Soap12ServerProtocolHelper.RouteRequest()
at Microsoft.Web.Services3.WseProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>
must be http://www.aspdotnetstorefront.com/DoItUsernamePwd
the same webservice says:
SOAPAction: "http://www.aspdotnetstorefront.com/DoItUsernamePwd"
put the error code for see the ploblem
good luck