On Jan 7, 2008 5:31 AM, Stephen Souness <[EMAIL PROTECTED]> wrote:

> Do I need to provide a policy file, and if so how do I tell WSDL2Java
> where to look for it?


see the test java file I have given. you have to give the rampart specific
policy file to the stub.
normally in a wsdl file you get only the security policies.

in this example it is give as an Policy object
CryptoConfig signcriptoInfo = new CryptoConfig();
        signcriptoInfo.setProvider(Merlin.class.getName());
        Properties properties = new Properties();
        properties.setProperty("
org.apache.ws.security.crypto.merlin.keystore.type", "JKS");
        properties.setProperty("org.apache.ws.security.crypto.merlin.file",
"security_client_wcf/conf/sec.jks");
        properties.setProperty("
org.apache.ws.security.crypto.merlin.keystore.password", "password");
        signcriptoInfo.setProp(properties);

        CryptoConfig encriptcriptoInfo = new CryptoConfig();
        encriptcriptoInfo.setProp(properties);
        encriptcriptoInfo.setProvider(Merlin.class.getName());

        RampartConfig config = new RampartConfig();
        config.setUser("alice");
        config.setEncryptionUser("bob");
        config.setPwCbClass("util.PasswordCallbackHandler");
        config.setSigCryptoConfig(signcriptoInfo);
        config.setEncrCryptoConfig(encriptcriptoInfo);

        ramapConfigPolicy = new Policy();
        ramapConfigPolicy.addAssertion(config);

but you may do the following as well using a policy file.

  StAXOMBuilder builder = new StAXOMBuilder(SECURITY_POLICY_FILE);
        Policy securityPolicy = PolicyEngine.getPolicy(
builder.getDocumentElement());

        serviceClient.getServiceContext
().getConfigurationContext().setProperty(
RampartMessageData.KEY_RAMPART_POLICY, securityPolicy);


thanks,
Amila.


>
>
> Amila Suriarachchi wrote:
> > When you generate the code it adds the security policies to input and
> > output messages.
> > Here codegen tool normalize the policy and attached it as a string so
> > that runtime
> > it builds the policy from that.
> >
> > See the attached test case.
> >
> > Amila.
> >
> >
> >
> > On Dec 21, 2007 2:59 AM, Stephen Souness <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     Thanks for that Amila.
> >
> >     I've tried the following:
> >
> >     wsdl2java -pn A12Binding -o generated -uri C:\interop.wsdl
> >
> >
> >     I haven't noticed anything in the generated EchoServiceStub.javathat
> >     deals with the X509 or other security aspects specified in the
> >     A12Binding_policy policy.
> >
> >     Is their some additional axis2 setup required?
> >
> >
> >     --
> >     Stephen
> >
> >
> >
> >     Amila Suriarachchi wrote:
> >      > see some security samples here
> >      > http://131.107.72.15/ilab/
> >      >
> >      > Amila
> >      >
> >      > On Dec 20, 2007 1:49 AM, Stephen Souness < [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >      > <mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
> >      >
> >      >     Hi all,
> >      >
> >      >     Can anyone direct me to an example of a WSDL which includes
> valid
> >      >     policy
> >      >     references, which wsdl2java can interpret and generate an
> >     appropriate
> >      >     client stub from?
> >      >
> >      >     Alternatively, is there a better way to generate the client
> code?
> >      >
> >      >     --
> >      >     Stephen
> >      >
> >      >
> >      >
> >
> ---------------------------------------------------------------------
> >      >     To unsubscribe, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >      >     <mailto:[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>>
> >      >     For additional commands, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >      >     <mailto: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>>
> >      >
> >      >
> >      >
> >      >
> >      > --
> >      > Amila Suriarachchi,
> >      > WSO2 Inc.
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     For additional commands, e-mail: [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> > --
> > Amila Suriarachchi,
> > WSO2 Inc.
> >
> >
> > ------------------------------------------------------------------------
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Amila Suriarachchi,
WSO2 Inc.

Reply via email to