WSO2 ESB: Custom URL - soap

I have created my proxy with custom url, based on:
http://wso2.com/library/knowledge-base/2011/01/custom-urls-wso2-esb-proxy-services/
Calling this custom URL with my SOAP message results in an error, I can still use the original url.
custom: /services/wss/PlanningOphaalServiceProxy_v1
original: /services/PlanningOphaalServiceProxy_v1
The error:
TID: [0] [ESB] [2015-08-19 15:47:05,039] ERROR {org.apache.axis2.engine.AxisEngine} - InvalidSecurity {org.apache.axis2.engine.AxisEngine}
org.apache.axis2.AxisFault: InvalidSecurity
at org.apache.rampart.handler.PostDispatchVerificationHandler.invoke(PostDispatchVerificationHandler.java:151)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
TID: [0] [ESB] [2015-08-19 15:47:05,041] ERROR {org.apache.synapse.transport.passthru.ServerWorker} - Error processing POST request for : /services/wss/PlanningOphaalServiceProxy_v1 {org.apache.synapse.transport.passthru.ServerWorker}
org.apache.axis2.AxisFault: InvalidSecurity

Solved: This is not possible. CustomURI does not work in combination with WS-Security, according to WSO2 SUpport

I tried Custom URI and working fine after adding custom dispatched in axis2.xml
below is URI for my proxy
http://localhost:8280/GenericProxy
and Proxy code as below:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="CustomProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="messageType"
value="application/xml"
scope="default"
type="STRING"/>
<log level="full">
<property name="################## Body - In Seq###################"
expression="$body"/>
</log>
<send>
<endpoint>
<address uri="http://localhost:8090/services/OracleStoredProcedure.SOAP12Endpoint/"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="full">
<property name="############## Res Seq ############" value="Response"/>
</log>
</outSequence>
</target>
<parameter name="ServiceURI">/GenericProxy</parameter>
<description/>
</proxy>
And logs as below
[2015-08-21 16:35:25,173] INFO - ProxyService Successfully created the Axis2 se
rvice for Proxy service : CustomProxy
[2015-08-21 16:35:41,405] INFO - LogMediator To: /GenericProxy, MessageID: urn:
uuid:8e35439e-4d28-95be-4e25eb385843, Direction: request, #################
# Body - In Seq################### = <soapenv:Body xmlns:soapenv="http://schemas
.xmlsoap.org/soap/envelope/"><emp>
<ID>sample</ID>
</emp></soapenv:Body>, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:
Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body
><emp>
<ID>sample</ID>
</emp></soapenv:Body></soapenv:Envelope>
[2015-08-21 16:35:42,200] INFO - LogMediator To: http://www.w3.org/2005/08/addr
essing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:0431fb5f-4b03-47
41-727bdb3637d8, Direction: response, ############## Res Seq ############ =
Response, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xml
ns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:En
velope>

Related

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.

Using WSO2 FHIR Connector

I'm trying the FHIR Connector with WSO2 EI 6.1.0
I'm following this documentation
The request for the create operation is:
{
"body": {
"base": "https://sqlonfhir-stu3.azurewebsites.net",
"type": "Patient",
"format": "json"
}
}
My proxy is:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="fhirTest"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<property expression="json-eval($.body.base)"
name="base"
scope="default"
type="STRING"/>
<property expression="json-eval($.body.type)"
name="type"
scope="default"
type="STRING"/>
<property expression="json-eval($.body.format)"
name="format"
scope="default"
type="STRING"/>
<fhir.init>
<base>{$ctx:base}</base>
</fhir.init>
<fhir.create>
<type>{$ctx:type}</type>
<format>{$ctx:format}</format>
</fhir.create>
<send/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="ApplicationXMLBuilder.allowDTD">true</parameter>
<description/>
</proxy>
After the request the response is (the body is void):
HTTP/1.1 202 Accepted
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Type: text/html;charset=UTF-8
Content-Length: 0
Date: Fri, 05 May 2017 14:09:01 GMT
Server: WSO2 Carbon Server
but I get the following exception: DOCTYPE is not allowed
log:
[2017-05-05 16:09:01,192] [] INFO - LogMediator To: /services/fhirTest,From: 192.168.81.118,Direction: request,base1 = https://sqlonfhir-stu3.azurewebsites.net
,type1 = Patient,format1 = json,Payload: {
"body": {
"base": "https://sqlonfhir-stu3.azurewebsites.net",
"type": "Patient",
"format": "json"
}
}
[2017-05-05 16:09:01,704] [] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:160)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:136)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:99)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.buildMessage(Axis2SynapseEnvironment.java:817)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:546)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:281)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:775)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:262)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:36)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 21 more
[2017-05-05 16:09:01,709] [] ERROR - Axis2SynapseEnvironment Error while building message
org.apache.axis2.AxisFault: Error while building Passthrough stream
at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:283)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:142)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:99)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.buildMessage(Axis2SynapseEnvironment.java:817)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:546)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:118)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:281)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironment.java:775)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:282)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:262)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at ...
[2017-05-05 16:11:03,952] [] WARN - SynapseCallbackReceiver Synapse received a response for the request with message Id : urn:uuid:c14afbec-7e12-4c9a-be5e-0746
53fed0e6 But a callback is not registered (anymore) to process this response
My questions are:
Has anyone been able to take the correct tests by following the guide?
How do I pass the other data to create the resource fhir (further base, type and format) as described here?
Thanks in advance
UPDATE: After I have enabled messageBuilder and messageFormatter (as suggested by Hariprasath) the previus error is resolved
but now I have an other error:
[2017-05-10 16:42:20,891] [] DEBUG - RelayUtils Content Type is application/fhir+json; charset=utf-8
[2017-05-10 16:42:20,893] [] ERROR - Axis2Sender Unexpected error during sending message out
java.lang.NullPointerException
at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:211
This is because of the response is an HTML page(with the content-type is in text/html format). Usually, we need to enable the following formatter and builder to avoid this error and supports text/html format. Please add following message builders and formatters to the sections in /repository/conf/axis2/axis2.xml.
<messageBuilder contentType="text/html"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
Make sure that you add/enable builders and formatter for "text/html" in /repository/conf/axis2/axis2.xml file.
<messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
[1] https://github.com/wso2-extensions/esb-connector-fhir/blob/master/src/test/INTEGRATION-TEST.txt

