I just realised I forgot to update rampart.mar files on the client side
with the SNAPSHOT version. I updated the client side with the latest
SNAPSHOT version. However, I get the following errors when I try to
consume the service with the client shown below:
Exception in thread "main" org.apache.axis2.AxisFault: Unable to engage
module : rampart
at
org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:33
9)
at
org.apache.rampart.policy.CommandLineClient.main(CommandLineClient.java:
59)
Basically, I'm getting errors at
client.engageModule("rampart");
I've tried changing it to:
client.engageModule("rampart-SNAPSHOT");
But I get similiar errors. What should the right parameter be for the
above method? My client is given below. Cheers
Regards
Sanjay
public class Client {
private static EndpointReference targetEPR =
new EndpointReference(
"http://localhost:8083/axis2/services/PolicyEchoService");
private static String confPath = "C:\\rampart\\policy";
private static BufferedReader console = null;
public static void main(String[] args) throws Exception {
ConfigurationContext ctx =
ConfigurationContextFactory.
createConfigurationContextFromFileSystem(confPath,
null);
ServiceClient client = new ServiceClient(ctx, null);
Options options = new Options();
options.setAction("urn:echo");
options.setTo(targetEPR);
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
loadPolicy( confPath + "/conf/policy.xml"));
//this username is authenticated against the PWHandlerClient
class
options.setUserName("sanjay");
//options.setPassword("wspwd");
client.setOptions(options);
client.engageModule("addressing");
client.engageModule("rampart");
OMElement result = client.sendReceive(getPayload());
String response = result.getFirstElement().getText();
System.out.println(response);
}
private static Policy loadPolicy(String xmlPath) throws Exception {
StAXOMBuilder builder = new StAXOMBuilder(xmlPath);
return PolicyEngine.getPolicy(builder.getDocumentElement());
}
private static OMElement getPayload() {
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace ns =
factory.createOMNamespace("http://policy.rampart.apache.org","ns1");
OMElement elem = factory.createOMElement("echo", ns);
return elem;
}
}
>-----Original Message-----
>From: Sanjay Vivek [mailto:[EMAIL PROTECTED]
>Sent: 25 February 2008 10:15
>To: [email protected]
>Subject: RE: Timestamp validation error when invoking a
>Rampart service with a .NET client.
>
>Hi again,
>
>I've just updated my rampart.mar and all the relevant jar
>files with the latest SNAPSHOT version. However, when I
>consume a simple Policy based echo service, I get the errors
>shown below. This service worked perfectly well before I
>updated my rampart installation with the SNAPSHOT version.
>I've also provided the TCPMON logs. I've also updated my
>axis2.xml to include the Security phase as described in
>http://mail-archives.apache.org/mod_mbox/ws-rampart-dev/200801.
mbox/%3c9
>[EMAIL PROTECTED]
>
>Any pointers on how I should proceed or what I'm doing wrong
>would be helpful. Cheers.
>
>Regards
>Sanjay
>
>Exception in thread "main" org.apache.axis2.AxisFault:
>java.lang.NoSuchFieldError: INVALID_SECURITY
> at
>org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(U
>tils.java
>:486)
> at
>org.apache.axis2.description.OutInAxisOperationClient.handleRes
>ponse(Out
>InAxisOperation.java:343)
> at
>org.apache.axis2.description.OutInAxisOperationClient.send(OutI
>nAxisOper
>ation.java:389)
> at
>org.apache.axis2.description.OutInAxisOperationClient.executeIm
>pl(OutInA
>xisOperation.java:211)
> at
>org.apache.axis2.client.OperationClient.execute(OperationClient
>.java:163
>)
> at
>org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient
>.java:528
>)
> at
>org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient
>.java:508
>)
> at
>org.apache.rampart.policy.CommandLineClient.main(CommandLineCli
>ent.java:
>61)
>
>
>TCPMON Request:
><?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope
>xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>xmlns:wsa="http://www.w3.org/2005/08/addressing">
> <soapenv:Header>
> <wsse:Security
>xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401
-wss-wsse
>curity-secext-1.0.xsd" soapenv:mustUnderstand="1">
> <wsse:UsernameToken
>xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-
>wss-wssec
>urity-utility-1.0.xsd" wsu:Id="UsernameToken-12430225">
> <wsse:Username>sanjay</wsse:Username>
> <wsse:Password
>Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-u
sername-t
>oken-profile-1.0#PasswordText">wspwd</wsse:Password>
> </wsse:UsernameToken>
> </wsse:Security>
>
><wsa:To>http://localhost:8083/axis2/services/PolicyEchoService</wsa:To>
>
><wsa:MessageID>urn:uuid:0781AB61A921057FFD1203933147477</wsa:MessageID>
> <wsa:Action>urn:echo</wsa:Action>
> </soapenv:Header>
> <soapenv:Body>
> <ns1:echo xmlns:ns1="http://policy.rampart.apache.org" />
> </soapenv:Body>
> </soapenv:Envelope>
>
>TCP Response:
>
><?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope
>xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>xmlns:wsa="http://www.w3.org/2005/08/addressing">
> <soapenv:Header>
>
><wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</ws
a:Action>
>
><wsa:RelatesTo>urn:uuid:0781AB61A921057FFD1203933147477</wsa:RelatesTo>
> </soapenv:Header>
> <soapenv:Body>
> <soapenv:Fault>
> <faultcode>soapenv:Server</faultcode>
> <faultstring>java.lang.NoSuchFieldError:
>INVALID_SECURITY</faultstring>
> <detail />
> </soapenv:Fault>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
>
>>-----Original Message-----
>>From: Ruchith Fernando [mailto:[EMAIL PROTECTED]
>>Sent: 25 February 2008 07:07
>>To: [email protected]
>>Subject: Re: Timestamp validation error when invoking a
>Rampart service
>>with a .NET client.
>>
>>Hi,
>>
>>Please get them from here :
>>
>>http://people.apache.org/~ruchithf/rampart/SNAPSHOT/
>>
>>Thanks,
>>Ruchith
>>
>