Hi,
I am trying to access a secure web service using the method mentioned in
[1]. But I am getting the following error.
Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.neethi.PolicyEngine.getPolicy(Ljava/lang/Object;)Lorg/apache/neethi/Policy;
at
org.wso2.dashboard.client.DataServiceStub.getPolicy(DataServiceStub.java:771)
at
org.wso2.dashboard.client.DataServiceStub.populateAxisService(DataServiceStub.java:57)
at
org.wso2.dashboard.client.DataServiceStub.<init>(DataServiceStub.java:202)
at
org.wso2.dashboard.client.DataServiceStub.<init>(DataServiceStub.java:191)
at org.wso2.dashboard.publish.data.DataPublisher.main(DataPublisher.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
I have included the dependencies in the pom below.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<axis2.version>1.6.1</axis2.version>
<rampart.version>1.6.1</rampart.version>
</properties>
<repositories>
<repository>
<id>wso2-nexus</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories>
<dependencies>
<!--Axis2 Dependencies-->
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>${axis2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>${axis2.version}</version>
</dependency>
<!-- Apache Rampart-->
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-core</artifactId>
<version>${rampart.version}</version>
</dependency>
<!--Rampart Dependencies-->
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
I have also included the code segment as well. I have extracted the Policy
from the wsdl exposed after the service is deployed and saved it in
"wso2MDPolicy.xml.'
public class DataPublisher {
public static void main(String[] args) throws Exception {
String epr = "https://10.100.4.10:9443/services/XXXXXXX";
System.setProperty("javax.net.ssl.trustStore", (new
File("../src/main/resources/wso2carbon.jks")).getAbsolutePath());
System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
ConfigurationContext ctx = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(null, null);
ServiceStub stub = new ServiceStub(ctx,epr);
ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
client.engageModule("rampart");
options.setUserName("admin");
options.setPassword("admin");
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
loadPolicy("../src/main/resources/wso2MDPolicy.xml"));
InsertRawLeadsPerWeek request = new InsertRawLeadsPerWeek();
request.setStart_date("2012-04-08");
request.setEnd_date("2012-04-5");
request.setTotal_users(1000);
request.setEu_users(1000);
request.setNa_users(1000);
request.setRow_users(1000);
request.setUnclassified_users(10001);
stub.insertRawLeadsPerWeek(request);
}
private static Policy loadPolicy(String path) throws Exception {
InputStream resource = new FileInputStream(path);
StAXOMBuilder builder = new StAXOMBuilder(resource);
return PolicyEngine.getPolicy(builder.getDocumentElement());
}
}
[1]
https://docs.wso2.com/display/DSS322/Secure+Data+Service+Sample#SecureDataServiceSample-Aboutthesample
Any help on this issue is appreciated.
Thanks.
--
Sabra Ossen
*Software Engineering Intern*
Mobile : +94 (0) 775 837 356
[email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev