File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Web Services
Bookmark "Java client connect to soap server" Watch "Java client connect to soap server" New topic

Java client connect to soap server

yingying qin

Joined: Feb 07, 2007
Posts: 1

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 =

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

call.setTargetEndpointAddress( new );
call.setOperationName(new QName("", "echoString") );

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

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

Joined: Mar 22, 2005
Posts: 42965
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 ]
I agree. Here's the link:
subject: Java client connect to soap server
It's not a secret anymore!