Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   Error when consuming a web service (http://www.velocityreviews.com/forums/t787672-error-when-consuming-a-web-service.html)

Nab 09-07-2008 12:28 AM

Error when consuming a web service
 
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.


John Saunders 09-07-2008 02:41 AM

Re: Error when consuming a web service
 
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.

--
John Saunders | MVP - Connected System Developer


Nab 09-09-2008 11:39 PM

Re: Error when consuming a web service
 
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.
--
UK


"John Saunders" wrote:

> 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.
>
> --
> John Saunders | MVP - Connected System Developer
>
>



All times are GMT. The time now is 01:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57