Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to Develop Web Services Client.

 
Kel Walker
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help. I'm stressed and depressed.
I am trying to write a web service client using jax-rpc.
I downloaded Java Web Services Development Pack from Sun and Java Web Services Tutorial.
I am now trying to develop my first ever Web Service client.
The web service I wish to use is hosted by ServiceObjects. See http://www.serviceobjects.com/products/dots_email.asp .
I have run the WSDL document at http://ws.serviceobjects.net/ev/EmailValidate.asmx?WSDL through the xrpcc.bat tool.
I received 2 warnings :
warning: ignoring port "EmailValidateHttpGet": no SOAP address specified.
warning: ignoring port "EmailValidateHttpPost": no SOAP address specified.
I ignored these because I do not know what they mean. Ha ha.
I then wrote the client as so:
package com.walker.util.webservice;
import java.rmi.Remote;
import java.rmi.RemoteException;
import com.walker.util.webservice.emailvalidation.artifact.*; // Xrpcc generated artifacts.
public class EmailValidationClient {

public static void main(String[] args) {
java.lang.String email = "walkerk@farnell.com";
java.lang.String licenseKey = "0"; // Use a license key of 0 for testing.
try {
EmailValidateSoap stub = (new EmailValidate_Impl().getEmailValidateSoap() );
Email mail = stub.validateEmail(email, licenseKey);
System.out.println(mail.getDNSCheck() );
} catch (java.lang.Throwable trouble) {
System.out.println(trouble);
trouble.printStackTrace(System.out);
}
}
}
When I ran it I got :
java.rmi.RemoteException: HTTP transport error: java.net.ConnectException: Connection timed out: connect; nested exception is:
HTTP transport error: java.net.ConnectException: Connection timed out: connect
java.rmi.RemoteException: HTTP transport error: java.net.ConnectException: Connection timed out: connect; nested exception is:
HTTP transport error: java.net.ConnectException: Connection timed out: connect
at com.walker.util.webservice.emailvalidation.artifact.EmailValidateSoap_Stub.validateEmail(EmailValidateSoap_Stub.java:76)
at com.walker.util.webservice.EmailValidationClient.main(EmailValidationClient.java:46)
Caused by: HTTP transport error: java.net.ConnectException: Connection timed out: connect
at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTransport.java:189)
at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:73)
at com.walker.util.webservice.emailvalidation.artifact.EmailValidateSoap_Stub.validateEmail(EmailValidateSoap_Stub.java:60)
... 1 more
I am behind a firewall and use a proxy to connect to the internet. Not sure if that is the problem.
Please help, this is taking years off my life.
I appreciate any suggestions.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the service is overloaded and thats why your request timed out? Do you have independent confirmation that the service is still there and not overloaded?
Bill
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suspect that yes, the fact you have an HTTP proxy is the reason it's not working. Instead of using a service on the internet, why don't you do one of the examples provided with the Apache Axis toolkit first? Then you can start a web service on your own machine inside Tomcat and not have to worry about the proxies.
Kyle
 
Kel Walker
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
William and Kyle. Thank you for your advise.
It was the HTTP proxy which was giving me the headache.
For those who are interested, I have found a workaround. It is possible to set the proxy programmatically. Not sure this is the best way to go about things but it does work.
System.getProperties().put("proxySet","true");
System.getProperties().put("proxyHost","myProxy");
System.getProperties().put("proxyPort","myPort");
I also noticed that the xrpcc tool has the option -Xhttpproxy:host ort (specifies an HTTP proxy server). I have tried this but not sure exactly what it does (doesn't seem to do anything). Does anyone know what this option does.
p.s. William, just bought your exam cram book. Excellent. Good work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic