Discussions

XML & Web services: Help. Consuming a web serrvice

  1. Help. Consuming a web serrvice (3 messages)

    hello wanted to consume the following web service: http://www.dataaccess.com/webservicesserver/numberconversion.wso http://www.dataaccess.com/webservicesserver/numberconversion.wso?op=NumberToWords so i used WSDL2Java to create client stubs n then followed it with a client program public class XmethodsAccessor { public static void main(String[] args) throws Exception{ org.apache.axis2.databinding.types.UnsignedLong x = new org.apache.axis2.databinding.types.UnsignedLong(10000L); NumberConversionStub stub = new NumberConversionStub(); NumberConversionStub.NumberToWords request = new NumberConversionStub.NumberToWords(); request.setUbiNum(x); NumberToWordsResponse response = stub.NumberToWords(request); System.out.println("answer is : " + response.getNumberToWordsResult()); } } Upon running the program i get error Exception in thread "main" org.apache.axis2.AxisFault: Connection reset at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:221) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330) at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294) at com.dataaccess.www.webservicesserver.NumberConversionStub.NumberToWords(NumberConversionStub.java:162) at com.dataaccess.www.webservicesserver.XmethodsAccessor.main(XmethodsAccessor.java:19) Caused by: org.apache.axis2.AxisFault: Connection reset at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:314) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:201) ... 5 more Caused by: org.apache.axis2.AxisFault: Connection reset at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:179) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:73) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:305) ... 6 more Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:235) at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77) at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105) at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115) at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832) at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:558) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:176) ... 8 more Can any one please tell me what im doin wrong and why is it not working. Thanks PS: am using Eclipse 3.2/Axis2 Eclipse plugin .. there were no compilation errors
  2. First off, sorry for being slightly off-topic but I have no idea what your WSDL-based stub is doing. Secondly, if you realise that this web-service is actually restful you can just open http connection, make get request to appropriate URL, e.g. http://www.dataaccess.com/webservicesserver/numberconversion.wso/NumberToWords?ubiNum=1234 and get simple structure in return, like one thousand two hundred and thirty four If you do not want to poke in all that http connection plumbing and request/response processing then take a look at the client connectors from restlet framework.
  3. Hi, Since a wsdl can be consumed by any one by generating the classes needed my suggestion is to use My Eclipse to do that for u with it's web service client generator. It uses XFire which is really good. bye
  4. classes genation[ Go to top ]

    I am not sure how did you generated the classes for this web-service(WSDL). http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL its pretty much straight forword.