Wednesday, June 26, 2013

JBossWS 4.2.0.CR1 and the WS-Policy sets

Another WildFly release has just been announced... and it comes with the first 4.2.0 candidate release of JBossWS!
The latest JBossWS release comes with some bug fixes over the former Beta build as well as with the last  new feature we planned for addition in 4.2.0, that is additional WS-Policy functionalities for code-first development.
I've just written some documentation, but let me summarize the new features here: some users noticed that writing policy assertions for endpoint wsdl contracts is usually quite difficult and often represents an obstacle to quick development of ws-policy enabled endpoints prototypes.
So we basically decided to provide means for users to choose desired policy assertions among a list of pre-defined groups serving well known needs / scenarios. The result is a custom @PolicySets annotation to list groups of policy assertions; those will be automatically attached to the proper elements in the wsdl contract that is generated at deployment time and the ws stack will behave accordingly at runtime.
The JBossWS 4.2.0.CR1 artifacts come with some initial sets, more are to be added before going final (the feature is implemented, it's just a matter of deciding which set/combination of policies to grant a label). So this is yet another example where feedback is welcome... if you have suggestions for the pre-defined set to add, just post on the JBoss forum!

You can try JBossWS 4.2.0.CR1 either consuming it from the recent WildFly 8.0.0.Alpha2 or by pulling the artifacts from the Maven repository.
Enjoy!

2 comments:

urban said...

Alessio i love the policy sets idea and i am trying play with it but for testing from client side there isn't a good document i am aware of couldly kindly guide me if there is a good example about subject.

For now what i get is from my generated ws client is :

***********************
Create Web Service Client...
Oct 17, 2016 9:03:59 PM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2005/02/rm/policy}RMAssertion" was evaluated as "UNKNOWN".
Oct 17, 2016 9:03:59 PM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0019: Suboptimal policy alternative selected on the client side with fitness "UNKNOWN".
Create Web Service...
Call Web Service Operation...
Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: These policy alternatives can not be satisfied:
{http://schemas.xmlsoap.org/ws/2005/02/rm/policy}RMAssertion Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
at com.sun.proxy.$Proxy31.registerMember(Unknown Source)
at org.arasti.example.wssecurity.securejaxws.clientsample.ClientSample.main(ClientSample.java:14)

what should i do?

Alessio Soldano said...

Judging from the exception, the JBossWS / CXF stack is not being used, as I see classes from Metro / JDK impl of JAX-WS. Be sure to set the client classpath properly and post to the jbossws user forum in case you have further problems / doubts. Thanks.