HELP! HELP! Access problem to WebServices

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

  1. #1

    Default HELP! HELP! Access problem to WebServices

    I have written a generic proxy class for web services access
    This proxy class runs in the same server of WebService
    The class works fine if the browser runs in LAN, however it generates the following error if i access from remote machine

    -----------------------------------------------------------------------------------------------------
    Object reference not set to an instance of an object.

    Description
    An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details
    System.NullReferenceException: Object reference not set to an instance of an object

    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace
    [NullReferenceException: Object reference not set to an instance of an object.]
    Farm.Web.Controls.SoapMethod.ServerExecute(String SoapHost, String SoapServer, String SoapNameSpace, HttpRequest Request, HttpSessionState Session) in SoapMethod.vb:25
    Farm.Web.Controls.ComboBox.Render(HtmlTextWriter output) in ComboBox.vb:426
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
    System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +72
    System.Web.UI.Control.Render(HtmlTextWriter writer) +7
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
    System.Web.UI.Page.ProcessRequestMain() +192
    -----------------------------------------------------------------------------------------------------

    Some server code

    With HTTPRe

    .Proxy = GlobalProxySelection.GetEmptyWebProxy()

    .ContentType = "text/xml; charset=utf-8
    .Method = "POST
    .KeepAlive = Fals

    .Credentials = CredentialCache.DefaultCredential

    Dim i As Int3

    Dim strKey As Strin

    For i = 0 To Request.Headers.Count -
    strKey = Request.Headers.GetKey(i
    AddHeader(strKey, Request.Headers(strKey)) 'utility functio
    Nex

    .CookieContainer = New CookieContaine
    .CookieContainer.GetCookies(curUri) 'get the list of cookies to send to the destination site

    Dim app As New CookieCollectio

    For i = 0 To Request.Cookies.Count -
    app.Add(CastCookie(Request.Cookies.Item(i), Request.ServerVariables("HTTP_HOST"))
    Nex

    .CookieContainer.Add(app

    End Wit

    Dim strm As System.IO.StreamWrite
    Dim XML As New System.Xml.XmlDocumen
    Dim HttpRes As HttpWebRespons

    Tr
    'Write the Request Strea
    error here------> strm = New StreamWriter(HTTPReq.GetRequestStream(), Encoding.UTF8
    ........

    -----------------------------------------------------------------------------------------------------

    The server is protected by a linux firewall without proxy

    Thank you very much !


    Farm Guest

  2. Similar Questions and Discussions

    1. problem about webservices
      hello,kind people. there is one problem about WebServices from me,i thought over and over,but no result. it looks not the FMS case,but as you...
    2. Access Stubs Library from Webservices
      Hi I am using Microsoft Webservices MapPoint like this in MX7: <CFSCRIPT> // RenderServiceSoap myRenderServiceSoap =...
    3. Problem with access to WebServices
      I have written a generic proxy class for web services access This proxy class runs in the same server of WebService The class works fine if the...
    4. Access exception in Webservices
      hi, We are trying to enumerate sites on a MS Sharepoint portal server v2.0 through web services, using SPGlobalAdmin object of sharepoint. When...
    5. WebServices file access problem with UNC Name.
      Hi everybody, First of all, I know that the question has been asked many times, but I've never seen the answer till now : I have a WebService...
  3. #2

    Default Re: HELP! HELP! Access problem to WebServices

    Have you initilised HttpReq var before affecting its instances?

    Dim HTTPReq as New HttpWebRequest

    and then :
    > With HTTPReq
    >
    > .Proxy = GlobalProxySelection.GetEmptyWebProxy()
    >
    > .ContentType = "text/xml; charset=utf-8"
    > .Method = "POST"
    > .KeepAlive = False
    >
    > .Credentials = CredentialCache.DefaultCredentials
    >
    > Dim i As Int32
    >
    > Dim strKey As String
    >
    > For i = 0 To Request.Headers.Count - 1
    > strKey = Request.Headers.GetKey(i)
    > AddHeader(strKey, Request.Headers(strKey)) 'utility
    function
    > Next
    >
    > .CookieContainer = New CookieContainer
    > .CookieContainer.GetCookies(curUri) 'get the list of cookies
    to send to the destination site
    >
    > Dim app As New CookieCollection
    >
    > For i = 0 To Request.Cookies.Count - 1
    > app.Add(CastCookie(Request.Cookies.Item(i),
    Request.ServerVariables("HTTP_HOST")))
    > Next
    >
    > .CookieContainer.Add(app)
    >
    > End With
    >
    > Dim strm As System.IO.StreamWriter
    > Dim XML As New System.Xml.XmlDocument
    > Dim HttpRes As HttpWebResponse
    >
    > Try
    > 'Write the Request Stream
    > error here------> strm = New StreamWriter(HTTPReq.GetRequestStream(),
    Encoding.UTF8)
    > ........

    NM Guest

  4. #3

    Default Re: HELP! HELP! Access problem to WebServices

    Hi NM, I have read your answer, but it don't works

    I had initialized class with this method: (the second is another way
    --------------------------------------------------
    HTTPReq = CType(System.Net.WebRequest.Create(curUri), HttpWebRequest
    ' HTTPReq = CType(System.Net.WebRequest.CreateDefault(curUri), HttpWebRequest
    --------------------------------------------------

    As mentioned in HttpWebRequest remarks can't be utilized the constructor "New

    -------------------- From HttpWebRequest remarks ---------------------------------------------------------------------------
    >Do not use the HttpWebRequest constructor. Use the WebRequest.Create method to initialize new HttpWebRequest >instances. If the scheme for the URI is http:// or [url]https://,[/url] Create returns an HttpWebRequest instance
    -------------------------------------------------------------------------------------------------------------------------------------

    However Thank you very much !
    Farm 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