hi, Seems to be a problem with your network settings. try giving the ip address instead of localhost
thanks, Amila. On Sun, Dec 27, 2009 at 3:28 AM, Govindan <kg...@hotmail.com> wrote: > > Hi, > I am new to webservice and was learning webservice. > I created a new webservice through apache axis2 in the following URL. > http://localhost:8080/axis2/services/HelloWorldService?wsdl > When i go to this URL i could see the correct wsdl file. > After this I used the following command to create the stubs > C:\webservice-resources\webservicetutorial\client>WSDL2Java.bat -uri > http://localhost:8080/axis2/services/HelloWorldService?wsdl -o client > It gave the followig error > xis2-1.5.1 > Using JAVA_HOME: C:\Program Files\Java\jdk1.5.0_16 > Retrieving document at > 'http://localhost:8080/axis2/services/HelloWorldService?w > sdl'. > Exception in thread "main" > org.apache.axis2.wsdl.codegen.CodeGenerationException > : Error parsing WSDL > at > org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat > ionEngine.java:156) > at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) > at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) > Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: > Unabl > e to resolve imported document at > 'http://localhost:8080/axis2/services/HelloWor > ldService?wsdl'<http://localhost:8080/axis2/services/HelloWor%0AldService?wsdl%27>.: > java.io.FileNotFoundException: This file was not found: > http:/ > /localhost:8080/axis2/services/HelloWorldService?wsdl > at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) > at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source) > at > org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile( > CodeGenerationEngine.java:288) > at > org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat > ionEngine.java:111) > ... 2 more > Caused by: java.io.FileNotFoundException: This file was not found: > http://localh > ost:8080/axis2/services/HelloWorldService?wsdl > at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown > Source) > > ... 6 more > > So i copied the WSDL from the browser and pasted in to the client folder > and > executed the above command as > C:\webservice-resources\webservicetutorial\client>WSDL2Java.bat -wsdl > C:\webserv > ice-resources\webservicetutorial\client\helloservice.wsdl -o client > > It run successfully and got the client stubs. > > Then I created another project to invoke the webservice . Used the > following > code > > public static void main(String[] args) { > // TODO Auto-generated method stub > try{ > HelloWorldServiceStub serviceStub = new > HelloWorldServiceStub(); > > HelloWorldServiceStub.Customer customerParameter = > new > HelloWorldServiceStub.Customer(); > customerParameter.setName("TestName"); > > HelloWorldServiceStub.GetCustomer cutomerRequest = > new > HelloWorldServiceStub.GetCustomer(); > cutomerRequest.setFindCustomer(customerParameter); > > HelloWorldServiceStub.GetCustomerResponse > customerResponse = > serviceStub.getCustomer(cutomerRequest); > > > System.out.println(customerResponse.get_return().getName()); > > System.out.println(customerResponse.get_return().getAddress()); > } > catch(Exception e){ > System.out.println("Fault is " + e.getMessage()); > e.printStackTrace(); > } > > } > > When I invoke this code I go the error > org.apache.axis2.AxisFault: Transport error: 404 Error: Not found > at > > org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310) > at > org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200) > at > org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76) > at > > org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400) > at > > org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225) > at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435) > at > > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402) > at > > org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) > at > org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) > at > > net.roseindia.HelloWorldServiceStub.getCustomer(HelloWorldServiceStub.java:488) > at net.client.TestClient.main(TestClient.java:21) > > Can anyone please help.Attaching the wsdl file for your reference > http://old.nabble.com/file/p26930176/helloservice.wsdl helloservice.wsdl > -- > View this message in context: > http://old.nabble.com/Problem-Invoking-the-Webservice-hosted-on-Local-Machine-tp26930176p26930176.html > Sent from the Axis - Dev mailing list archive at Nabble.com. > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/