You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jeremy Robertson <je...@ldschurch.org> on 2010/12/07 19:17:03 UTC

using @Policy to populate WSDL

I am trying to use @Policy to add security information to the WSDL, but so far it does not seem to have any effect.

Here is what I have specified:

	@Policies({
		//@Policy(uri="resources/wsPolicy.xml", includeInWSDL=true)
		@Policy(uri="wsPolicy.xml", includeInWSDL=true)
	})

I have tried specifying this on individual methods as well as on the service interface. I also tried enabling the policy framework (<p:engine enabled="true" ignoreUnknownAssertions="true"/>).

I tried placing the referenced wsPolicy.xml both in the resources folder (src/main/resources), and also in the site root.

I am not seeing any errors or warnings about not being able to find the policy file or about it being invalid (although it may not be valid at this point)... As far as I can make out, the annotation is being ignored.

I am currently using CXF 2.3.1, Spring 3.0.5, and Maven.

Can anyone give me any further guidance on what I need to do?


Thanks,
Jeremy Robertson



 NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.



RE: using @Policy to populate WSDL

Posted by karamelka <ak...@gmail.com>.
I have already found the answer 
http://cxf.547215.n5.nabble.com/WS-Policy-reference-during-WSDL-generation-td3230067.html#a3334678
here 
-- 
View this message in context: http://cxf.547215.n5.nabble.com/using-Policy-to-populate-WSDL-tp3296244p3334682.html
Sent from the cxf-user mailing list archive at Nabble.com.

RE: using @Policy to populate WSDL

Posted by karamelka <ak...@gmail.com>.
Can you show the code or write the resolution of your problem? I need to add
policy to the cxf auto generated wsdl using @Policy annotation. Thank you.
-- 
View this message in context: http://cxf.547215.n5.nabble.com/using-Policy-to-populate-WSDL-tp3296244p3334578.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: using @Policy to populate WSDL

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 07 December 2010 5:20:58 pm Jeremy Robertson wrote:
> I am now getting the policy populated in the WSDL, but it's showing up
> twice:

No idea.   Can you create a small test case and file a bug?

Dan


