• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to create java client to access web services running on https/ssl

 
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could anyone tell me how to create web service client in netbeans5.5 with tomcat 5.5 . I've created web services which is running on https with configured tomcat's server.xml (keystoreFile and keystorePass). Now, i'm not able to create web service client to access those services.
Do i need to do anything more. Please help me out in this regard. I'm able to create normal (not https) web service and it's client for full end to end communication.
thanks in advance....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Now, i'm not able to create web service client to access those services.


What does this mean? What did you do, and what did or did not work according to your expectations? TellTheDetails
 
Navneet Singh
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i've the following url:
https://localhost:8443/MySoapApplication/getSubResult?wsdl
which consist of following wsdl file which is creted through netbeans 5.5 and using tomcat 5.5....

<?xml version="1.0" encoding="UTF-8" ?>
- <definitions xmlns:tns="http://me.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://me.org/" name="getSubResultService">
- <types>
- <xsd:schema>
<xsd:import namespace="http://me.org/" schemaLocation="https://localhost:8443/MySoapApplication/getSubResult?xsd=1" />
</xsd:schema>
</types>
- <message name="sub">
<part element="tns:sub" name="parameters" />
</message>
- <message name="subResponse">
<part element="tns:subResponse" name="parameters" />
</message>
- <portType name="getSubResult">
- <operation name="sub">
<input message="tns:sub" />
<output message="tns:subResponse" />
</operation>
</portType>
- <binding type="tns:getSubResult" name="getSubResultPortBinding">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="sub">
<soap peration soapAction="" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="getSubResultService">
- <port binding="tns:getSubResultPortBinding" name="getSubResultPort">
<soap:address location="https://localhost:8443/MySoapApplication/getSubResult" />
</port>
</service>
</definitions>



So i need to access the service getSubResult . i'm not able to even connect to it. Could anyone tell or provide me some solution to access the web services running to https.....
i've created the keystore and put it into the catalina home.
please help me out in this regard......
any useful link will also helpful for me....

in advance thanks a lot....
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i'm not able to even connect to it.


Again, what does this mean? How are you trying to connect? How does it not work?
 
Navneet Singh
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that's what i want to know. i want to access those services, how could i achieve this. I tried jax-ws which netbeans does but not able to connect it. My java client is as follows:


System.setProperty("javax.net.ssl.trustStore","d:/keystore/cert.cer");
System.setProperty("javax.net.ssl.trustStorePassword","changeit");
System.setProperty("javax.net.ssl.trustStoreType", "JKS");

try { // Call Web Service Operation

System.setProperty( "javax.net.ssl.keyStore",endpoint ) ;
System.setProperty( "javax.net.ssl.keyStorePassword","changeit" ) ;
System.setProperty("javax.net.ssl.keyStoreType", "JKS");

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
org.me.client.GetSubResultService service = new org.me.client.GetSubResultService();
org.me.client.GetSubResult port2 = service.getGetSubResultPort();
// TODO initialize WS operation arguments here
int i = 30;
int j = 10;
// TODO process result here
int result = port2.sub(i, j);
System.out.println("Result = "+result);
} catch (Exception ex) {
System.out.println("Exception occurs in web services : "+ex);
}

=====================
Now i'm getting this exception as:
Exception occurs in web services : javax.xml.ws.WebServiceException: java.net.SocketException: Default SSL context init failed: null

============================
how should i access the web services running on https from java client....
please help me out....
 
Navneet Singh
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone help me out please. I'm new to web services. I've created through netbeans and using tomcat 5.5, it works fine. But when i'm introducing https, so my web service run on https. But i'm not able to call the services which i've created through netbeans using https.
Is it possible to do that or should i go for other application server or something else i need to look into.
Please help me out and awaiting for your response.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This introduction to SAAJ includes a good step-by-step guide on how to set up Tomcat to use SSL, and how to create a WS client that accesses a WS over HTTPS.
 
Navneet Singh
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a lot for possitive response.
But i'm using jax-ws. I've build my web service with using netbeans' jax-ws. So for my client side also i'm using jaxws. Now, by using jax-ws my web service running on https by configuring my keystore in tomcat's server.xml. Now, from java side i think i'm missing something. Could you please help me out. I've create my simple core java program using jax-ws utility by netbeans.
Could you please tell where do i set my kestore and truststore file and password in the netbeans so that it can access the certificates. Now, i'm getting as exception:

javax.xml.ws.WebServiceException: java.io.IOException: HTTPS hostname wrong: should be <localhost>


 
Navneet Singh
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone help me providing even the tutorial for this. I'm able to run my web services on HTTPS using ssl(making keystore using keytool and providing the same for tomcat's server.xml). But i'm not able to access it's services. I'm using netbeans 5.5,JAX-WS2.0,Tomcat 5.5. I've even provided the the certificate file to cacerts config. But still i'm getting the same exception.

in advance thanks a lot.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any news from this post? I also have the same problem. Thanks in advance!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am also facing the same problem . I tried it with glasfish server it works . So if have any answer for using tomcat please post it

thanks .
 
Christopher Baldoza
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got this exception - java.io.IOException: HTTPS hostname wrong: should be <localhost>.

My solution is I changed my self-signed certificate and make the CN=localhost. I think this is ok for now because I only use this for testing.

I hope there will be a better solution and clarification about this. Thanks!
 
Navneet Singh
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But what happens when i create self-signed certificate with CN=192.234.3.46 , i want to check this. I'm not able to connect it to the web service and getting an exception :
avax.xml.ws.WebServiceException: java.io.IOException: HTTPS hostname wrong: should be <192.234.3.46>.
But when i create it for localhost it works fine.
I'm using netbeans+jax-ws+tomcat. Could anyone tell me, where to configure in netbeans or in java client to be access the created HOSTNAME. I'm totally confused with this.

any suggestion/answer is welcome.
thanks in advance
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
etc/hosts did the trick!
 
reply
    Bookmark Topic Watch Topic
  • New Topic