I got a new task to call https .net webservice using Java client.
I could successfully able to call http .net webservice using "wsimport" command and write simple client code to access the service
But in case of https service I am not sure how to proceed after enough search on net.
Have so many doubts like
1. Is it mandatory to use web server like tomcat to call https webservice?
2. Can I import the utility files provided by the web service using wsimport command for https services?
3. I got .pfx certificate from client but not sure how to use it further to access https service
4. Is this version "JAX-WS RI 2.1.1 in JDK 6" suit to call https service
I really appreciate if you could answer these or in simple you just guide me to call https service using java client
Because I do not find any narrow down procedure to do so. And this thread can be followed by people like me.
I'm relatively new to web services, so don't quote me 100%, but I'll give my best shot at some of your issues.
1. Is it mandatory to use web server like tomcat to call https webservice? You need to use a web / application server of some sort to host web services (the service end), but you do not need one to call web services (the client end)
2. Can I import the utility files provided by the web service using wsimport command for https services? I'm not really certain of what you mean by this. All wsimport does is generate artifacts based on the provided WSDL. Any "utility" required should be either made into a public operation (method) on the WSDL, or used in the back-end of the service and not be required by the user.
3. I got .pfx certificate from client but not sure how to use it further to access https service To use a certificate, you're going to want to read about Java TrustStore and KeyStore. In a nutshell, the process entails using the keytool program (part of the JDK) to install a certificate into your TrustStore, then setting a bunch of TrustStore / KeyStore system properties within your application prior to making your web service call in order to use them.
4. Is this version "JAX-WS RI 2.1.1 in JDK 6" suit to call https service JAX-WS is the default (basic) web service implementation that comes with the JDK. There are several others out there, though it shouldn't matter to much which one you use. In my limited experience building clients I've used Axis 1 (now quite outdated) and, more recently, Metro.
1. A web service client can be an application or component running in a Java EE container, it can also be a standalone program running in a Java SE environment. Thus: Your web service client does not need to run in Tomcat, unless you have additional requirements that demands this.
2. Normally, the WSDL is accessed using normal HTTP protocol, while the web service is accessed HTTPS protocol, so you should be able to use wsimport.
If this is not the case then you may run into some problems, especially if the web service require mutual authentication.
3. Check this article: http://www.oracle.com/technology/pub/articles/dev2arch/2006/08/pfx-pem-certificate-formats.html 4. Yes.
posted 11 years ago
Thanks for your response..
But still I may not able to import the stubs provided by the https web service using wsimport command
I have installed the .pfm certificate on IE
And thorugh cmd mode when I try d:>wsimport https://.../service.asmx?WSDL
Result in error as
[ERROR] Failed to read the WSDL document: https://../service.asmx?WSDL, because 1) could not find the document; /2) the docum
ent could not be read; 3) the root element of the document is not <wsdl:definiti
Failed to parse the WSDL.
Is this what I am doing is right? Please correct me.
posted 11 years ago
It does not help you that you import the certificates in your browser when you later try to use wsimport to generate client artifacts. The wsimport command will not use the browser certificates. However, you can try to download the WSDL using your browser and then run wsimport on a local copy of the WSDL. Be sure to also download any XML schemas imported by the WSDL and modify the WSDL so it imports the local copies.