Hi, Sanka
you are right.  After I use the <policy-subject identifier="binding:soap12" />, The policy is the first element of <wsdl:definition>. For each binding, the policy element is referenced.
<wsdl:binding name="programport_binding" type="tns:programwsPortType">
<wsp:PolicyReference URI="#UToverHTTP"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
...

Thanks for the help

-jason



Sanka Samaranayake wrote:
Hi Jason,

I think you should specify  <policy-subject identifier="binding:soap12" /> instead of <policy-subject identifier="binding:programport_binding" />.

Note that <policy-subject identifier="binding:soap12" /> will attached the specified policies to all soap12 bindings of your service. If you need to attach the specified policies to both soap11 and soap12 bindings you should include  both <policy-subject identifier="binding:soap11" /> and <policy-subject identifier="binding:soap12" /> elements.

You can't attach a policy to a particular binding by setting the  identifier attribute of  <policy-subject .. > element to that binding name. It is a limitation we have at the moment.

Sanka

On Thu, May 8, 2008 at 9:17 PM, jason zhang <[EMAIL PROTECTED]> wrote:
Hi, Sanka
This does not work.
My original wsdl is like this
<wsdl:definitions >
    ...
    <wsdl:binding name="programport_binding" type="tns:programwsPortType">
    ...
</wsdl:definition>

My service.xml is like this
<serviceGroup>
    <service name="programws">
        <module ref="rampart" />
       ...
<parameter name="useOriginalwsdl">false</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>

<wsp:PolicyAttachment
            xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
            <wsp:AppliesTo>
                <policy-subject identifier="binding:programport_binding" />
                <!--  policy-subject identifier="binding:soap12" / -->

            </wsp:AppliesTo>
            <wsp:Policy wsu:Id="UToverHTTP" ...>
   </wsp:PolicyAttachment>
...
</serviceGroup>         
The generated wsdl does not have policy element at all.

thanks

-jason


Sanka Samaranayake wrote:
If you want to attach a policy to a particular binding you should do that in the services.xml as follows.

<service>

<wsp:PolicyAttachment xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
      <wsp:AppliesTo>
        <policy-subject identifier="binding:soap11" />
        <policy-subject identifier="binding:soap12" />
      </wsp:AppliesTo>

      <wsp:Policy wsu:Id="UToverHTTP" ...> ...   </wsp:Policy>

 </wsp:PolicyAttachment>

</service>

HTH

Sanka
    




On Sun, May 4, 2008 at 2:48 PM, jason zhang <[EMAIL PROTECTED]> wrote:
Hi, all
I am using axis2 1.4 with rampart 1.4 RC1. My services.xml is like this
----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<serviceGroup>
  <service name="programws">
       ...
      <wsp:Policy wsu:Id="UToverHTTP"
         xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
          xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
          xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
          ....
      </wsp:Policy>
  </service>
</serviceGroup>

Then I retrieve the generated wsdl from web interface (http://localhost:8080/cmdportal1/services/programws?wsdl)
My wsdl is like this
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions >
  <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utilit
y-1.0.xsd" wsu:Id="UToverHTTP">
      ...
  </wsp:Policy>
  <wsdl:documentation>programws</wsdl:documentation>
  <wsdl:types>
   ...
 <wsdl:types>
 ....
</wsdl:definitions>

Should the policy element  be the first element of <wsdl:binding>?

thanks

-jason







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Sanka Samaranayake
WSO2 Inc.

http://sankas.blogspot.com/
http://www.wso2.org/




--
Sanka Samaranayake
WSO2 Inc.

http://sankas.blogspot.com/
http://www.wso2.org/

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to