Does this mean that the client stubs generated by wsdl2java shouldn't be expected to include anything extra if the WSDL contains policy information?

The stubs that I have generated do not expose a getServiceContext() or _getServiceContext() method.

The tutorial at:
http://www.shellysaunders.co.uk/Blog/tabid/65/EntryID/2/Default.aspx
looks promising, but also indicates the _getServiceContext() method should be present.

Are you able to direct me to a simple complete example?

At the moment I have pieces from different sources that won't match up:
- a WSDL file from http://131.107.72.15/ilab/ (which is no longer accessible)
- the example Test class that was posted earlier
- some somewhat vague instructions in the axis2 documentation


--
Stephen



Amila Suriarachchi wrote:


On Jan 7, 2008 5:31 AM, Stephen Souness <[EMAIL PROTECTED] <mailto:[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]>
     > <mailto:[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.java that
     >     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]>>
     >      > <mailto: [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]>>
     >      >     <mailto: [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]>>
     >      >     <mailto: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
     >     <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>>
     >      >
     >      >
     >      >
     >      >
     >      > --
     >      > Amila Suriarachchi,
     >      > WSO2 Inc.
     >
     >
> ---------------------------------------------------------------------
     >     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]>


    ---------------------------------------------------------------------
    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]

Reply via email to