This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Web Services and the fly likes Java client connect to soap server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Java client connect to soap server" Watch "Java client connect to soap server" New topic
Author

Java client connect to soap server

yingying qin
Greenhorn

Joined: Feb 07, 2007
Posts: 1
Hi,

I am new to this field. I used axis to generate client stub from wsdl. Now I created a java application and try to connect to the remote soap server. But never sucessful, the error is "Connection refused". Soap server uses SSL. Where goes wrong? Here is my client code. Your help is highly apprecdated.

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

import javax.xml.namespace.QName;

public class testClient
{
public static void main(String [] args) {
try {
String endpoint =
"https://192.168.32.23:8080";

Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("https://192.168.32.23:8080", "echoString") );
call.setUsername("Admin");
call.setPassword("pwd");


String ret = (String) call.invoke( new Object[] { "Hello!" } );

System.out.println("Sent 'Hello!', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42956
    
  73
Welcome to JavaRanch.

Does the call work over HTTP? Has the server certificate been imported top the clients keystore?

This introduction to SAAJ covers HTTPS at the very end, and may be a useful read.
[ February 10, 2007: Message edited by: Ulf Dittmer ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Java client connect to soap server
 
It's not a secret anymore!