You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Wulff, Oliver" <Ol...@iona.com> on 2007/11/16 18:18:37 UTC
Partial Message decryption, message forwarded in interceptor
Hi all
I'd like to use CXF to do partial message protection (decrypt all the elements) and forward this message to the final web service destination.
I thought this could be done within an interceptor. CXF itself is not providing a webservice endpoint implementation. CXF does the decryption only.
Could anybody give me some hints how I could achieve that? What kind of interceptor? In which phase it should be? Especially, how I can forward the message?
Thanks
Oliver
AW: Partial Message decryption, message forwarded in interceptor
Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi Glen
CXF is used at the endpoint and needs to decrypt parts of the soap request. This feature is provided by apache wss4j. The reply from Dan helped me in developing a dynamic endpoint but it fails to configure the SAAJ and WSS4J interceptors successfully.
Thanks
Oliver
-----Ursprüngliche Nachricht-----
Von: Glen Mazza [mailto:glen.mazza@verizon.net]
Gesendet: Di 20.11.2007 18:32
An: cxf-user@incubator.apache.org
Betreff: Re: Partial Message decryption, message forwarded in interceptor
Am Freitag, den 16.11.2007, 17:18 +0000 schrieb Wulff, Oliver:
> Hi all
>
> I'd like to use CXF to do partial message protection (decrypt all the elements) and forward this message to the final web service destination.
I don't know about partial message protection, but don't you mean
"(encrypt all the elements)"?
Glen
> I thought this could be done within an interceptor. CXF itself is not providing a webservice endpoint implementation. CXF does the decryption only.
>
> Could anybody give me some hints how I could achieve that? What kind of interceptor? In which phase it should be? Especially, how I can forward the message?
>
> Thanks
> Oliver
Re: Partial Message decryption, message forwarded in interceptor
Posted by Glen Mazza <gl...@verizon.net>.
Am Freitag, den 16.11.2007, 17:18 +0000 schrieb Wulff, Oliver:
> Hi all
>
> I'd like to use CXF to do partial message protection (decrypt all the elements) and forward this message to the final web service destination.
I don't know about partial message protection, but don't you mean
"(encrypt all the elements)"?
Glen
> I thought this could be done within an interceptor. CXF itself is not providing a webservice endpoint implementation. CXF does the decryption only.
>
> Could anybody give me some hints how I could achieve that? What kind of interceptor? In which phase it should be? Especially, how I can forward the message?
>
> Thanks
> Oliver
AW: Partial Message decryption, message forwarded in interceptor
Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi Dan
I've figured out now that I don't have to use the wsdl endpoint name but instead the one which is published:
...
INFO: Creating Service {http://edec_svc.artix.iona.com/}RoutingProviderService from class com.iona.artix.edec_svc.RoutingProvider
Server ready...
...
Now, the SAAJInInterceptor is called but throws a NullPointerException:
17.11.2007 12:55:03 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
java.lang.NullPointerException
at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:615)
at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.handleMessage(SAAJInInterceptor.java:107)
at org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.handleMessage(SAAJInInterceptor.java:63)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
Further, I noticed that the jaxws:features are not applicable for such kind of endpoint. Do you have an idea why?
INFO: Creating Service {http://edec_svc.artix.iona.com/}RoutingProviderService from class com.iona.artix.edec_svc.RoutingProvider
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name '{http://edec_svc.artix.iona.com/}RoutingProviderService': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'features' of bean class [org.apache.cxf.service.ServiceImpl]: Bean property 'features' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Thanks
Oliver
-----Ursprüngliche Nachricht-----
Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
Gesendet: Sa 17.11.2007 12:38
An: Daniel Kulp; cxf-user@incubator.apache.org
Betreff: AW: Partial Message decryption, message forwarded in interceptor
Hi Dan
Thanks for the hints. I've developed such a provider. The only problem I've got right now is that the WS-Security interceptor are *not* applied to this endpoint. It seems to ignore that:
....
<jaxws:endpoint name="{http://temp.org/test}MyTestService"
implementor="test.RoutingProvider" createdFromAPI="true">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
<jaxws:inInterceptors>
<ref bean="Decrypt_Request" />
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
</jaxws:inInterceptors>
</jaxws:endpoint>
...
Here is my Provider:
@WebServiceProvider
@ServiceMode(value=Service.Mode.MESSAGE)
public class RoutingProvider implements Provider<SOAPMessage>
{
public SOAPMessage invoke(SOAPMessage request) {
// TODO Auto-generated method stub
SOAPMessage response = null;
try
{
URL wsdlURL = new URL("file:///TEMP/test.wsdl");
QName serviceName = new QName("http://temp.org/test", "DelegateService");
Service s = Service.create(wsdlURL, serviceName);
QName portName = new QName("http://temp.org/test", "DelegateServicePort");
Dispatch<SOAPMessage> dispatch = s.createDispatch(portName,
SOAPMessage.class,
Service.Mode.MESSAGE);
String address = "http://localhost:9009";
dispatch.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
response = dispatch.invoke(request);
}
catch (Exception ex) {
ex.printStackTrace();
}
return response;
}
}
Thanks for your help
Oliver
-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org]
Gesendet: Sa 17.11.2007 01:18
An: cxf-user@incubator.apache.org
Cc: Wulff, Oliver
Betreff: Re: Partial Message decryption, message forwarded in interceptor
Oliver,
Couple options:
1) The "pure" cxf/jaxws way would be to write a "Provider<SOAPMessage>"
impl that would take the SOAPMessage and then use a Dispatch style
client (message mode) to just send it onto a new location. That would
require a little bit of coding, but not much. You COULD actually write
a generic one that had a "newEndpointURL" property that could be
configed in spring and thus be relatively generic and reusable.
2) You MAY also be able to use something like Apache Camel to to the
routing. I'm not really sure though. I do know they have some CXF
support, but I'm not sure what the current level is.
Dan
On Friday 16 November 2007, Wulff, Oliver wrote:
> Hi all
>
> I'd like to use CXF to do partial message protection (decrypt all the
> elements) and forward this message to the final web service
> destination. I thought this could be done within an interceptor. CXF
> itself is not providing a webservice endpoint implementation. CXF does
> the decryption only.
>
> Could anybody give me some hints how I could achieve that? What kind
> of interceptor? In which phase it should be? Especially, how I can
> forward the message?
>
> Thanks
> Oliver
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
AW: Partial Message decryption, message forwarded in interceptor
Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi Dan
Thanks for the hints. I've developed such a provider. The only problem I've got right now is that the WS-Security interceptor are *not* applied to this endpoint. It seems to ignore that:
....
<jaxws:endpoint name="{http://temp.org/test}MyTestService"
implementor="test.RoutingProvider" createdFromAPI="true">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
<jaxws:inInterceptors>
<ref bean="Decrypt_Request" />
<bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
</jaxws:inInterceptors>
</jaxws:endpoint>
...
Here is my Provider:
@WebServiceProvider
@ServiceMode(value=Service.Mode.MESSAGE)
public class RoutingProvider implements Provider<SOAPMessage>
{
public SOAPMessage invoke(SOAPMessage request) {
// TODO Auto-generated method stub
SOAPMessage response = null;
try
{
URL wsdlURL = new URL("file:///TEMP/test.wsdl");
QName serviceName = new QName("http://temp.org/test", "DelegateService");
Service s = Service.create(wsdlURL, serviceName);
QName portName = new QName("http://temp.org/test", "DelegateServicePort");
Dispatch<SOAPMessage> dispatch = s.createDispatch(portName,
SOAPMessage.class,
Service.Mode.MESSAGE);
String address = "http://localhost:9009";
dispatch.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
response = dispatch.invoke(request);
}
catch (Exception ex) {
ex.printStackTrace();
}
return response;
}
}
Thanks for your help
Oliver
-----Ursprüngliche Nachricht-----
Von: Daniel Kulp [mailto:dkulp@apache.org]
Gesendet: Sa 17.11.2007 01:18
An: cxf-user@incubator.apache.org
Cc: Wulff, Oliver
Betreff: Re: Partial Message decryption, message forwarded in interceptor
Oliver,
Couple options:
1) The "pure" cxf/jaxws way would be to write a "Provider<SOAPMessage>"
impl that would take the SOAPMessage and then use a Dispatch style
client (message mode) to just send it onto a new location. That would
require a little bit of coding, but not much. You COULD actually write
a generic one that had a "newEndpointURL" property that could be
configed in spring and thus be relatively generic and reusable.
2) You MAY also be able to use something like Apache Camel to to the
routing. I'm not really sure though. I do know they have some CXF
support, but I'm not sure what the current level is.
Dan
On Friday 16 November 2007, Wulff, Oliver wrote:
> Hi all
>
> I'd like to use CXF to do partial message protection (decrypt all the
> elements) and forward this message to the final web service
> destination. I thought this could be done within an interceptor. CXF
> itself is not providing a webservice endpoint implementation. CXF does
> the decryption only.
>
> Could anybody give me some hints how I could achieve that? What kind
> of interceptor? In which phase it should be? Especially, how I can
> forward the message?
>
> Thanks
> Oliver
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: Partial Message decryption, message forwarded in interceptor
Posted by Daniel Kulp <dk...@apache.org>.
Oliver,
Couple options:
1) The "pure" cxf/jaxws way would be to write a "Provider<SOAPMessage>"
impl that would take the SOAPMessage and then use a Dispatch style
client (message mode) to just send it onto a new location. That would
require a little bit of coding, but not much. You COULD actually write
a generic one that had a "newEndpointURL" property that could be
configed in spring and thus be relatively generic and reusable.
2) You MAY also be able to use something like Apache Camel to to the
routing. I'm not really sure though. I do know they have some CXF
support, but I'm not sure what the current level is.
Dan
On Friday 16 November 2007, Wulff, Oliver wrote:
> Hi all
>
> I'd like to use CXF to do partial message protection (decrypt all the
> elements) and forward this message to the final web service
> destination. I thought this could be done within an interceptor. CXF
> itself is not providing a webservice endpoint implementation. CXF does
> the decryption only.
>
> Could anybody give me some hints how I could achieve that? What kind
> of interceptor? In which phase it should be? Especially, how I can
> forward the message?
>
> Thanks
> Oliver
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog