none
Invoke the Webservice WebException Protocol Error {7} has been occured RRS feed

  • Question


  • Hi,

    I  am trying to call  a web service  in windows mobile App 6.1
    when I try to access the web service through the  emulator i get the following error whenever a WebMethod is invoked

    InnerException = Nothing

    Message = "WebException"
    Response = {System.Net.HttpWebResponse}
    StackTrace = "   at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)  
                     at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)   
    Status = ProtocolError {7}

    In the IIS  in my Webservice  i give the authendication  method  enable anonymous access  is true.

    In WinForms and  ASP.NET  i call the service and tested  using  add webreference  its working fine,

    but i try to call the webservice  in  windows mobile app 6.1  using  add webreference   whenever invoke the web method  the above exception thrown

    Could anybody solve my problem  how to resolve this one.

    thanks and regards

    brite


    britekumar

    Wednesday, January 23, 2013 10:40 AM

Answers

  • Hi,

      i find the solution wrong emulator setting of access the network.

    Thanks and regards

    brite


    britekumar

    • Marked as answer by Britekumar Tuesday, October 22, 2013 1:32 AM
    Tuesday, October 22, 2013 1:32 AM
  • Dear sir,

    I am also getting the same error during the call web api post method "Protocalerror{7}". please suggest me what is my mistake.

    same request is working fine when use of fiddler 

    I have added below code on the web config file .

    <system.net>
     <settings>
     <httpWebRequest useUnsafeHeaderParsing="true" />
     </settings>
     </system.net>

    i am waiting positive respone from your side

    please find code below.

    Private Shared Sub CreateObject(ByVal PagerJsonCona As String)


            Dim URL As String = "http://localhost/TestingService/api/Values/Post"
            Dim q1 As Employee = New Employee() With {
                       .LookUpTemplate = "Jagdish",
                       .PageSize = 50,
                       .RowNo = 0,
                       .SearchKey = "",
                       .SearchText = "As",
                       .SortDataType = "String",
                       .SortDirection = "Jagdish",
                      .SortExpression = ""
                       }

            Dim request As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
            request.Method = "POST"
            request.ContentType = "application/json; charset=utf-8"
            'request.KeepAlive = True
            'request.ContentLength = DATA.Length

            Using webStream As Stream = request.GetRequestStream()

                Using requestWriter As StreamWriter = New StreamWriter(webStream, System.Text.Encoding.ASCII)
                    requestWriter.Write(q1)
                    requestWriter.Flush()
                    requestWriter.Close()
                End Using
            End Using

            Try
                Dim webResponse As WebResponse = request.GetResponse()

                Using webStream As Stream = If(webResponse.GetResponseStream(), Stream.Null)

                    Using responseReader As StreamReader = New StreamReader(webStream)
                        Dim response As String = responseReader.ReadToEnd()
                        Console.Out.WriteLine(response)
                    End Using
                End Using

            Catch e As Exception
                Console.Out.WriteLine("-----------------")
                Console.Out.WriteLine(e.Message)
            End Try



        End Sub


    • Edited by Jagdish Joshi Friday, June 28, 2019 9:57 AM
    • Marked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    • Unmarked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    • Marked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    Friday, June 28, 2019 9:38 AM

All replies

  • Did you find any solution for this? Thank you

    Monday, October 21, 2013 11:57 AM
  • Hi,

      i find the solution wrong emulator setting of access the network.

    Thanks and regards

    brite


    britekumar

    • Marked as answer by Britekumar Tuesday, October 22, 2013 1:32 AM
    Tuesday, October 22, 2013 1:32 AM
  • Dear sir,

    I am also getting the same error during the call web api post method "Protocalerror{7}". please suggest me what is my mistake.

    same request is working fine when use of fiddler 

    I have added below code on the web config file .

    <system.net>
     <settings>
     <httpWebRequest useUnsafeHeaderParsing="true" />
     </settings>
     </system.net>

    i am waiting positive respone from your side

    please find code below.

    Private Shared Sub CreateObject(ByVal PagerJsonCona As String)


            Dim URL As String = "http://localhost/TestingService/api/Values/Post"
            Dim q1 As Employee = New Employee() With {
                       .LookUpTemplate = "Jagdish",
                       .PageSize = 50,
                       .RowNo = 0,
                       .SearchKey = "",
                       .SearchText = "As",
                       .SortDataType = "String",
                       .SortDirection = "Jagdish",
                      .SortExpression = ""
                       }

            Dim request As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest)
            request.Method = "POST"
            request.ContentType = "application/json; charset=utf-8"
            'request.KeepAlive = True
            'request.ContentLength = DATA.Length

            Using webStream As Stream = request.GetRequestStream()

                Using requestWriter As StreamWriter = New StreamWriter(webStream, System.Text.Encoding.ASCII)
                    requestWriter.Write(q1)
                    requestWriter.Flush()
                    requestWriter.Close()
                End Using
            End Using

            Try
                Dim webResponse As WebResponse = request.GetResponse()

                Using webStream As Stream = If(webResponse.GetResponseStream(), Stream.Null)

                    Using responseReader As StreamReader = New StreamReader(webStream)
                        Dim response As String = responseReader.ReadToEnd()
                        Console.Out.WriteLine(response)
                    End Using
                End Using

            Catch e As Exception
                Console.Out.WriteLine("-----------------")
                Console.Out.WriteLine(e.Message)
            End Try



        End Sub


    • Edited by Jagdish Joshi Friday, June 28, 2019 9:57 AM
    • Marked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    • Unmarked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    • Marked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    Friday, June 28, 2019 9:38 AM
  • Dear Sir,

    Please ignore above error issue. i have fixed it.

    • Marked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    • Unmarked as answer by Britekumar Friday, August 2, 2019 7:16 AM
    Monday, July 1, 2019 4:36 AM