• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Consume web service in spring

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to Java. I am developing one web application in which I want to consume web service. For this I have created on configuration xml with name "applicationContext.xml" in which is as below -



I have created one service interface with name "WebTestService.java" in which I have written



and in my controller I have written below -


LWhile running the code I am getting below error -

SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/mysite] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webTestService' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://www.webservicex.net/uszip.asmx?WSDL. It failed with:
Got Connection timed out: connect while opening stream from http://www.webservicex.net/uszip.asmx?WSDL.] with root cause
java.net.ConnectException: Connection timed out: connect


I did lots of googling but did not get any solution for it. Am I doing anything wrong here? Please suggest me the possible solutions.
Thanks in advance

Lalit
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess is that

<property name="wsdlDocumentUrl" value="http://www.webservicex.net/uszip.asmx?WSDL"/>

Is not the true location for your wsdl document. You need to set it to where your wsdl is.

Mark
 
Lalit Wan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Mark,

Thanks for reply.

Actually I am calling a remote web service which will return me Area information depending on zipcode which I am passing as a parameter.
You can check this link http://www.webservicex.net/uszip.asmx?WSDL in browser.

Thanks
Lalit
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, it is there. I wonder why when the request to get the wsdl is made that it can't connect?

Could there be firewall/accessibility issues of where you are running it to get to that site. I mean I guess that would only be a possible block out, as the WSDL location is wide open.

Mark
reply
    Bookmark Topic Watch Topic
  • New Topic