Camel-SQL route ServiceUnavailableException when using header value as parameter

In ApacheServiceMix 7.0.0 I have defined the following routes using Blueprint:
<reference id="dataSource" interface="javax.sql.DataSource" filter="(dataSourceName=connectuserdata)" />
<bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="dataSource" />
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<package>com.focuscura</package>
<dataFormats>
<!-- here we define a Json data format with the id jack and that it should use the TestPojo as the class type when
doing unmarshal. The unmarshalTypeName is optional, if not provided Camel will use a Map as the type -->
<json id="userdata" library="Jackson" />
</dataFormats>
<route id="connect.userdata_create">
<from uri="jetty:http://localhost:8881/userdata?httpMethodRestrict=POST"/>
<unmarshal ref="userdata"/>
<!--<process ref="scalaUserDataProcessor"/>-->
<log message="Received new userdata" />
<to uri="sql:INSERT INTO public."UserData" (lastname, firstname) VALUES (:#lastname , :#firstname)"/>
</route>
<route id="connect.userdata_get2">
<from uri="jetty:http://localhost:8881/userdata2?httpMethodRestrict=GET"/>
<to uri="sql:SELECT * FROM public."UserData" WHERE id = :#id"/>
<!--<process ref="scalaUserDataProcessor"/>-->
<marshal ref="userdata"/>
</route>
</camelContext>
The Datasource is installed as a seperate service following the instructions as described in this post: How can I install postgresqljdbc to work in Karaf OSGi?
This is working fine! I can post JSON to the Jetty URL and it is inserted into the database.
But when I try to get data from this Endpoint I get the following error
org.osgi.service.blueprint.container.ServiceUnavailableException: The Blueprint container is being or has been destroyed: (&(dataSourceName=connectuserdata)(objectClass=javax.sql.DataSource))
at org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:241)
at org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:56)
at org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:306)
at Proxyb6abdd30_6f59_4e89_a419_c4ff0558aa62.equals(Unknown Source)
at java.util.WeakHashMap.eq(WeakHashMap.java:287)
at java.util.WeakHashMap.get(WeakHashMap.java:401)
at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes(SQLErrorCodesFactory.java:204)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:140)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.
(SQLErrorCodeSQLExceptionTranslator.java:103)
at org.springframework.jdbc.support.JdbcAccessor.getExceptionTranslator(JdbcAccessor.java:99)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605)
at org.apache.camel.component.sql.SqlProducer.process(SqlProducer.java:100)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
at org.apache.camel.component.jetty.CamelContinuationServlet.service(CamelContinuationServlet.java:191)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at org.eclipse.jetty.servlets.MultiPartFilter.doFilter(MultiPartFilter.java:146)
at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:43)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
The weird thing is, that when I substitute <to uri="sql:SELECT * FROM public."UserData" WHERE id = **:#id**"/> with <to uri="sql:SELECT * FROM public."UserData" WHERE id = **2**"/>
it works fine again and I get a nice little JSON of user nr 2 returned.
Any hints as to how to solve this?
The problem wasn't really in my route or camel. It was caused by PostgreSQL. By using a parameter in my route I needed to provide an explicit typecast.
To get this working I needed to add ::bigint to the parameter in my route: sql:SELECT lastname FROM public."UserData" WHERE id = :#id::bigint?dataSource=dataSource&allowNamedParameters=true
For some reason the error from Postgres was swallowed by Camel-sql and I got the weird message about Datasource being destroyed.
Thanks everybody for your helpful comments and questions!

