Alright I have a wsdl with web methods that I create stubs via axis2java with the following command:
wsdl2java -uri https://path/to/service?wsdl -p com.my.java.package
It generates all the required stubs but I am having a hard time actually using them. I have two URLs both HTTPS however one of them has message encryption with rampart. I have been able to get the more difficult message encrypted URL to work fine.
I initialize my encrypted stub like follows:
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", null);
NetWS_0Stub stub = new NetWS_0Stub(ctx, aEndPoint);
ServiceClient client = stub._getServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(aEndPoint));
options.setProperty(RampartMessageData.KEY_RAMPART_POLICY, this.loadPolicy("repository/policy/HTTPS_Policy.xml"));
client.setOptions(options);
client.engageModule("rampart");
return stub;
For my non-encrypted (HTTPS ONLY) I have tried the above method of stub initializing as well as the following:
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("repository", null);
NetWS_0Stub stub = new NetWS_0Stub(ctx, aEndPoint);
ServiceClient client = stub._getServiceClient();
Options options = new Options();
options.setTo(new EndpointReference(aEndPoint));
client.setOptions(options);
The plain HTTPS stub does not work. At best I get a soap header missing exception. I can however use these web methods via SOAPui. So I know the URL/WSDL/web methods are working great. I am more familiar with wsimport and not axis2.... axis2 seems much more difficult to do such a simple thing.
How am I supposed to setup the stub for calling a non-message encrypted web service? Why is axis2 such a pain to work with? Is it just a problem with me not understanding something. If SOAPui can immediately generate web requests/responses then I feel the axis2 tool should be able to do the same especially since the web methods were creating and accessed via axis2 in glassfish. I have not setup SOAPui with any keystore/truststore it just works when I give it the wsdl.
If anyone needs particular code samples let me know I am unsure what information would even help someone help me out.