Title: R: [WSS4J 1.5] WS-Security Help Client-Server Configuration

Hi Martin
Thank for your help, I'm sorry for all my mistake I'm new of wss4j and I'm developing a service for my degree.

I understand what you say, in effect  I  don't need use  username and password so i change my deploy.wsdd:
<deployment
    xmlns="http://xml.apache.org/axis/wsdd/"
    xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

  <!-- Services from PerformWSService WSDL service -->

  <service name="PerformWService" provider="java:RPC" style="rpc" use="encoded">
      <parameter name="wsdlTargetNamespace" value="urn:PerformWService"/>
      <parameter name="wsdlServiceElement" value="PerformWSService"/>
      <parameter name="wsdlServicePort" value="PerformWService"/>
      <parameter name="className" value="PerformWS.PerformWServiceSoapBindingSkeleton"/>
      <parameter name="wsdlPortType" value="PerformWS"/>
      <parameter name="typeMappingVersion" value="1.2"/>
      <parameter name="allowedMethods" value="*"/>
      <parameter name="scope" value="Session"/>
<requestFlow>
   <handler type="java:org.apache.ws.axis.security.WSDoAllReceiver" >
     <parameter name="action" value="Signature"/>
     <parameter name="signaturePropFile"
value="cryptoReceiver.properties" />
   </handler>
</requestFlow>
  </service>
</deployment>

and move cryptoReceiver and my keystore cacert.jks in the folder axis/Web-Inf/classes.

even the client move the cryptoSender and x509pri.12 in PerformWeb/Web-Inf/classes

now I've a problem with the code that you send me and so it gives me an error on this:
this.deployTransport("http", new SimpleTargetedChain(new org.apache.axis.transport.http.HTTPSender));
on new org.apache.axis.transport.http.HTTPSender says misplaced consructor

and the last thing of the code you send me
w.setOption I don't understad what i need to insert in, I think that I've to set cryproSender.properties but I don't understand how.

Thank you very much for your help

Hermann


-----Messaggio originale-----
Da: Martin Kuba [mailto:[EMAIL PROTECTED]]
Inviato: mer 21/06/2006 15.08
A: [EMAIL PROTECTED]
Oggetto: Re: [WSS4J 1.5] WS-Security Help Client-Server Configuration

Hermann,

try to think more about what you want to do. You  are
just trying things randomly.
Also there are some obvious errors, see below:

[EMAIL PROTECTED] wrote:
> Hi All,
>
> I've a problem with the client of a WS Security application
>
>   <service name="PerformWService" provider="java:RPC" style="rpc"
> use="encoded">
>       <parameter name="wsdlTargetNamespace" value="urn:PerformWService"/>
>       <parameter name="wsdlServiceElement" value="PerformWSService"/>
>       <parameter name="wsdlServicePort" value="PerformWService"/>
>       <parameter name="className"
> value="PerformWS.PerformWServiceSoapBindingSkeleton"/>
>       <parameter name="wsdlPortType" value="PerformWS"/>
>       <parameter name="typeMappingVersion" value="1.2"/>
>       <parameter name="allowedMethods" value="*"/>
>       <parameter name="scope" value="Session"/>
> <responseFlow>

it should be <requestFlow>, if you want to *receive* the
security token on the server side.

>    <handler type="java:org.apache.ws.axis.security.WSDoAllReceiver" >
>      <parameter name="user" value="hermann"/>
>      <parameter name="passwordCallbackClass" value="1234567890"/>

the value must be qualified name of a *class*, as the parameter
name suggests, not an arbitrary string.

>      <parameter name="action" value="Signature"/>
>      <parameter name="signaturePropFile"
> value="cryptoReceiver.properties" />
>    </handler>
> </responseFlow>
>   </service>
> </deployment>
>
>
> The file cryptoReceiver is this:
> org.apache.ws.security.crypto.merlin.file=cacerts.jks
> org.apache.ws.security.crypto.merlin.keystore.type=JKS
> org.apache.ws.security.crypto.merlin.keystore.password=1234567890


> So that it receive a binary security token, I add
> cryptoReceiver.properties and my keystore file in the package of my
> service tomcat/webapps/axis/WEB-INF/classes/PerformWS

