Axis Ws-Security
hi all
i want to to try out an example for encrypting webservices with WS-Security
So i have a client and a server. the server ist very simple (see below).
i ve created the client one time from the wsdl of the server and tried also to code the client without wsdl. both give me the same error-code. i can compile the client without errors but
when i want to execute the client then i get following error-code. i dont know how to proceed. please help
[error-CODE]
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xml/utils/URI$MalformedURIException
at org.apache.ws.security.message.WSSecSignature.prepare(WSSecSignature.java:350)
at org.apache.ws.security.message.WSSecSignature.build(WSSecSignature.java:703)
at org.apache.ws.security.action.SignatureAction.execute(SignatureAction.java:54)
at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:192)
at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:170)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at ha.TestSignaturSoapBindingStub.getGreeting(TestSignaturSoapBindingStub.java:106)
at TestSignaturClient.main(TestSignaturClient.java:18)[/CODE]
the Server
[CODE]public class TestSignatur {
public String getGreeting(String name)
{
return "Hello "+name +"!";
}
}[/CODE]
The Client not from wsdl
[CODE]
import org.apache.axis.configuration.FileProvider;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
import java.net.URL;
public class TestSignaturClient
{
public static void main(String[] args) throws Exception
{
try
{
EngineConfiguration config = new FileProvider("c:\\java\\tomcat\\webapps\\axis\\WEB-INF\\client-config.wsdd");
Service service = new Service(config);
Call call=(Call) service.createCall();
URL url = new URL("http://localhost:8080/axis/services/TestService");
call.setTargetEndpointAddress(url);
call.setOperationName("getGreeting");
call.addParameter("name",XMLType.XSD_STRING,ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);
Object parameters[]=new Object[1];
parameters[0]="Tester";
Object returnValue=call.invoke(parameters);
System.out.println("Response: "+returnValue);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}[/CODE]
client from wsdl
[CODE]
import ha.*;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.configuration.FileProvider;
public class TestSignaturClient
{
public static void main(String[] args) throws Exception
{
EngineConfiguration config = new FileProvider("c:\\java\\tomcat\\webapps\\axis\\WEB-INF\\client-config.wsdd");
TestSignaturServiceLocator loc = new TestSignaturServiceLocator(config);
TestSignatur_PortType pt = loc.getTestSignatur();
pt.getGreeting("hallo");
}
}[/CODE]
the server-wsdd (snippet)
[CODE]
<service name="TestSignatur" provider="java:RPC" style="document" use="literal">
<requestFlow>
<handler type="soapmonitor"/>
<handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
<parameter name="action" value="Signature"/>
<parameter name="signaturePropFile" value="server_crypto.properties" />
</handler>
</requestFlow>
<responseFlow>
<handler type="java:org.apache.ws.axis.security.WSDoAllSender">
<parameter name="action" value="Signature"/>
<parameter name="user" value="server"/>
<parameter name="passwordCallbackClass" value="PWCallback"/>
<parameter name="signaturePropFile" value="server_crypto.properties" />
</handler>
<handler type="soapmonitor"/>
</responseFlow>
<parameter name="className" value="TestSignatur"/>
<parameter name="allowedMethods" value="*"/>
<parameter name="scope" value="application"/>
</service>[/CODE]
the client wsdd
[CODE]
<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="action" value="Signature"/>
<parameter name="user" value="client"/>
<parameter name="passwordCallbackClass" value="PWCallbackClient"/>
<parameter name="signaturePropFile" value="client_crypto.properties" />
<parameter name="mustUnderstand" value="false" />
</handler>
</requestFlow>
<responseFlow>
<handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
<parameter name="action" value="Signature"/>
<parameter name="signaturePropFile" value="client_crypto.properties" />
</handler>
</responseFlow>
</globalConfiguration>
</deployment>
[/CODE]
the client_crypto.properties and the client.keystore also the server_crypto.properties and the server.keystore are in the classes directory
please help
Message was edited by:
max-pade

