473,385 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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
Security=True;Pooling=False";

public SomeWebService() {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
public string Test() {
return "Test succeeded.";
}

[WebMethod]
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;

conn.Open();
int n = comm.ExecuteNonQuery();
conn.Close();
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
side:

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 1167
Try it without your byte[] first parameter and see if it works.

John
Aug 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Marko | last post by:
Hello! We are deweloping a web service wich does some processing depending on wich user called it. The problem is that the web service has to know wich user made a call to it. In IIS the...
10
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
2
by: hazz | last post by:
I don't get it. I have a VS2005 solution with a web service project and a windows project. The web service when tested on its own works fine. But when I add it as a web reference and refer to it my...
6
by: Jim S | last post by:
I have a .net framework 2.0 client (Pocket PC) and a .net 2.0 webservice that communicate on the same LAN. The Pocket PC has no problem consuming strings returned from the web service methoeds but...
0
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my...
0
by: Fernando | last post by:
Hi, Ive developed a WebService with .Net 2.0 to be consumed by a J2ME compliant handset, the problem is J2ME requires Web Service MUST be WS-I 1 (BP 1) compliant and Visual Studio 2005 only...
1
by: novicedlh | last post by:
Hello, I am creating a webservice that collects user information and stores it in a database. Since the user information contains sensitive data like SSN I am planning to use WS-Security (WSE...
1
by: bambam | last post by:
Junk E-Mail Options, Protection is set to High. All of my messages are coming through with a SCL of 9 (I checked), but none of them are going to the Junk E-Mail folder. I thought this was a...
10
by: silverbob | last post by:
I am replacing my Javascript-called files with SSI, and I'm getting an unexpected result with my page footer. I can really use some help with this. The footer contains a copyright (left...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.