servicemix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "przemyslaw.gruzdz" <przemyslaw.gru...@xentivo.pl>
Subject How to set custom soap header information (in custom naspace) in camel route (using spring configuration)?
Date Wed, 18 Apr 2012 05:49:27 GMT
Hello everyone,

After few days of struggle a I decided to ask for clue/advice.. I have read
a lot of messages but I still can’t find relevant answer.

So here is the background:

I have configured Camel Proxy/router service with spring xml file.

cxfEndpoint -> hedader based routing -> body xslt transformation ->
cxfEndpoint (backend service)

This solution worked great until it turned out, that I have to set few
custom attributes in custom namepace In SOAP header of message forwarded to
backend service.

And here comes my question:

*How to set custom soap header information (in custom naspace) in camel
route (using spring configuration)?* For example, I want to add such header
forwarded to backend service by my camel route:

<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/>
<soapenv:Header>
<CustomUsernameToken xmlns="http://custom.com/webservices">custom_value</
CustomUsernameToken>
<CustomPasswordText xmlns="http://custom.com/webservices">custom_value</
CustomPasswordText>
</soapenv:Header>
<soapenv:Body>
…
</soapenv:Body>
</soapenv:Envelope>

Here are snippets with my current configuration
(apache-servicemix-4.4.1-fuse):

Exposed endpoint:
<cxf:cxfEndpoint id="crmServices" address="https://0.0.0.0:8443/crmServices"
serviceName="s:crmServices" wsdlURL="{{custom.path}}/crmServices.wsdl"
xmlns:s="http://custom/crmServices/">

<cxf:inInterceptors>
<bean class="org.apache.cxf.transport.common.gzip.GZIPInInterceptor" />
</cxf:inInterceptors>
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD" />
</cxf:properties>

</cxf:cxfEndpoint>

Backend endpoint:
<cxf:cxfEndpoint id="CustomUI_CKM_Insert_Incident"
serviceName="s:CKM_spcInsert_spcIncident"
address="http://10.111.112.11/custom"
wsdlURL="{{custom.path}}/CustomUI_CKM_Insert_Incident.WSDL"
xmlns:s=http://custom.com/CustomUI>

<cxf:inInterceptors>
<bean class="org.apache.cxf.transport.common.gzip.GZIPInInterceptor" />
</cxf:inInterceptors>
<cxf:properties>
<entry key="dataFormat" value="PAYLOAD" />
</cxf:properties>

</cxf:cxfEndpoint>

And a fragment of working Camel route:

<camelContext xmlns="http://camel.apache.org/schema/spring"
trace="true" streamCache="true">
<propertyPlaceholder id="properties"
location="file:r:/smx/etc/custom.properties" propertiesParserRef="jasypt" />

<route>
<from uri="cxf:bean:crmServices?dataFormat=PAYLOAD" />

<choice>

<when>
<xpath>/crm:CreateRequest/in/caseType/text() =
'CreateRequestIncident'</xpath>

<setHeader headerName="operationName">
<constant>InsertIncident</constant>
</setHeader>

<setHeader headerName="operationNamespace">
<constant>http://custom.com/CustomUI</constant>
</setHeader>

<setHeader headerName="SOAPAction">
<constant>http://custom.com/CustomUI/InsertIncident</constant>
</setHeader>

<convertBodyTo type="String" charset="UTF-8" />

<to uri="xslt:file:{{custom.path}}/createRequestIncident.xsl" />

<convertBodyTo type="org.apache.camel.component.cxf.CxfPayload" />

<to uri="cxf:bean:CustomUI_CKM_Insert_Incident" />

<to uri="xslt:file:{{custom.path}}/createRequestIncidentResponse.xsl" />

</when>
…

--
View this message in context: http://servicemix.396122.n5.nabble.com/How-to-set-custom-soap-header-information-in-custom-naspace-in-camel-route-using-spring-configuratio-tp5648254p5648254.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Mime
View raw message