camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Royamit <amitroy...@gmail.com>
Subject How to remove soap header before sending the request to realweb service
Date Mon, 17 Nov 2014 11:12:14 GMT
Hi all,

I have created a proxy service upon axis2's version service.
In this proxy service i have implemented basic authentication using
wss4jInInterceptor.
Here is my camel-context.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:camel="http://camel.apache.org/schema/spring"
       xmlns:cxf="http://camel.apache.org/schema/cxf"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
       http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd">

  
  <context:property-placeholder
location="classpath:incident.properties,file:target/custom.properties"
                                ignore-resource-not-found="true"/>

  <bean id="loggingOutInterceptor"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
  <bean id="loggingInInterceptor"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
  
  <bean id="wss4jInInterceptor"
class="org.apache.camel.example.cxf.proxy.BasicAuthAuthorizationInterceptor">
        <property name="users">
            <map>
			<entry key="opp" value="oppPassword" />
                <entry key="action" value="UsernameToken Timestamp"/>
                <entry key="passwordType" value="PasswordText"/>
                <entry key="passwordCallbackClass"
value="org.apache.camel.example.cxf.proxy.UTPasswordCallback"/>
            </map>
        </property>
    </bean>
	
  
  <cxf:cxfEndpoint id="versionService"
                  
address="http://localhost:${proxy.port}/camel-example-cxf-proxy/webservices/versionAdapter"
                   endpointName="s:VersionHttpSoap11Endpoint"				   
                   serviceName="s:Version"
                   wsdlURL="etc/versionAdapter.wsdl"
                   xmlns:s="http://axisversion.sample">
				  
	<cxf:inInterceptors>
            <ref bean="loggingInInterceptor"/>
            <ref bean="wss4jInInterceptor"/>
    </cxf:inInterceptors>
	<cxf:outInterceptors>
            <ref bean="loggingOutInterceptor"/>
    </cxf:outInterceptors>
				   
  </cxf:cxfEndpoint>

  
  <camelContext xmlns="http://camel.apache.org/schema/spring">

    
    <propertyPlaceholder id="properties"
location="classpath:incident.properties,file:target/custom.properties"/>

    <endpoint id="callRealWebService"
uri="http://localhost:${real.port}/axis2/services/Version?throwExceptionOnFailure=false"/>

    <route>
      
      <from uri="cxf:bean:versionService?dataFormat=MESSAGE"/>
      
      <to uri="log:input"/>
      
      
	  
	  <removeHeaders pattern="CamelHttp*" />
	  <removeHeaders pattern="http-headers*" />
      
      <to ref="callRealWebService"/>
      
      <to uri="log:output"/>
    </route>

  </camelContext>

</beans>


Now the proxy service's basic authentication is working good.
*The only problem is from camel proxy, when the request which invokes the
axis service has Header information on the request payload which my axis
service is unable to understand *

Here is the request that axis service is getting:

POST /axis2/services/Version HTTP/1.1
accept-encoding: gzip,deflate
SOAPAction: "urn:getVersion"
Authorization: Basic b3BwOm9wcFBhc3N3b3Jk
breadcrumbId: ID-localhost-1749-1416221247796-2-1
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Host: localhost:8080
Content-Length: 1078
Content-Type: text/xml;charset=UTF-8

<soapenv:Envelope xmlns:axis="http://axisversion.sample"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <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"><wsu:Timestamp
wsu:Id="TS-30"><wsu:Created>2014-11-17T10:51:24Z</wsu:Created><wsu:Expires>2014-11-17T11:24:44Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken
wsu:Id="UsernameToken-29"><wsse:Username>opp</wsse:Username><wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">oppPassword</wsse:Password><wsse:Nonce
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">jIgJSain2vn2QbwORyShTA==</wsse:Nonce><wsu:Created>2014-11-17T10:51:24.851Z</wsu:Created></wsse:UsernameToken></wsse:Security></soapenv:Header>
   <soapenv:Body>
      <axis:getVersion/>
   </soapenv:Body>
</soapenv:Envelope>

*So my question is how can i remove the soap header through camel-config.xml
before invoking the axis2 version service.*

Looking forward to your answers. Thanks in advance



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-remove-soap-header-before-sending-the-request-to-realweb-service-tp5759196.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message