You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Detelin Yordanov <de...@gmail.com> on 2008/09/25 11:25:02 UTC

Policy annotation of original WSDL (returned when "useOriginalwsdl" is set)

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

Re: Policy annotation of original WSDL (returned when "useOriginalwsdl" is set)

Posted by Sanka Samaranayake <ss...@gmail.com>.
Please log a JIRA with the attached Java classes so that we can keep 
track of this for next version.

Thanks
Sanka

Detelin Yordanov wrote:
> 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
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org