axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Detelin Yordanov" <detelinyorda...@gmail.com>
Subject Policy annotation of original WSDL (returned when "useOriginalwsdl" is set)
Date Thu, 25 Sep 2008 09:25:02 GMT
Hello guys,
  We had a recent requirement to attach policy information currently set on
an AxisService to the original WSDL returned when the service has been
deployed with "useOriginalwsdl"
set to true.
In this case, if any policy has been attached to the AxisService instance
(e.g. programatically), it will be "inserted" in the original WSDL
definition before printing it to the users.
The behaviour is the same as the current AxisService2WSDL11 implementation,
except that the code will work on javax.wsdl.Definition instance, instead of
on an OMElement.
If you think this could be useful extension to Axis2, we could help you
integrate it. I attach the Java class that handles this, as well as 2 JUnit
test cases:

1. PolicyAttachmentOriginalWSDLTest - attaches a policy to each policy
subject within an AxisService (port, binding, binding operation, binding
operation input/output, portType, etc.)
and verifies it is correctly attached in the returned "original" WSDL (by
checking for a PolicyReference element or a "PolicyURIs" attribute on the
corresponding WSDL element)

2. PolicyAttachmentGeneratedWSDLTest - tests the same thing, but this time
on the WSDL generated by AxisService2WSDL11 - this ensures that both
implementations attach the policies on the same wsdl elements and using the
same attachment approach (either PolicyReference or "PolicyURIs" attribute
depending on the policy subject).

For the PolicyAttacher to work, just two lines of code need to be added in
the AxisService#printUserWSDL(OutputStream, String) method:

PolicyAttacher attacher = new PolicyAttacher(this);
Definition definitionWithPolicies =
attacher.getDefinitionWithPolicies(definition);

//and then print "definitionWithPolicies" instead of "definition"

Even if you decide not to go for this contribution, I think that at least
the 2nd test case will be an useful addition to the axis2-integration
module.

Kind Regards,
   Detelin

Mime
View raw message