471,088 Members | 1,229 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,088 software developers and data experts.

parameters passed to web service(WS) appear to be nulls on WS side

Hello everybody.

I came across this question before but there was no suitable answer. Since I
have the same problem, I will repeat it here.

this is a simple web servive:

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Data;
using System.Data.SqlClient;

[WebService(Namespace = "http://tempns.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class SomeWebService : System.Web.Services.WebService
public const string sInsertQry =
@"insert into [Images] ([Image], [StringField], [BoolField])
values (@pImg, @pStr, @pBool)";

public const string sConnStr =
@"Data Source=MYCOMP\SQLEXPRESS;Initial Catalog=MYDB;Integrated

public SomeWebService() {

//Uncomment the following line if using designed components

public string Test() {
return "Test succeeded.";

public int PutImage(byte[] pImg, string pStr, bool pBool)

SqlConnection conn = new SqlConnection(sConnStr);

SqlCommand comm = new SqlCommand(sInsertQry, conn);

comm.Parameters.Add("@pImg", SqlDbType.VarBinary,
Int32.MaxValue).Value = pImg;
comm.Parameters.Add("@pStr", SqlDbType.VarChar,
Int32.MaxValue).Value = pStr;
comm.Parameters.Add("@pBool", SqlDbType.Bit).Value = pBool;

int n = comm.ExecuteNonQuery();
return n;

when I call PutImage method from a client app:

int n = ws.PutImage(bin_data, str_data, bool_option);

where bin_data and str_data are not null, they become nulls on web service

public int PutImage(byte[] pImg, string pStr, bool pBool)
at this point debbugger says: pImg = null, pStr = null.

Where could the problem lie?

Any help will be truly appreciated.

Jul 31 '06 #1
1 1090
Try it without your byte[] first parameter and see if it works.

Aug 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Marko | last post: by
reply views Thread by Fernando | last post: by
1 post views Thread by bambam | last post: by
10 posts views Thread by silverbob | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.