Error when consuming a web service


N

Nab

Using a Windows client to consume a web service throws this error:

System.Web.Services.Protocols.SoapException: Server was unable to process
request. ---> System.NullReferenceException.....etc

I'm using Visual Studio 2008 and my VB code for the WS (which is connected
to a SQL Server 2005 Express) is:

<WebMethod()> _
Public Sub GetFee(ByVal brokerName As String, ByRef brokerFee As Single)

Dim strSQL As String
strSQL = "SELECT @Fee = dbo_OnlineBrokers.TransactionFee FROM
dbo_OnlineBrokers WHERE dbo_OnlineBrokers.Name = @BName"
Dim cmd As New SqlCommand(strSQL, sqlConn)
cmd.Parameters.Add("@BName", SqlDbType.VarChar, 50)
cmd.Parameters("@BName").Direction = ParameterDirection.Input
cmd.Parameters("@BName").Value = brokerName
cmd.Parameters.Add("@Fee", SqlDbType.Real)
cmd.Parameters("@Fee").Direction = ParameterDirection.Output
If cmd.Connection.State <> ConnectionState.Open Then
cmd.Connection.Open()
End If
cmd.ExecuteNonQuery()
brokerFee = cmd.Parameters("@Fee").Value
cmd.Connection.Close()

Any hint as to how to resolve this issue? Is this a permission issue? If so,
how can I resolve it? Thanks for any suggestions.
 
Ad

Advertisements

J

John Saunders

Did you look up any of these exceptions in the MSDN Library to see what they
mean? Do that, then get back to us here.
 
Ad

Advertisements

N

Nab

I have fixed this problem. Sending an empty output paramter (argument) to a
called procedure generated that error. The problem was fixed when I turned
the procedure into a fucntion that receives just one argument. This problem
thought did not arise when I used VB2005!! I don't know why.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

web exception error 0

Top