It will be very difficult to read the files from that location.
If you want to read them using a classloader, which you
probably want, as you don't specify any location,
they should be located in tomcat/webapps/axis/WEB-INF/classes/ directory.


>
> Now the problem is the client that is integrated in a jsp application
>
> I've in PerformWeb\WEB-INF\classes\stub of my tomcat application a class
> that call my service, in the package "stub" where I located my class and
> the class for locate the service, the file client-config.wsdd and the
> keystore pkcs12.

  That's again wrong place. If you want the files to be found, move
them into PerformWeb\WEB-INF\classes.

> client-config.wssd:
>
> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
> xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>   <transport name="http"
> pivot="java:org.apache.axis.transport.http.HTTPSender"/>
>    <globalConfiguration>
> <requestFlow>
>    <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >
>      <parameter name="user" value="hermann"/>
>      <parameter name="passwordCallbackClass" value="1234567890"/>

Again, the value should be a name of a class implementing
password callback.

>      <parameter name="action" value="Signature"/>
>      <parameter name="signatureKeyIdentifier" value="DirectReference" />
>      <parameter name="signaturePropFile" value="cryptoSender.properties" />
>    </handler>
> </requestFlow>
> </globalConfiguration >
> </deployment>
>
> cryptoSender.properties:
> org.apache.ws.security.crypto.merlin.file=x509pri.p12
> org.apache.ws.security.crypto.merlin.keystore.type=PKCS12
> org.apache.ws.security.crypto.merlin.keystore.password=1234567890
>
> the class is this:
>
> package stub;
> import java.util.*;
> import org.apache.axis.EngineConfiguration;
> import org.apache.axis.configuration.FileProvider;
>
> public class Chiamata
> {
>
>         String host="143.225.250.102";
>         String usr="viola";
>         String pass="giallo";
>         String com;
>         String ritorno;
>
>         public Chiamata(String h,String u,String p,String c)
>         {
>                 host=h;
>                 usr=u;
>                 pass=p;
>                 com=c;
>         }
>         public String getString()
>         {
>                  try{
>                       
>                         ritorno="Nel try ";
>                         EngineConfiguration config = new
> FileProvider("client-config.wsdd");

I don't think that you can read the file like this.
You would either need access to ServletContext
and use its getRealPath() method, or don't use
a client-config.wsdd file and do the configuration
in code.
For that, you need to extend SimpleProvider like this:

public class MyEngineConfiguration extends SimpleProvider {
     public MyEngineConfiguration() {
         super();

         this.deployTransport("http", new SimpleTargetedChain(new
org.apache.axis.transport.http.HTTPSender));
        //parameters
         Hashtable<String, Object> opts = new Hashtable<String, Object>(5);
         opts.put(AxisEngine.PROP_DISABLE_PRETTY_XML, Boolean.TRUE);
         this.setGlobalOptions(opts);
        //requestFlow
        org.apache.ws.axis.security.WSDoAllSender w = new WSDoAllSender();
        w.setOption(...);
        this.setGlobalResponse(w);

     }

     @Override
     public void configureEngine(AxisEngine engine) throws
ConfigurationException {
         engine.refreshGlobalOptions();
     }
}

and then do

PerformWSServiceLocator l= new
  PerformWSServiceLocator(new MyEngineConfiguration());

I did not try it with WSS4J, but it worked for me
when I needed to replace a HTTP trasport handler.


>                         PerformWSServiceLocator l=new
> PerformWSServiceLocator(config);
>                          ritorno=ritorno+"creato il locator ";
>                          PerformWServiceSoapBindingStub stub
> =(PerformWServiceSoapBindingStub) l.getPerformWService();
>                          ritorno=ritorno+"creato lo stub ";
>                          ritorno=stub.outputStr(host,usr,pass,com);
>                        
>                  }catch (Exception e)
>                  { ritorno=ritorno+"Si solleva una RemoteException";}
>                  return ritorno;
>          }
>
>
> How I Can read the file client-config.wsdd? if I use this method in the
> class It's return null
>
> Perhaps I've to specify some other things or I have some error in the
> component of my applicaion?
>
> Please help me to resolve this big problem.
>
> Thank You.
>

Martin
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno             Martin Kuba
Institute of Computer Science    email: [EMAIL PROTECTED]
Masaryk University             http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------

Reply via email to