Click here to Skip to main content
14,383,720 members
Rate this:
Please Sign up or sign in to vote.
See more:
Dear All,

I have created a web service in Visual Studio 2003 using 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( framework 1.1)

Imports System.Web.Services

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

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

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

        'This call is required by the Web Services Designer.

        '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
            End If
        End If
    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)
            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"
                result = "Not Found"
            End If
        End If

        Return result
    End Function

#End Region

End Class

Here is my web.config

<?xml version="1.0" encoding="utf-8" ?>

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

    <customErrors mode="RemoteOnly" />

    <authentication mode="Windows" /> 

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

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

	    sqlConnectionString="data source=;Trusted_Connection=yes"

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
	<add key="myConnectionString" value="Server=;Database=CIMS;UID=cims;PWD=cims;Connect Timeout=30"/>


Any help is highly appreciated.

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

Any help plz ...
Updated 14-Aug-14 3:02am
Neetin_1809 14-Aug-14 7:24am
Hello ,
as far as i know .You need to convert it into some format . Json Format is widely used .You need to convert it into json format.
Other Format available is XML.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Check that cardSrNo is not null before you call cardSrNo.Trim

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100