Hi,
I am just starting to try to use axis2 to access Eloqua webservie api. Below code is from Using Eloqua WS API with Java - Part 1 and I have followed the pre-steps in the link.
// To debug the this line will set Log4J to use System.Out for a lot of // messages. // BasicConfigurator.configure(); // Configure your username and password here. String company = "TechnologyPartnerWelocalize"; String username = "leo.chen"; String password = "Password1"; // Assuming that the conf directory has the Axis2 config file and // Rampart is installed correctly. ConfigurationContext ctx = ConfigurationContextFactory .createConfigurationContextFromFileSystem("D:/axis2-1.6.2/conf", null); EloquaStub stub = new EloquaStub(ctx, "https://secure.eloqua.com/API/1.2/Service.svc"); ServiceClient sc = stub._getServiceClient(); Options options = sc.getOptions(); sc.engageModule("rampart"); options.setUserName(company + "\\" + username); options.setPassword(password); String[] assetTypes = stub.listAssetTypes(new ListAssetTypes()) .getListAssetTypesResult().getAssetTypes().getString(); System.out.println("Asset Types count : " + assetTypes.length); for (String s : assetTypes) { System.out.println(" -> " + s); }
But I have got following error when running above code.
Exception in thread "main" org.apache.axis2.AxisFault: An error occurred when verifying security for the message. at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at com.eloqua.secure.api.EloquaStub.listAssetTypes(EloquaStub.java:1928) at com.eloqua.sample.WSConsoleClient.main(WSConsoleClient.java:42)
And another problem is when I modified the company string to any of other stuff like "TechnologyPartnerWelocalize111", I will get below error
Exception in thread "main" org.apache.axis2.AxisFault: SOAP header missing at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:180) at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99) at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340) at org.apache.axis2.engine.Phase.invoke(Phase.java:313) at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at com.eloqua.secure.api.EloquaStub.listAssetTypes(EloquaStub.java:1928) at com.eloqua.sample.WSConsoleClient.main(WSConsoleClient.java:41) Caused by: org.apache.rampart.RampartException: SOAP header missing at org.apache.rampart.RampartEngine.process(RampartEngine.java:96) at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92) ... 10 more
I have logged into Eloqua console using "leo.chen/Password1" and found the Company Name is Technology Partner - Welocalize.
Any idea what causes this kind of errors? I am using Axis2-1.6.2 and rampart-1.6.2. What I have modified so far is copying modules from rampart-1.6.2 folder and axis2-1.6.2\repository to axis2-1.6.2\conf and commented line "<module ref="addressing"/>" in axis2.xml.