I'm trying to write a simple java client to invoke a Webservice.
The provider of the WebService sent me the wsdl-document.
I'm new to wsdl and java in general and tried to manage this problem:
- create java-files XXXWebService, XXXWebServiceService, XXXWebServiceServiceLocator, XXXWebServiceSoapBindingStub using WSDL2Java-Tool
- write a simple client which is meant to invoke one of the methods defined in XXXWebservice.java and get a result (string)
- compile this client program
But when I run the generated client I get an UnknownHostException.![]()
Here is part of the client code I wrote:
I'm facing this problem for more than a week now. Read several tutorials and tested many examples. Everything works fine with the examples as long as a webService is located on localhost.Code:public class XXXWebTest { public static void main(String [] args) throws Exception { try { runIt(); } catch(Exception e) { e.printStackTrace(); } } private static void runIt() throws Exception { String ret = ""; XXXWebServiceService service = new XXXWebServiceServiceLocator(); XXXWebService port = service.getXXXWebService(); ret = (String) port.operation1(null,null,"String1","String2",null,null,null,true,new int[] {0}); System.out.println(ret); } }
Can someone please tell me what I'm doing wrong?
The url given in the wsdl-document is like "http://abcd:8081/axis/services/XXXWebService". Do I have to use a different one when I'm trying to access a WebService "outside of" (? poor English) localhost?


Reply With Quote


Bookmarks