Re: CXF, WS-Policy and Spring
I think you should inline policy expressions like this, have a look please at ws-policy system tests : beans xmlns:p=http://cxf.apache.org/policy; xsi:schemaLocation=...http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd...; jaxws:endpoint id=echoService implementor=com.example.EchoService address=/echo jaxws:features p:policies wsp:PolicyReference URI=#PolicyId/ /p:policies /jaxws:features /jaxws:endpoint wsp:Policy wsu:Id=PolicyId !-- ... -- /wsp:Policy /beans But, as I said earlier, CXF is not capable yet of automatically propagating such policy expressions into a generated wsdl, hence, at the moment, you need to do something like this : jaxws:endpoint id=echoService wsdlLocation=META-INF/wsdl/hello.wsdl/ With no policy expressions in the spring config but only in the explicitly created wsdl, this is only needed if the task is to have a non-CXF policy aware client like a NET client be capable of consuming the endpoint as expected : wsdl:definitions wsdl:service wsdl:port !-- your policy expression goes here -- /wsdl:port /wsdl:service /wsdl:definitions Hope this helps Sergey - Original Message - From: Gerhard Schlager [EMAIL PROTECTED] To: cxf-user@incubator.apache.org Sent: Wednesday, April 16, 2008 10:04 PM Subject: Re: CXF, WS-Policy and Spring BTW, this is the content of my Spring config file which leads to the exception. ?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:jaxws=http://cxf.apache.org/jaxws; xmlns:wsp=http://www.w3.org/2006/07/ws-policy; xmlns:wsrm=http://schemas.xmlsoap.org/ws/2005/02/rm/policy; xmlns:wsam=http://www.w3.org/2007/02/addressing/metadata; xmlns:mtom=http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization; xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd; import resource=classpath:META-INF/cxf/cxf.xml / import resource=classpath:META-INF/cxf/cxf-extension-soap.xml / import resource=classpath:META-INF/cxf/cxf-servlet.xml / jaxws:endpoint id=echoService implementor=com.example.EchoService address=/echo jaxws:features wsp:Policy wsrm:RMAssertion wsrm:InactivityTimeout Milliseconds=60 / wsrm:AcknowledgementInterval Milliseconds=200 / /wsrm:RMAssertion wsam:Addressing wsp:Policy / /wsam:Addressing mtom:OptimizedMimeSerialization / /wsp:Policy /jaxws:features /jaxws:endpoint /beans I have the following JARs in my build path: asm-2.2.3.jar commons-logging-1.1.jar cxf-2.0.5-incubator.jar geronimo-activation_1.1_spec-1.0.2.jar geronimo-annotation_1.0_spec-1.1.1.jar geronimo-javamail_1.4_spec-1.2.jar geronimo-servlet_2.5_spec-1.1.2.jar geronimo-stax-api_1.0_spec-1.0.1.jar geronimo-ws-metadata_2.0_spec-1.1.2.jar jaxb-api-2.0.jar jaxb-impl-2.0.5.jar jaxws-api-2.0.jar jetty-6.1.8.jar jetty-util-6.1.8.jar neethi-2.0.2.jar saaj-api-1.3.jar saaj-impl-1.3.jar slf4j-api-1.3.1.jar slf4j-jdk14-1.3.1.jar wsdl4j-1.6.1.jar wstx-asl-3.2.4.jar xml-resolver-1.2.jar XmlSchema-1.3.2.jar spring.jar Maybe those details help finding the cause of the exception. -- View this message in context: http://www.nabble.com/CXF%2C-WS-Policy-and-Spring-tp16718063p16733491.html Sent from the cxf-user mailing list archive at Nabble.com. IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: CXF, WS-Policy and Spring
Hi, I'm sorry to say it but I've never got to ensuring that for java-first services WS-Policy expressions get automatically added to a (generated) WSDL. I can't commit myself to fixing this issue at this stage, but whenever I get a chance to look at a WS-Policy stuff, I'll get it fixed first as it's obvious it's a major blocket to utilizing the CXF WS-Policy framework at a wider scale. Current WS-Policy implementation is a bit complicated, but the fix for this issue should be reasonably simple, it would probably require an update to a WS-PolicyFeature implementation which should register the policy extensors it discovers from a spring configuration with either the Endpoint or WSDLManager... The only workaround at this stage is to explictly create a WSDL and have those expressions bound to the right extension points. The other possibility is to consider creating a patch if it's a real blocker... Cheers, Sergey - Original Message - From: Gerhard Schlager [EMAIL PROTECTED] To: cxf-user@incubator.apache.org Sent: Wednesday, April 16, 2008 8:39 AM Subject: CXF, WS-Policy and Spring Hello! I'm currently trying to create a web service with CXF that can be used by a .NET client (WCF). In the documentation of Sun's Metro I read about WSIT which supports the interoperability between Java and .NET. WSIT in NetBeans is automatically adding a few things to the WSDL: wsp:Policy wsu:Id=HelloWorld_policy wsp:ExactlyOne wsp:All wsrm:RMAssertion wsrm:InactivityTimeout Milliseconds=60/ wsrm:AcknowledgementInterval Milliseconds=200/ /wsrm:RMAssertion wsoma:OptimizedMimeSerialization/ /wsp:All /wsp:ExactlyOne /wsp:Policy Can I do the same thing with CXF? I tried adding the following to the endpoint's Spring bean: bean id=classifierService class=com.example.HelloWorldImpl !-- properties -- /bean jaxws:endpoint id=helloWorldEndpoint implementorClass=com.example.HelloWorldImpl implementor=#helloWorld address=/helloWorld jaxws:properties entry key=mtom-enabled value=true / /jaxws:properties jaxws:features wsp:Policy wsrm:RMAssertion wsrm:InactivityTimeout Milliseconds=60/ wsrm:AcknowledgementInterval Milliseconds=200 / /wsrm:RMAssertion wsam:Addressing/ mtom:OptimizedMimeSerialization / /wsp:Policy /jaxws:features /jaxws:endpoint However, that didn't work as expected. Spring throws some type conversion exceptions when I add the jaxws:features to the endpoint's bean. Am I doing something completely wrong? I'd be really grateful if somebody could provide a working example that shows a complete Spring configuration file with namespaces, schemaLocations and the policy configuration. Thanks in advance for your help. Best regards, Gerhard -- View this message in context: http://www.nabble.com/CXF%2C-WS-Policy-and-Spring-tp16718063p16718063.html Sent from the cxf-user mailing list archive at Nabble.com. IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: CXF, WS-Policy and Spring
Hello Sergey, Sergey Beryozkin wrote: I'm sorry to say it but I've never got to ensuring that for java-first services WS-Policy expressions get automatically added to a (generated) WSDL. I can't commit myself to fixing this issue at this stage, but whenever I get a chance to look at a WS-Policy stuff, I'll get it fixed first as it's obvious it's a major blocket to utilizing the CXF WS-Policy framework at a wider scale. Current WS-Policy implementation is a bit complicated, but the fix for this issue should be reasonably simple, it would probably require an update to a WS-PolicyFeature implementation which should register the policy extensors it discovers from a spring configuration with either the Endpoint or WSDLManager... Now I'm a little bit confused. After reading [1] I thought it would be possible to configure the WS-Policy with Spring. I just couldn't get it working because of some exceptions (I can post them in a few hours if you need them) that Spring was throwing at me. ;-) So, are you saying it currently can't be done at all? That would be too bad. I had some problems with Sun's Metro in conjunction with Spring and Hibernate so I switched back to CXF. It looks like I can't use both of them. Writing my own patch is not possible since I need a solution within the next few days. Would it work if I used WSDL first? However, I guess I won't be able to use Spring's dependency injection then, will I? :-( [1] http://netzooid.com/blog/2007/04/23/cxf-spring-and-ws-policy-internals/ -- View this message in context: http://www.nabble.com/CXF%2C-WS-Policy-and-Spring-tp16718063p16721675.html Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF, WS-Policy and Spring
Hi I had some problems with Sun's Metro in conjunction with Spring and Hibernate so I switched back to CXF. Interesting :-). I think you can definitely use Spring and Hibernate in CXF. But as far as WS-Policy is concerned, in CXF you just need to put policy expressions, those starting with wsp:Policy explicitly in WSDL, say, as children of wsdl:service/wsdl:port. So you can use your Spring injection, but the only limitation is that the policy expressions need to reside in a given WSDL document. It should work just fine...Now, Metro has a better domain-specific WS-Policy support (specifically WS-SecurityPolicy), but the policy expressions which you listed will work in CXF AFAIK... Cheers, Sergey Hello Sergey, Sergey Beryozkin wrote: I'm sorry to say it but I've never got to ensuring that for java-first services WS-Policy expressions get automatically added to a (generated) WSDL. I can't commit myself to fixing this issue at this stage, but whenever I get a chance to look at a WS-Policy stuff, I'll get it fixed first as it's obvious it's a major blocket to utilizing the CXF WS-Policy framework at a wider scale. Current WS-Policy implementation is a bit complicated, but the fix for this issue should be reasonably simple, it would probably require an update to a WS-PolicyFeature implementation which should register the policy extensors it discovers from a spring configuration with either the Endpoint or WSDLManager... Now I'm a little bit confused. After reading [1] I thought it would be possible to configure the WS-Policy with Spring. I just couldn't get it working because of some exceptions (I can post them in a few hours if you need them) that Spring was throwing at me. ;-) So, are you saying it currently can't be done at all? That would be too bad. I had some problems with Sun's Metro in conjunction with Spring and Hibernate so I switched back to CXF. It looks like I can't use both of them. Writing my own patch is not possible since I need a solution within the next few days. Would it work if I used WSDL first? However, I guess I won't be able to use Spring's dependency injection then, will I? :-( [1] http://netzooid.com/blog/2007/04/23/cxf-spring-and-ws-policy-internals/ -- View this message in context: http://www.nabble.com/CXF%2C-WS-Policy-and-Spring-tp16718063p16721675.html Sent from the cxf-user mailing list archive at Nabble.com. IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: CXF, WS-Policy and Spring
Hi Gerhard, I'm not expert of ws-policy, but add spring configure to jaxws:endpoint per as below just works for me jaxws:features wsp:Policy wsrm:RMAssertion wsrm:InactivityTimeout Milliseconds=60/ wsrm:AcknowledgementInterval Milliseconds=200 / /wsrm:RMAssertion wsam:Addressing wsp:Policy/ /wsam:Addressing mtom:OptimizedMimeSerialization / /wsp:Policy /jaxws:features Also you need add namespace definition xmlns:wsp=http://www.w3.org/2006/07/ws-policy; xmlns:wsrm=http://schemas.xmlsoap.org/ws/2005/02/rm/policy; xmlns:wsam=http://www.w3.org/2007/02/addressing/metadata; xmlns:mtom=http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization; Regards Freeman Gerhard Schlager wrote: Hello Sergey, Sergey Beryozkin wrote: I'm sorry to say it but I've never got to ensuring that for java-first services WS-Policy expressions get automatically added to a (generated) WSDL. I can't commit myself to fixing this issue at this stage, but whenever I get a chance to look at a WS-Policy stuff, I'll get it fixed first as it's obvious it's a major blocket to utilizing the CXF WS-Policy framework at a wider scale. Current WS-Policy implementation is a bit complicated, but the fix for this issue should be reasonably simple, it would probably require an update to a WS-PolicyFeature implementation which should register the policy extensors it discovers from a spring configuration with either the Endpoint or WSDLManager... Now I'm a little bit confused. After reading [1] I thought it would be possible to configure the WS-Policy with Spring. I just couldn't get it working because of some exceptions (I can post them in a few hours if you need them) that Spring was throwing at me. ;-) So, are you saying it currently can't be done at all? That would be too bad. I had some problems with Sun's Metro in conjunction with Spring and Hibernate so I switched back to CXF. It looks like I can't use both of them. Writing my own patch is not possible since I need a solution within the next few days. Would it work if I used WSDL first? However, I guess I won't be able to use Spring's dependency injection then, will I? :-( [1] http://netzooid.com/blog/2007/04/23/cxf-spring-and-ws-policy-internals/
Re: CXF, WS-Policy and Spring
Thanks Freeman. Yes, I need to clarify that it will work indeed this way, it's just that the automatic publication of such policy expressions into a published WSDL (to be consumed by a NET client in this case) is not supported at this stage so that's why I was suggesting to put them into an explicit WSDL document and then link to that wsdl document from a jaxws:endpoint definition Cheers, Sergey From: Freeman Fang [EMAIL PROTECTED] To: cxf-user@incubator.apache.org Sent: Wednesday, April 16, 2008 2:50 PM Subject: Re: CXF, WS-Policy and Spring Hi Gerhard, I'm not expert of ws-policy, but add spring configure to jaxws:endpoint per as below just works for me jaxws:features wsp:Policy wsrm:RMAssertion wsrm:InactivityTimeout Milliseconds=60/ wsrm:AcknowledgementInterval Milliseconds=200 / /wsrm:RMAssertion wsam:Addressing wsp:Policy/ /wsam:Addressing mtom:OptimizedMimeSerialization / /wsp:Policy /jaxws:features Also you need add namespace definition xmlns:wsp=http://www.w3.org/2006/07/ws-policy; xmlns:wsrm=http://schemas.xmlsoap.org/ws/2005/02/rm/policy; xmlns:wsam=http://www.w3.org/2007/02/addressing/metadata; xmlns:mtom=http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization; Regards Freeman Gerhard Schlager wrote: Hello Sergey, Sergey Beryozkin wrote: I'm sorry to say it but I've never got to ensuring that for java-first services WS-Policy expressions get automatically added to a (generated) WSDL. I can't commit myself to fixing this issue at this stage, but whenever I get a chance to look at a WS-Policy stuff, I'll get it fixed first as it's obvious it's a major blocket to utilizing the CXF WS-Policy framework at a wider scale. Current WS-Policy implementation is a bit complicated, but the fix for this issue should be reasonably simple, it would probably require an update to a WS-PolicyFeature implementation which should register the policy extensors it discovers from a spring configuration with either the Endpoint or WSDLManager... Now I'm a little bit confused. After reading [1] I thought it would be possible to configure the WS-Policy with Spring. I just couldn't get it working because of some exceptions (I can post them in a few hours if you need them) that Spring was throwing at me. ;-) So, are you saying it currently can't be done at all? That would be too bad. I had some problems with Sun's Metro in conjunction with Spring and Hibernate so I switched back to CXF. It looks like I can't use both of them. Writing my own patch is not possible since I need a solution within the next few days. Would it work if I used WSDL first? However, I guess I won't be able to use Spring's dependency injection then, will I? :-( [1] http://netzooid.com/blog/2007/04/23/cxf-spring-and-ws-policy-internals/ IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: CXF, WS-Policy and Spring
Hi Sergey, Right, the wsdl is only contract between cxf server and .net client, so if cxf can't publish the policy assertion into wsdl, the .net client have no idea about the policy configuration. If client side is also cxf, we can use same spring way as server to enable ws-policy for client. Thanks for clarifying this issue for me, :-) Freeman Sergey Beryozkin wrote: Thanks Freeman. Yes, I need to clarify that it will work indeed this way, it's just that the automatic publication of such policy expressions into a published WSDL (to be consumed by a NET client in this case) is not supported at this stage so that's why I was suggesting to put them into an explicit WSDL document and then link to that wsdl document from a jaxws:endpoint definition Cheers, Sergey From: Freeman Fang [EMAIL PROTECTED] To: cxf-user@incubator.apache.org Sent: Wednesday, April 16, 2008 2:50 PM Subject: Re: CXF, WS-Policy and Spring Hi Gerhard, I'm not expert of ws-policy, but add spring configure to jaxws:endpoint per as below just works for me jaxws:features wsp:Policy wsrm:RMAssertion wsrm:InactivityTimeout Milliseconds=60/ wsrm:AcknowledgementInterval Milliseconds=200 / /wsrm:RMAssertion wsam:Addressing wsp:Policy/ /wsam:Addressing mtom:OptimizedMimeSerialization / /wsp:Policy /jaxws:features Also you need add namespace definition xmlns:wsp=http://www.w3.org/2006/07/ws-policy; xmlns:wsrm=http://schemas.xmlsoap.org/ws/2005/02/rm/policy; xmlns:wsam=http://www.w3.org/2007/02/addressing/metadata; xmlns:mtom=http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization; Regards Freeman Gerhard Schlager wrote: Hello Sergey, Sergey Beryozkin wrote: I'm sorry to say it but I've never got to ensuring that for java-first services WS-Policy expressions get automatically added to a (generated) WSDL. I can't commit myself to fixing this issue at this stage, but whenever I get a chance to look at a WS-Policy stuff, I'll get it fixed first as it's obvious it's a major blocket to utilizing the CXF WS-Policy framework at a wider scale. Current WS-Policy implementation is a bit complicated, but the fix for this issue should be reasonably simple, it would probably require an update to a WS-PolicyFeature implementation which should register the policy extensors it discovers from a spring configuration with either the Endpoint or WSDLManager... Now I'm a little bit confused. After reading [1] I thought it would be possible to configure the WS-Policy with Spring. I just couldn't get it working because of some exceptions (I can post them in a few hours if you need them) that Spring was throwing at me. ;-) So, are you saying it currently can't be done at all? That would be too bad. I had some problems with Sun's Metro in conjunction with Spring and Hibernate so I switched back to CXF. It looks like I can't use both of them. Writing my own patch is not possible since I need a solution within the next few days. Would it work if I used WSDL first? However, I guess I won't be able to use Spring's dependency injection then, will I? :-( [1] http://netzooid.com/blog/2007/04/23/cxf-spring-and-ws-policy-internals/ IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: CXF, WS-Policy and Spring
Would it work if I used WSDL first? However, I guess I won't be able to use Spring's dependency injection then, will I? :-( Yes you can. The wsdl first stuff doesn't change the spring injection stuff at all. All it really does is tell the runtime to publish that specific wsdl instead of generating one dynamically at runtime. Dan On Wednesday 16 April 2008, Gerhard Schlager wrote: Hello Sergey, Sergey Beryozkin wrote: I'm sorry to say it but I've never got to ensuring that for java-first services WS-Policy expressions get automatically added to a (generated) WSDL. I can't commit myself to fixing this issue at this stage, but whenever I get a chance to look at a WS-Policy stuff, I'll get it fixed first as it's obvious it's a major blocket to utilizing the CXF WS-Policy framework at a wider scale. Current WS-Policy implementation is a bit complicated, but the fix for this issue should be reasonably simple, it would probably require an update to a WS-PolicyFeature implementation which should register the policy extensors it discovers from a spring configuration with either the Endpoint or WSDLManager... Now I'm a little bit confused. After reading [1] I thought it would be possible to configure the WS-Policy with Spring. I just couldn't get it working because of some exceptions (I can post them in a few hours if you need them) that Spring was throwing at me. ;-) So, are you saying it currently can't be done at all? That would be too bad. I had some problems with Sun's Metro in conjunction with Spring and Hibernate so I switched back to CXF. It looks like I can't use both of them. Writing my own patch is not possible since I need a solution within the next few days. Would it work if I used WSDL first? However, I guess I won't be able to use Spring's dependency injection then, will I? :-( [1] http://netzooid.com/blog/2007/04/23/cxf-spring-and-ws-policy-internals / -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog