Not Solving "System.Net.WebException"

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Not Solving "System.Net.WebException"

    Hi all,
    I am coding a web service for the company I am working for. It supposes to
    talk to a third-party web service, via WSDL. The web reference which I am
    using is:
    [url]http://xml.nig.ac.jp/wsdl/SRS.wsdl[/url]

    My code to test the web service is the following: (VS.net2003 C#)
    private string QuerySRS(string queryString)
    {

    SRS search = new SRS();

    string query = "[swissprotrelease-AllText:"+queryString+"]";
    string param = "-f ID";

    try
    {
    string results = search.searchSimple(query);
    ……………………………
    }
    catch
    {
    }
    }

    Trying to run this class, I got the error in below:

    System.Net.WebException: The underlying connection was closed: An
    unexpected error occurred on a receive. at
    System.Web.Services.Protocols.WebClientProtocol.Ge tWebResponse(WebRequest
    request) at
    System.Web.Services.Protocols.HttpWebClientProtoco l.GetWebResponse
    (WebRequest request) at
    System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
    methodName, Object[] parameters) at
    EBIResearch.jp.ac.nig.xml.SRS.searchSimple(String query)

    And,
    string results = search.searchSimple(query).ToString();

    is the line causing the problem, which means I got no response back from
    the remove web service.

    I have tried to add the following function in the Reference.cs, but still
    got the same problem.

    protected override System.Net.WebRequest GetWebRequest(Uri uri)
    {
    System.Net.HttpWebRequest webRequest =
    (System.Net.HttpWebRequest) base.GetWebRequest(uri);
    webRequest.KeepAlive = false;
    return webRequest;
    }

    I knew this is a common asked question, but any suggestions are welcome.

    Thanks
    Rui
    Rui via DotNetMonster.com Guest

  2. Similar Questions and Discussions

    1. CFINPUT type="radio" w/ "value" requires "label"
      On a Flash form, when you specify type='radio' and value='whatever', the value of the 'value' attribute will be displayed as a label if no 'label'...
    2. system("clear"); vs. system("cls");
      Using ActiveState Perl 5.8.0, system("clear"); raises an error on Win2k Pro: "clear is not recognized as an internal or external command, operable...
    3. Lsass.exe System error "object name not found". System keeps rebooting
      When trying to install the drivers for the PCI modem in my laptop, prompted for the driver CD. Installed the driver without any errors but asked...
    4. "Start" "Program" "Menu" list is empty
      For what ever reason my list of installed programs in my "Start" "Programs" menu is empty. Anyone know how to restore the list. Thanks for your...
    5. Since when UNIX is the "real" system that runs the "real" machines?
      *CROSS POSTED TO comp.unix.solaris In article <o3FNa.611731$vU3.43623@news1.central.cox.net>, David Janes <djanes@cox.net> wrote: Yes, Unix...
  3. #2

    Default Re: Not Solving "System.Net.WebException"

    I've test your Web service on framework 1.1.4322 with C#, console
    application. (without VS.NET)
    first, I made proxy class for your WSDL and compile. (wsdl.exe util in SDK
    dir)

    and code:

    SRS search = new SRS();
    string query = "[swissprotrelease-AllText:]";
    string results = search.searchSimple(query);
    Console.WriteLine(results);

    I can't see any error/Exception([results' is empty value).

    I think there're no prob in Web service.
    Check your vs.net application.


    ----------------------------
    GuyV

    "Rui via DotNetMonster.com" <forum@nospam.DotNetMonster.com> wrote in
    message news:e1f7371d039e4f999e588024efd0681e@DotNetMonste r.com...
    > Hi all,
    > I am coding a web service for the company I am working for. It supposes to
    > talk to a third-party web service, via WSDL. The web reference which I am
    > using is:
    > [url]http://xml.nig.ac.jp/wsdl/SRS.wsdl[/url]
    >
    > My code to test the web service is the following: (VS.net2003 C#)
    > private string QuerySRS(string queryString)
    > {
    >
    > SRS search = new SRS();
    >
    > string query = "[swissprotrelease-AllText:"+queryString+"]";
    > string param = "-f ID";
    >
    > try
    > {
    > string results = search.searchSimple(query);
    > …………………………?
    > }
    > catch
    > {
    > }
    > }
    >
    > Trying to run this class, I got the error in below:
    >
    > System.Net.WebException: The underlying connection was closed: An
    > unexpected error occurred on a receive. at
    > System.Web.Services.Protocols.WebClientProtocol.Ge tWebResponse(WebRequest
    > request) at
    > System.Web.Services.Protocols.HttpWebClientProtoco l.GetWebResponse
    > (WebRequest request) at
    > System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
    > methodName, Object[] parameters) at
    > EBIResearch.jp.ac.nig.xml.SRS.searchSimple(String query)
    >
    > And,
    > string results = search.searchSimple(query).ToString();
    >
    > is the line causing the problem, which means I got no response back from
    > the remove web service.
    >
    > I have tried to add the following function in the Reference.cs, but still
    > got the same problem.
    >
    > protected override System.Net.WebRequest GetWebRequest(Uri uri)
    > {
    > System.Net.HttpWebRequest webRequest =
    > (System.Net.HttpWebRequest) base.GetWebRequest(uri);
    > webRequest.KeepAlive = false;
    > return webRequest;
    > }
    >
    > I knew this is a common asked question, but any suggestions are welcome.
    >
    > Thanks
    > Rui

    GuyV Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139