web service client

import java.io.Serializable;

import java.net.URL;

import java.net.HttpURLConnection;

import java.net.URLConnection;

import javax.xml.rpc.ServiceFactory;

import javax.xml.rpc.Service;

import javax.xml.rpc.Call;

import javax.xml.namespace.QName;

import com.sun.xml.rpc.client.*;

import java.rmi.Remote;

public class Main {

public static void main(String[] args) {

try{

URL wsdlLocation = new URL("http://api.google.com/GoogleSearch.wsdl");

String targetNamespace = "urn:GoogleSearch";

QName serviceName = new QName(targetNamespace, "GoogleSearchService");

QName portName = new QName(targetNamespace, "GoogleSearchPort");

QName operationName = new QName("urn:GoogleSearch", "doGoogleSearch");

// create service

ServiceFactory factory = ServiceFactory.newInstance();

Service service = factory.createService(wsdlLocation, serviceName);

// create call

Call call = service.createCall(portName, operationName);

// invoke the remote web service

String result = (String) call.invoke(new Object[] {"chiccago"});

System.out.println(result);

}

catch(Exception e){

System.out.println(e);

}

}

}

I ran the above code, but i did not get any result from google. In fact, while it was debugging, at the "// invoke the remote web service" step, it did not get the result and it did move to the exception error step.

Would you please how i can solve this issue?

[1554 byte] By [warapa] at [2007-11-27 6:09:47]
# 1
r u sure u're connecting to a web service?URL wsdlLocation = new URL(" http://api.google.com/GoogleSearch.wsdl");
JWKC-5ivea at 2007-7-12 17:14:18 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...