473,396 Members | 1,933 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,396 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 1168
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, I´ve 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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.