Click here to Skip to main content
15,892,059 members

Server was unable to process request. --> Object reference not set to an instance of an object.

B K Singh 2187 asked:

Open original thread
Dear All,

I have created a web service in Visual Studio 2003 using vb.net. After that I hosted in IIS 5.1 (Win XP SP-2). Url of web service is [^] . It is working fine on my computer.

This web service will be consumed by one of my colleague who is working for android application.
He can access this web service in brow-sure but while access in android application he is getting an error Server was unable to process request. --> Object reference not set to an instance of an object.

Bellow is code(vb.net framework 1.1)

VB
Imports System.Web.Services

Imports System.Reflection
Imports System.Configuration
Imports System.Web.Security
Imports IBM.Data.DB2

<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
Public Class CheckHotList
    Inherits System.Web.Services.WebService

#Region " Web Services Designer Generated Code "
     Public Sub New()
        MyBase.New()

        'This call is required by the Web Services Designer.
        InitializeComponent()

        'Add your own initialization code after the InitializeComponent() call

    End Sub

    'Required by the Web Services Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Web Services Designer
    'It can be modified using the Web Services Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container
    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        'CODEGEN: This procedure is required by the Web Services Designer
        'Do not modify it using the code editor.
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

#End Region

#Region "Web Method"
    <WebMethod()> Public Function CheckHotList(ByVal cardSrNo As String) As String
        'Dim result As String = "CIMS Reply from HMS server"
        Dim result As String = "Not Found"
        If Not cardSrNo.Trim = "" Then
            Dim connStr As String = ConfigurationSettings.AppSettings("myConnectionString")
            Dim conn As DB2Connection = New DB2Connection(connStr)
            conn.Open()
            Dim queryString As String = "Select * from CSDINVENTORY_LOG WHERE CARDSRNO_V25=  '" & cardSrNo.Trim & "'"
            Dim cmd As New DB2Command(queryString, conn)
            Dim dr As DB2DataReader = cmd.ExecuteReader()
            If (dr.HasRows) Then
                result = "Found"
            Else
                result = "Not Found"
            End If
            conn.Close()
        End If

        Return result
    End Function

#End Region

End Class


Here is my web.config

VB
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    
  <system.web>

    <compilation defaultLanguage="vb" debug="true" />

    <customErrors mode="RemoteOnly" />

    <authentication mode="Windows" /> 

    <authorization>
        <allow users="*" /> <!-- Allow all users -->
    </authorization>

    <trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />

    <sessionState 
            mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424"
	    sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
            cookieless="false" 
            timeout="20" 
    />

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
   
  </system.web>
  
  <appSettings>
	<add key="myConnectionString" value="Server=10.132.210.58:50000;Database=CIMS;UID=cims;PWD=cims;Connect Timeout=30"/>
  </appSettings>

</configuration>


Any help is highly appreciated.

@Neetin_1809: I an using vs2003 and I think it is not supporting JSON.

Any help plz ...
Tags: Visual Basic, Service, Web Development

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900