> 
>     </wsdl:port>
>   </wsdl:service>
>     <wsp:Policy wsu:Id="UsernameToken"
> xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecur
> ity-utility-1.0.xsd"> <wsp:ExactlyOne>
>     <wsp:All>
>       <sp:SupportingTokens>
>         <wsp:Policy>
>           <sp:UsernameToken
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Incl
> udeToken/AlwaysToRecipient">
> <wsp:Policy><sp:WssUsernameToken10/></wsp:Policy>
>           </sp:UsernameToken>
>         </wsp:Policy>
>       </sp:SupportingTokens>
>     </wsp:All>
>   </wsp:ExactlyOne>
> </wsp:Policy>
>     <wsp:Policy wsu:Id="UsernameToken"
> xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
> xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
> xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecur
> ity-utility-1.0.xsd"> <wsp:ExactlyOne>
>     <wsp:All>
>       <sp:SupportingTokens>
>         <wsp:Policy>
>           <sp:UsernameToken
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/Incl
> udeToken/AlwaysToRecipient">
> <wsp:Policy><sp:WssUsernameToken10/></wsp:Policy>
>           </sp:UsernameToken>
>         </wsp:Policy>
>       </sp:SupportingTokens>
>     </wsp:All>
>   </wsp:ExactlyOne>
> </wsp:Policy>
> </wsdl:definitions>
> 
> The reference to the policy also appears twice under wsdl:binding...
> 
> I have the following annotation:
> @Policy(uri="wsPolicy.xml", includeInWSDL=true)
> @WebService(...)
> @SOAPBinding(...)
> public interface MyService {
> 
> Any ideas why it is being duplicated?
> 
> Thanks,
> Jeremy Robertson
> 
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Tuesday, December 07, 2010 12:48 PM
> To: Jeremy Robertson
> Subject: Re: using @Policy to populate WSDL
> 
> On Tuesday 07 December 2010 2:38:30 pm Jeremy Robertson wrote:
> > Adding that import did the trick. Thanks!
> > <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
> 
> Added to the docs.  Thanks!
> Dan
> 
> > Jeremy
> > 
> > -----Original Message-----
> > From: Daniel Kulp [mailto:dkulp@apache.org]
> > Sent: Tuesday, December 07, 2010 12:04 PM
> > To: users@cxf.apache.org
> > Cc: Jeremy Robertson
> > Subject: Re: using @Policy to populate WSDL
> > 
> > 
> > What does your spring config look like?  Are you importing
> > META-INF/cxf/cxf-extension-policy.xml ?
> > 
> > 
> > Dan
> > 
> > On Tuesday 07 December 2010 1:17:03 pm Jeremy Robertson wrote:
> > > I am trying to use @Policy to add security information to the WSDL, but
> > > so far it does not seem to have any effect.
> > > 
> > > Here is what I have specified:
> > > 	@Policies({
> > > 	
> > > 		//@Policy(uri="resources/wsPolicy.xml", includeInWSDL=true)
> > > 		@Policy(uri="wsPolicy.xml", includeInWSDL=true)
> > > 	
> > > 	})
> > > 
> > > I have tried specifying this on individual methods as well as on the
> > > service interface. I also tried enabling the policy framework
> > > (<p:engine enabled="true" ignoreUnknownAssertions="true"/>).
> > > 
> > > I tried placing the referenced wsPolicy.xml both in the resources
> > > folder (src/main/resources), and also in the site root.
> > > 
> > > I am not seeing any errors or warnings about not being able to find the
> > > policy file or about it being invalid (although it may not be valid at
> > > this point)... As far as I can make out, the annotation is being
> > > ignored.
> > > 
> > > I am currently using CXF 2.3.1, Spring 3.0.5, and Maven.
> > > 
> > > Can anyone give me any further guidance on what I need to do?
> > > 
> > > 
> > > Thanks,
> > > Jeremy Robertson
> > > 
> > >  NOTICE: This email message is for the sole use of the intended
> > > 
> > > recipient(s) and may contain confidential and privileged information.
> > > Any unauthorized review, use, disclosure or distribution is
> > > prohibited. If you are not the intended recipient, please contact the
> > > sender by reply email and destroy all copies of the original message.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

RE: using @Policy to populate WSDL

Posted by Jeremy Robertson <je...@ldschurch.org>.
I am now getting the policy populated in the WSDL, but it's showing up twice:

    </wsdl:port>
  </wsdl:service>
    <wsp:Policy wsu:Id="UsernameToken" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <wsp:ExactlyOne>
    <wsp:All>
      <sp:SupportingTokens>
        <wsp:Policy>
          <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
          	<wsp:Policy><sp:WssUsernameToken10/></wsp:Policy>
          </sp:UsernameToken>
        </wsp:Policy>
      </sp:SupportingTokens>
    </wsp:All>
  </wsp:ExactlyOne>
</wsp:Policy>
    <wsp:Policy wsu:Id="UsernameToken" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <wsp:ExactlyOne>
    <wsp:All>
      <sp:SupportingTokens>
        <wsp:Policy>
          <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
          	<wsp:Policy><sp:WssUsernameToken10/></wsp:Policy>
          </sp:UsernameToken>
        </wsp:Policy>
      </sp:SupportingTokens>
    </wsp:All>
  </wsp:ExactlyOne>
</wsp:Policy>
</wsdl:definitions>

The reference to the policy also appears twice under wsdl:binding...

I have the following annotation:
@Policy(uri="wsPolicy.xml", includeInWSDL=true)
@WebService(...)
@SOAPBinding(...)
public interface MyService {

Any ideas why it is being duplicated?

Thanks,
Jeremy Robertson

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Tuesday, December 07, 2010 12:48 PM
To: Jeremy Robertson
Subject: Re: using @Policy to populate WSDL

On Tuesday 07 December 2010 2:38:30 pm Jeremy Robertson wrote:
> Adding that import did the trick. Thanks!
> <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />

Added to the docs.  Thanks!
Dan


> 
> Jeremy
> 
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Tuesday, December 07, 2010 12:04 PM
> To: users@cxf.apache.org
> Cc: Jeremy Robertson
> Subject: Re: using @Policy to populate WSDL
> 
> 
> What does your spring config look like?  Are you importing
> META-INF/cxf/cxf-extension-policy.xml ?
> 
> 
> Dan
> 
> On Tuesday 07 December 2010 1:17:03 pm Jeremy Robertson wrote:
> > I am trying to use @Policy to add security information to the WSDL, but
> > so far it does not seem to have any effect.
> > 
> > Here is what I have specified:
> > 	@Policies({
> > 	
> > 		//@Policy(uri="resources/wsPolicy.xml", includeInWSDL=true)
> > 		@Policy(uri="wsPolicy.xml", includeInWSDL=true)
> > 	
> > 	})
> > 
> > I have tried specifying this on individual methods as well as on the
> > service interface. I also tried enabling the policy framework (<p:engine
> > enabled="true" ignoreUnknownAssertions="true"/>).
> > 
> > I tried placing the referenced wsPolicy.xml both in the resources folder
> > (src/main/resources), and also in the site root.
> > 
> > I am not seeing any errors or warnings about not being able to find the
> > policy file or about it being invalid (although it may not be valid at
> > this point)... As far as I can make out, the annotation is being ignored.
> > 
> > I am currently using CXF 2.3.1, Spring 3.0.5, and Maven.
> > 
> > Can anyone give me any further guidance on what I need to do?
> > 
> > 
> > Thanks,
> > Jeremy Robertson
> > 
> >  NOTICE: This email message is for the sole use of the intended
> > 
> > recipient(s) and may contain confidential and privileged information. Any
> > unauthorized review, use, disclosure or distribution is prohibited. If
> > you are not the intended recipient, please contact the sender by reply
> > email and destroy all copies of the original message.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog


 NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.



Re: using @Policy to populate WSDL

Posted by Daniel Kulp <dk...@apache.org>.
What does your spring config look like?  Are you importing 
META-INF/cxf/cxf-extension-policy.xml ?


Dan


On Tuesday 07 December 2010 1:17:03 pm Jeremy Robertson wrote:
> I am trying to use @Policy to add security information to the WSDL, but so
> far it does not seem to have any effect.
> 
> Here is what I have specified:
> 
> 	@Policies({
> 		//@Policy(uri="resources/wsPolicy.xml", includeInWSDL=true)
> 		@Policy(uri="wsPolicy.xml", includeInWSDL=true)
> 	})
> 
> I have tried specifying this on individual methods as well as on the
> service interface. I also tried enabling the policy framework (<p:engine
> enabled="true" ignoreUnknownAssertions="true"/>).
> 
> I tried placing the referenced wsPolicy.xml both in the resources folder
> (src/main/resources), and also in the site root.
> 
> I am not seeing any errors or warnings about not being able to find the
> policy file or about it being invalid (although it may not be valid at
> this point)... As far as I can make out, the annotation is being ignored.
> 
> I am currently using CXF 2.3.1, Spring 3.0.5, and Maven.
> 
> Can anyone give me any further guidance on what I need to do?
> 
> 
> Thanks,
> Jeremy Robertson
> 
> 
> 
>  NOTICE: This email message is for the sole use of the intended
> recipient(s) and may contain confidential and privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited. If you
> are not the intended recipient, please contact the sender by reply email
> and destroy all copies of the original message.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog