Can Axis 2 wsdl2java be used to generate client code that uses HTTPS?

Using the default parameters, the wsdl2java axis tool 2 takes wsdl as an input file and generates client-side Java code that communicates with the SOAP endpoint using the HTTP protocol, as in the example below:

wsdl2java -uri MyService.wsdl

      

I would like to know if there is an input parameter that can be passed to the wsdl2java tool to generate client side code that communicates over HTTPS with a SOAP endpoint.

+1


a source to share


2 answers


We use Axis over HTTPS quite regularly. As Ted said, getting SSL certificates in order (esp if self-signed) is very important as it is effectively a transaction violator.

When coding, we usually generate our Axis carcasses against a simple HTTP service. The call to the ServiceLocator subclass generated by the wsdl2java command will have a getMyService method that uses a URL instead of a parameter that takes no parameters. Depending on the exact version of Axis and your service name, the class names may be slightly different. But in most cases, the following example demonstrates how easy it is to change the URL (HTTPS or HTTP) to point to wherever you want when instantiating your stub objects.



MyServiceServiceLocator locator = new MyServiceServiceLocator();
MyService_PortType myservice = locator.getMyService(new URL("https://www.myservice.net/MyService.jws"));

      

Hope it helps.

+1


a source


The following post has your answer, I will not plagiarize and copy it. You can deduce these arguments from the provided ant xml. You need to worry that Java has the certifications it needs. I believe the post speaks to the client code. The https url can also just be listed as https in the WSDL.



http://article.gmane.org/gmane.comp.apache.webservices.axis.user/58499

+1


a source







All Articles