You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by functionofwhy <ma...@gmail.com> on 2014/07/04 22:21:23 UTC

WS-Policy support

I am trying to move all policy processing into the camel layer of my system
architecture. In order to do that I have setup an example proxy in front of
a cxf service and moved policy processing to the a bus configured for the
proxy:

<beans xmlns="http://www.springframework.org/schema/beans"
        ...
	<p:externalAttachment location="classpath:policy/i18n-policy.xml"/>
	
	<cxf:bus id="busStop">
		<cxf:features>
			<cxf:logging/>
			<p:policies />
		</cxf:features>
	</cxf:bus>
		
	<camel-cxf:cxfEndpoint id="proxyUserService"
		address="/proxy/userService"
		endpointName="us:userSoapServicePort"
serviceName="us:userSoapServicePorts"
		wsdlURL="classpath:service/user-soap-v1.wsdl"
xmlns:us="urn:healthmedia:wsdl:user:soap:v1" />
	
	<camel:camelContext>
		<camel:propertyPlaceholder id="properties"
location="classpath:user-service.properties"/>
		<camel:endpoint id="realUserService"
uri="${user-service.url}?throwExceptionOnFailure=false"/>
		<camel:route>
			<camel:from uri="cxf:bean:proxyUserService?dataFormat=MESSAGE" />
			<camel:to uri="log:input" />
			
			<camel:removeHeaders pattern="CamelHttp*" />
			<camel:to ref="realUserService" />
			<camel:to uri="log:output" />
		</camel:route>
	</camel:camelContext>

</beans>

The policy is executed and the assertion fails when the appropriate headers
are not sent in the request. This is exactly what I would expect.

HOWEVER... despite the fact that the assertion fails the proxy forwards the
call onto the actual web service anyway (effectually allowing the caller to
bypass the ws-policy altogether).

Can someone offer me a hint as to why? Is there a limitation to I am unaware
of when I proxy calls in this way?

Thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/WS-Policy-support-tp5753376.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: WS-Policy support

Posted by Matt Sicker <bo...@gmail.com>.
This makes me wonder why POJO mode is even available in the state it's in.
It's really only useful for trivial SOAP services; most real life SOAP
services either require more SOAP headers (like in this case and all the
other WS-* standards), or you end up being a client to some non-standard
Microsoft abomination that doesn't play well with JAX-WS anyway.

Thanks for the info, though. I know this could come in handy for me one day!


On 4 July 2014 18:04, Michael Lambert <ma...@gmail.com> wrote:

> Figured it out: I needed to switch the dataFormat to PAYLOAD.
>
> From the docs: SOAP headers are not available in MESSAGE mode as SOAP
> processing is skipped.
>
> Thanks!
>
>
> On Fri, Jul 4, 2014 at 4:21 PM, functionofwhy <ma...@gmail.com>
> wrote:
>
> > I am trying to move all policy processing into the camel layer of my
> system
> > architecture. In order to do that I have setup an example proxy in front
> of
> > a cxf service and moved policy processing to the a bus configured for the
> > proxy:
> >
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >         ...
> >         <p:externalAttachment
> location="classpath:policy/i18n-policy.xml"/>
> >
> >         <cxf:bus id="busStop">
> >                 <cxf:features>
> >                         <cxf:logging/>
> >                         <p:policies />
> >                 </cxf:features>
> >         </cxf:bus>
> >
> >         <camel-cxf:cxfEndpoint id="proxyUserService"
> >                 address="/proxy/userService"
> >                 endpointName="us:userSoapServicePort"
> > serviceName="us:userSoapServicePorts"
> >                 wsdlURL="classpath:service/user-soap-v1.wsdl"
> > xmlns:us="urn:healthmedia:wsdl:user:soap:v1" />
> >
> >         <camel:camelContext>
> >                 <camel:propertyPlaceholder id="properties"
> > location="classpath:user-service.properties"/>
> >                 <camel:endpoint id="realUserService"
> > uri="${user-service.url}?throwExceptionOnFailure=false"/>
> >                 <camel:route>
> >                         <camel:from
> > uri="cxf:bean:proxyUserService?dataFormat=MESSAGE" />
> >                         <camel:to uri="log:input" />
> >
> >                         <camel:removeHeaders pattern="CamelHttp*" />
> >                         <camel:to ref="realUserService" />
> >                         <camel:to uri="log:output" />
> >                 </camel:route>
> >         </camel:camelContext>
> >
> > </beans>
> >
> > The policy is executed and the assertion fails when the appropriate
> headers
> > are not sent in the request. This is exactly what I would expect.
> >
> > HOWEVER... despite the fact that the assertion fails the proxy forwards
> the
> > call onto the actual web service anyway (effectually allowing the caller
> to
> > bypass the ws-policy altogether).
> >
> > Can someone offer me a hint as to why? Is there a limitation to I am
> > unaware
> > of when I proxy calls in this way?
> >
> > Thanks!
> >
> >
> >
> > --
> > View this message in context:
> > http://camel.465427.n5.nabble.com/WS-Policy-support-tp5753376.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>



-- 
Matt Sicker <bo...@gmail.com>

Re: WS-Policy support

Posted by Michael Lambert <ma...@gmail.com>.
Figured it out: I needed to switch the dataFormat to PAYLOAD.

>From the docs: SOAP headers are not available in MESSAGE mode as SOAP
processing is skipped.

Thanks!


On Fri, Jul 4, 2014 at 4:21 PM, functionofwhy <ma...@gmail.com> wrote:

> I am trying to move all policy processing into the camel layer of my system
> architecture. In order to do that I have setup an example proxy in front of
> a cxf service and moved policy processing to the a bus configured for the
> proxy:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         ...
>         <p:externalAttachment location="classpath:policy/i18n-policy.xml"/>
>
>         <cxf:bus id="busStop">
>                 <cxf:features>
>                         <cxf:logging/>
>                         <p:policies />
>                 </cxf:features>
>         </cxf:bus>
>
>         <camel-cxf:cxfEndpoint id="proxyUserService"
>                 address="/proxy/userService"
>                 endpointName="us:userSoapServicePort"
> serviceName="us:userSoapServicePorts"
>                 wsdlURL="classpath:service/user-soap-v1.wsdl"
> xmlns:us="urn:healthmedia:wsdl:user:soap:v1" />
>
>         <camel:camelContext>
>                 <camel:propertyPlaceholder id="properties"
> location="classpath:user-service.properties"/>
>                 <camel:endpoint id="realUserService"
> uri="${user-service.url}?throwExceptionOnFailure=false"/>
>                 <camel:route>
>                         <camel:from
> uri="cxf:bean:proxyUserService?dataFormat=MESSAGE" />
>                         <camel:to uri="log:input" />
>
>                         <camel:removeHeaders pattern="CamelHttp*" />
>                         <camel:to ref="realUserService" />
>                         <camel:to uri="log:output" />
>                 </camel:route>
>         </camel:camelContext>
>
> </beans>
>
> The policy is executed and the assertion fails when the appropriate headers
> are not sent in the request. This is exactly what I would expect.
>
> HOWEVER... despite the fact that the assertion fails the proxy forwards the
> call onto the actual web service anyway (effectually allowing the caller to
> bypass the ws-policy altogether).
>
> Can someone offer me a hint as to why? Is there a limitation to I am
> unaware
> of when I proxy calls in this way?
>
> Thanks!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/WS-Policy-support-tp5753376.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>