Endpoint Not Found in Spring-ws SOAP web-service

I’am trying to create web service using Spring-ws. It is deployed on tomcat 7. When I request web service via SOAP UI I receive nothing in response frame (RAW: HTTP/1.1 404 Not Found Server: Apache-Coyote/1.1 Date: Thu, 14 May 2015 09:00:29 GMT Content-Length: 0).
There is next information in TomCat log file:
14.05.2015 11:44:02.719 ws.server.EndpointNotFound [WARN] No endpoint mapping found for [SaajSoapMessage {http://abc.mayacomp.com.ru/power-appl}internalHistRequest]
My Endpoint class looks like:
package com.mayacomp.endpoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import com.mayacomp.mayaserv.InternalHistRequest;
import com.mayacomp.mayaserv.InternalHistResponse;
import com.mayacomp.services.PAppService;
#Endpoint
public class WsEndpoint {
private static final String TARGET_NAMESPACE = "http://abc.mayacomp.com/power-appl";
#Autowired
public PAppService PAppService_i;
#PayloadRoot(localPart = "interHistRequest", namespace = TARGET_NAMESPACE)
public #ResponsePayload interHistResponse getinterHist(#RequestPayload interHistRequest request) {
interHistResponse _return = new interHistResponse();
_return.setClientID(new java.math.BigInteger("428239 22945935239155481381"));
try
{
/*stubs for return obeject */
return _return;
}
catch (java.lang.Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
public void setPAppService(PAppService PAppService_p)
{
this.PAppService_i = PAppService_p;
}
}
Spring-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="com.mayacomp.services"/>
<!--<context:component-scan base-package="com.mayacomp.endpoint"/>-->
<sws:annotation-driven />
<bean id="interCreditService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true">
<property name="schemaCollection">
<bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="inline" value="true" />
<property name="xsds">
<list>
<value>schemas/power-appl.xsd</value>
</list>
</property>
</bean>
</property>
<property name="portTypeName" value="interCreditService"/>
<property name="serviceName" value="PowerApplServices" />
<property name="locationUri" value="/endpoints"/>
</bean>
</beans>
SOAP request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pow="http://abc.mayacomp.com/power-appl" xmlns:end="http://localhost:8080/abc-power-appl-ws/endpoints" xmlns:abc="http://localhost:8080/abc-power-appl-ws">
<soapenv:Header/>
<soapenv:Body>
<pow:interHistRequest>
<pow:requestHeader>
<pow:requestUID>?</pow:requestUID>
<pow:requestTimestamp>?</pow:requestTimestamp>
<pow:systemID>?</pow:systemID>
</pow:requestHeader>
<pow:clientID>?</pow:clientID>
</pow:interHistRequest>
</soapenv:Body>
</soapenv:Envelope>
How set up service for returning response and avoid No endpoint mapping error?

syncml status 415 for devinf

I'm getting 415 status from N95 client for sending server devinf.
I tried many things but no success.
Here is server response (generated by me, I'm writing my own implementation of syncml server.):
<?xml version="1.0"?>
<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_RepPro_DTD-V1_2.dtd">
<SyncML>
<SyncHdr>
<VerDTD>1.2</VerDTD>
<VerProto>SyncML/1.2</VerProto>
<SessionID>14</SessionID>
<MsgID>1</MsgID>
<Target>
<LocURI>IMEI:356406027185460</LocURI>
</Target>
<Source>
<LocURI>http://localhost:8880</LocURI>
</Source>
<Meta>
<MaxMsgSize xmlns="syncml:metinf">10000</MaxMsgSize>
</Meta>
</SyncHdr>
<SyncBody>
<Status>
<MsgRef>1</MsgRef>
<Data>200</Data>
<Cmd>Alert</Cmd>
<CmdRef>1</CmdRef>
<CmdID>1</CmdID>
</Status>
<Status>
<MsgRef>1</MsgRef>
<Data>200</Data>
<Cmd>Put</Cmd>
<CmdRef>2</CmdRef>
<CmdID>2</CmdID>
</Status>
<Status>
<MsgRef>1</MsgRef>
<Data>200</Data>
<Cmd>Get</Cmd>
<CmdRef>3</CmdRef>
<CmdID>3</CmdID>
<TargetRef>./devinf12</TargetRef>
</Status>
<Results>
<MsgRef>1</MsgRef>
<Item>
<Meta>
<Type xmlns="syncml:metinf">application/vnd.syncml-devinf+xml</Type>
</Meta>
<Source>
<LocURI>./devinf12</LocURI>
</Source>
<Data>
<DevInf xmlns="syncml:devinf">
<VerDTD>1.2</VerDTD>
<Man>my company ltd.</Man>
<Mod>syncml mod</Mod>
<SwV>0.01</SwV>
<FwV>1.01</FwV>
<HwV>0.1a</HwV>
<DevID>syncmlserv</DevID>
<DevTyp>server</DevTyp>
<DataStore>
<SourceRef>./contacts</SourceRef>
<Rx-Pref>
<CTType>text/vcard</CTType>
<VerCT>3.0</VerCT>
</Rx-Pref>
<Rx>
<CTType>text/vcard</CTType>
<VerCT>2.1</VerCT>
</Rx>
<Tx-Pref>
<CTType>text/vcard</CTType>
<VerCT>3.0</VerCT>
</Tx-Pref>
<Tx>
<CTType>text/vcard</CTType>
<VerCT>2.1</VerCT>
</Tx>
<CTCap>
<CTType>text/x-vcard</CTType>
<PropName>BEGIN</PropName>
<ValEnum>VCARD</ValEnum>
<PropName>END</PropName>
<ValEnum>VCARD</ValEnum>
<PropName>VERSION</PropName>
<ValEnum>2.1</ValEnum>
<PropName>N</PropName>
<PropName>TEL</PropName>
<ParamName>VOICE</ParamName>
<ParamName>FAX</ParamName>
<ParamName>CELL</ParamName>
</CTCap>
<CTCap>
<CTType>text/x-vcard</CTType>
<PropName>BEGIN</PropName>
<ValEnum>VCARD</ValEnum>
<PropName>END</PropName>
<ValEnum>VCARD</ValEnum>
<PropName>VERSION</PropName>
<ValEnum>3.0</ValEnum>
<PropName>N</PropName>
<PropName>TEL</PropName>
<ParamName>VOICE</ParamName>
<ParamName>FAX</ParamName>
<ParamName>CELL</ParamName>
</CTCap>
<SyncCap>
<SyncType>1</SyncType>
<SyncType>2</SyncType>
<SyncType>3</SyncType>
<SyncType>4</SyncType>
<SyncType>5</SyncType>
<SyncType>6</SyncType>
</SyncCap>
</DataStore>
</DevInf>
</Data>
</Item>
<CmdRef>3</CmdRef>
<CmdID>4</CmdID>
<Meta>
<Type xmlns="syncml:metinf">application/vnd.syncml-devinf+xml</Type>
</Meta>
<TargetRef>./devinf12</TargetRef>
</Results>
</SyncBody>
</SyncML>
And Here is what client sends:
<?xml version="1.0"?>
<!DOCTYPE SyncML PUBLIC "-//SYNCML//DTD SyncML 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_RepPro_DTD-V1_2.dtd">
<SyncML xmlns="SYNCML:SYNCML1.2">
<SyncHdr>
<VerDTD>1.2</VerDTD>
<VerProto>SyncML/1.2</VerProto>
<SessionID>14</SessionID>
<MsgID>2</MsgID>
<Target>
<LocURI>http://localhost:8880</LocURI>
</Target>
<Source>
<LocURI>IMEI:356406027185460</LocURI>
</Source>
<Meta>
<MaxMsgSize xmlns="syncml:metinf">10000</MaxMsgSize>
</Meta>
</SyncHdr>
<SyncBody>
<Status>
<CmdID>1</CmdID>
<MsgRef>1</MsgRef>
<CmdRef>0</CmdRef>
<Cmd>SyncHdr</Cmd>
<TargetRef>IMEI:356406027185460</TargetRef>
<SourceRef>http://localhost:8880</SourceRef>
<Data>200</Data>
</Status>
<Status>
<CmdID>2</CmdID>
<MsgRef>1</MsgRef>
<CmdRef>4</CmdRef>
<Cmd>Results</Cmd>
<Data>415</Data>
</Status>
</SyncBody>
</SyncML>
Just one note putting meta in/out of Item does not change a thing.
I'm basically lost at that stage..
the response code is a SyncML response..
probabaly you have a Unsupported media type or format. The unsupported content
type or format SHOULD also be identified in the Item
element type in the Status.
check on that...