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()
InitializeComponent()
End Sub
Private components As System.ComponentModel.IContainer
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
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 = "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 ...