Web service newbie question

Last post 05-09-2008 8:54 AM by Dangermouse. 9 replies.

Sort Posts:

  • Web service newbie question

    05-07-2008, 12:03 PM

    Hi, I don't have much experience of web services, and I am picking up someone else's code. There is a problem connecting to a server via a service.

    The code is as follows:

    String response = WebServiceEtc.SomeMethod(param1, param2, etc);

    It falls over when it tries to populate the response string, saying it didn't get a response, etc.

    Is there a way I can intercept the xml file I am sending it? It is talking to a .wsdl file. I have made sure the URL, and parameter list is ok and it is. We have made changes to our server recently so this is probably what is causing it, but I would like to intercept what I am sending if possible.

    Thanks

    Dan

  • Re: Web service newbie question

    05-07-2008, 12:10 PM
    • Loading...
    • SGWellens
    • Joined on 01-02-2007, 9:27 PM
    • MN, USA
    • Posts 2,297
    • Moderator
      TrustedFriends-MVPs

    Can you access the Web Service through a browser?  If you can do this, you know the server and service are OK and you can start looking at your code.

    BTW: In the future, please include the exact error message you are receiving.

    Steve Wellens
  • Re: Web service newbie question

    05-08-2008, 6:07 AM

    Hi Steve,

    I can't see the methods, etc, from the page. When I go to the URL, I only see a message: "Hi, this is an AXIS service".

    The error message I recieve is:

    "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond".

    The stack trace is:

    [WebException: Unable to connect to remote server]

    PageName.PageLoad() etc

    PageName.Refund_Transaction(param1, param2)

    Secpay.Secpayservice.refundCard(etc)

    System.Web.Services.Protocols.SoeapHttpClientProtocol.Invoke(etc)

    System.Net.HttpWebRequest.GetRequestStream()

    SocketException[etc]...

    System.Net.ServicePoint.ConnectSocketInternal(etc)

    System.Net.Sockets.SocketInternalConnect(etc)

    System.Net.Sockets.Socket.DoConnect(etc)

    Hope this helps, like I say I'm a bit of a novice at web services so I'm not really sure how / if I can catch what I am sending.

    Thanks, Dan

  • Re: Web service newbie question

    05-08-2008, 6:43 AM

    I have also tried changing the URL so I can read the XML file expected, etc, from the page I am contacting.

    This gives the same error though.

  • Re: Web service newbie question

    05-08-2008, 8:51 AM
    Answer
    • Loading...
    • SGWellens
    • Joined on 01-02-2007, 9:27 PM
    • MN, USA
    • Posts 2,297
    • Moderator
      TrustedFriends-MVPs

    Dangermouse:
    When I go to the URL, I only see a message: "Hi, this is an AXIS service".

    Are  you accessing the asmx file?  It should look like one of these:

    http://www.webservicex.net/globalweather.asmx

    http://www.webservicex.net/stockquote.asmx

    http://services.aonaware.com/DictService/DictService.asmx

     

    Steve Wellens
  • Re: Web service newbie question

    05-08-2008, 8:58 AM

    Hi Steve,

    Thanks for the reply. Its just going to a folder /SecpayService.

    This seems to handle the file. I can see the XML (?wsdl file) if I append ?wsdl to the end of the URL.

    This is similar to the file / page displayed when I click on "service description" on the global weather link you supplied.

    Hope thats helpful.

  • Re: Web service newbie question

    05-08-2008, 9:38 AM
    • Loading...
    • SGWellens
    • Joined on 01-02-2007, 9:27 PM
    • MN, USA
    • Posts 2,297
    • Moderator
      TrustedFriends-MVPs

    Have you tried deleting and re-adding the Web Reference?

    What happens is that a block of code, the proxy, is generated that does all the heavy lifting for us.

    The generated proxy and web service must match.  Your code talks to the proxy, and the proxy talks to the web service.

    Steve Wellens
  • Re: Web service newbie question

    05-08-2008, 10:20 AM

    Hi Steve,

    I have tried deleting and re-adding the web reference, but no difference unfortunately.

    Is it possible to "see" the xml file I am sending? I know the parameters passed are fine. The company who owns the server and written the service haven't been too helpful, they've just asked for the XML file we try to send.

    Thanks again, Dan

  • Re: Web service newbie question

    05-08-2008, 10:54 AM
    • Loading...
    • SGWellens
    • Joined on 01-02-2007, 9:27 PM
    • MN, USA
    • Posts 2,297
    • Moderator
      TrustedFriends-MVPs

    Dangermouse:
    Is it possible to "see" the xml file I am sending?

    I don't know.

    In the stack trace, there are these lines:

        SocketException[etc]...
        System.Net.ServicePoint.ConnectSocketInternal(etc)
        System.Net.Sockets.SocketInternalConnect(etc) 
        System.Net.Sockets.Socket.DoConnect(etc)

    That seems to indicate the problem is at a lower "level" than the XML.

    Do you have a firewall?  Is it configure to accept communication from the Web Service Server?

     

    Steve Wellens
  • Re: Web service newbie question

    05-09-2008, 8:54 AM

    Hi Steve, I'm off sick today so can't fully answer your questions. But I think you may be correct in assuming its more of a server / network issue. We have recently had problems connecting to some secure sites. We use Novell / Groupwise and I think the filters have been changed which may prevent contact to the service etc.

    I will look into it next week.

    Thanks very much for your help.

    Dan

Page 1 of 1 (10 items)