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 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)

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

<?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 ...
Posted
Updated 14-Aug-14 3:02am
v2
Comments
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