473,804 Members | 3,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent: Webservice method not recognizing parameters

Hey all,

I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice
method, I get the Object reference not set to an instance of the object
error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Leng th, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body >"
msg = msg & "<query xmlns='xxxxxx'> "
msg = msg & "<type>type 1</type>"
msg = msg & "<someValue s>"
msg = msg & "<string>value1 </string>"
msg = msg & "<string>value2 </string>"
msg = msg & "<string>value3 </string>"
msg = msg & "<string>value4 </string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"

-----------------------

So what exactly am I missing here? I've used this before and it worked fine.
So I'm completely in the dark as to why I get this error. I hope someone can
help me with this. Thanks :)


Nov 16 '05 #1
4 1606
Razzie,

I am curious, are you on the receiving end of this call? If so, then
why are you not using ASP.NET to expose the web service? This way, you
don't have to worry about the plumbing in between your method and it being
exposed to the outside world.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Razzie" <ra****@quickne t.nl> wrote in message
news:uH******** ******@TK2MSFTN GP11.phx.gbl...
Hey all,

I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice
method, I get the Object reference not set to an instance of the object
error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Leng th, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body >"
msg = msg & "<query xmlns='xxxxxx'> "
msg = msg & "<type>type 1</type>"
msg = msg & "<someValue s>"
msg = msg & "<string>value1 </string>"
msg = msg & "<string>value2 </string>"
msg = msg & "<string>value3 </string>"
msg = msg & "<string>value4 </string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"

-----------------------

So what exactly am I missing here? I've used this before and it worked fine. So I'm completely in the dark as to why I get this error. I hope someone can help me with this. Thanks :)


Nov 16 '05 #2
Hey Nicholas,

I'm not quite sure if I understand what you mean.
The webservice will be made public eventually for customers of the company.
We want to support SOAP as a way of communicating with it for them. So
that's why I am testing a soap script with it. Or is that not what you mean?

Thanks,

Razzie

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:eY******** *****@tk2msftng p13.phx.gbl...
Razzie,

I am curious, are you on the receiving end of this call? If so, then
why are you not using ASP.NET to expose the web service? This way, you
don't have to worry about the plumbing in between your method and it being
exposed to the outside world.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Razzie" <ra****@quickne t.nl> wrote in message
news:uH******** ******@TK2MSFTN GP11.phx.gbl...
Hey all,

I have a SOAP envelope with which I try to communicate to a webservice.
Everything is fine, but when I try to access a parameter of the webservice method, I get the Object reference not set to an instance of the object
error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Leng th, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body >"
msg = msg & "<query xmlns='xxxxxx'> "
msg = msg & "<type>type 1</type>"
msg = msg & "<someValue s>"
msg = msg & "<string>value1 </string>"
msg = msg & "<string>value2 </string>"
msg = msg & "<string>value3 </string>"
msg = msg & "<string>value4 </string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"

-----------------------

So what exactly am I missing here? I've used this before and it worked

fine.
So I'm completely in the dark as to why I get this error. I hope someone

can
help me with this. Thanks :)



Nov 16 '05 #3
Razzie,

Instead of writing your own request for the web service, why not just
create a test project and set a reference to the web service? This way, you
can test the web serivce, and not have to write all that plumbing code
yourself.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Razzie" <ra****@quickne t.nl> wrote in message
news:OI******** ******@tk2msftn gp13.phx.gbl...
Hey Nicholas,

I'm not quite sure if I understand what you mean.
The webservice will be made public eventually for customers of the company. We want to support SOAP as a way of communicating with it for them. So
that's why I am testing a soap script with it. Or is that not what you mean?
Thanks,

Razzie

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in message news:eY******** *****@tk2msftng p13.phx.gbl...
Razzie,

I am curious, are you on the receiving end of this call? If so, then
why are you not using ASP.NET to expose the web service? This way, you
don't have to worry about the plumbing in between your method and it being exposed to the outside world.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Razzie" <ra****@quickne t.nl> wrote in message
news:uH******** ******@TK2MSFTN GP11.phx.gbl...
Hey all,

I have a SOAP envelope with which I try to communicate to a webservice. Everything is fine, but when I try to access a parameter of the webservice method, I get the Object reference not set to an instance of the object error.

This is the method:

public string query(string type, string[] someValues)
{
// As soon as I try to access a parameter, eg. type.Length or
someValues.Leng th, I get the error
}

The soap body looks like this:

msg = msg & "<soap:Body >"
msg = msg & "<query xmlns='xxxxxx'> "
msg = msg & "<type>type 1</type>"
msg = msg & "<someValue s>"
msg = msg & "<string>value1 </string>"
msg = msg & "<string>value2 </string>"
msg = msg & "<string>value3 </string>"
msg = msg & "<string>value4 </string>"
msg = msg & "</someValues>"
msg = msg & "</query>"
msg = msg & "</soap:Body>"

-----------------------

So what exactly am I missing here? I've used this before and it worked

fine.
So I'm completely in the dark as to why I get this error. I hope

someone can
help me with this. Thanks :)




Nov 16 '05 #4
Ah yes. I did that too - that works. It's not the webservice what I'm think
is not working, but there is something wrong with the SOAP envelope. I just
can't figure out what it is though. If anyone still has a suggestion, I'd
appreciate it.

Thanks.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:O%******** *******@tk2msft ngp13.phx.gbl.. .
Razzie,

Instead of writing your own request for the web service, why not just
create a test project and set a reference to the web service? This way, you can test the web serivce, and not have to write all that plumbing code
yourself.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Razzie" <ra****@quickne t.nl> wrote in message
news:OI******** ******@tk2msftn gp13.phx.gbl...
Hey Nicholas,

I'm not quite sure if I understand what you mean.
The webservice will be made public eventually for customers of the

company.
We want to support SOAP as a way of communicating with it for them. So
that's why I am testing a soap script with it. Or is that not what you

mean?

Thanks,

Razzie

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote

in
message news:eY******** *****@tk2msftng p13.phx.gbl...
Razzie,

I am curious, are you on the receiving end of this call? If so, then why are you not using ASP.NET to expose the web service? This way, you don't have to worry about the plumbing in between your method and it being exposed to the outside world.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Razzie" <ra****@quickne t.nl> wrote in message
news:uH******** ******@TK2MSFTN GP11.phx.gbl...
> Hey all,
>
> I have a SOAP envelope with which I try to communicate to a webservice. > Everything is fine, but when I try to access a parameter of the

webservice
> method, I get the Object reference not set to an instance of the object > error.
>
> This is the method:
>
> public string query(string type, string[] someValues)
> {
> // As soon as I try to access a parameter, eg. type.Length or
> someValues.Leng th, I get the error
> }
>
> The soap body looks like this:
>
> msg = msg & "<soap:Body >"
> msg = msg & "<query xmlns='xxxxxx'> "
> msg = msg & "<type>type 1</type>"
> msg = msg & "<someValue s>"
> msg = msg & "<string>value1 </string>"
> msg = msg & "<string>value2 </string>"
> msg = msg & "<string>value3 </string>"
> msg = msg & "<string>value4 </string>"
> msg = msg & "</someValues>"
> msg = msg & "</query>"
> msg = msg & "</soap:Body>"
>
> -----------------------
>
> So what exactly am I missing here? I've used this before and it worked fine.
> So I'm completely in the dark as to why I get this error. I hope someone can
> help me with this. Thanks :)
>
>
>
>
>
>



Nov 16 '05 #5

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

Similar topics

4
9497
by: ramarnath | last post by:
Problem in sending datatime format to the .net webservice from php. description follows. I've created a .net webservice. ..Net Webservice: <WebMethod()> _ Public Function HelloDate(ByVal mydate As DateTime) As String
3
1419
by: sunnyz | last post by:
hi I wanted to know whether we can store something in Session objects in webservice.My windows application calls the webservice and i want the data to be stored in Session object so that each user can get its own data.Is this possible in webservice?coz i think it seems to lose the data each time i call the webservice Plz help me in this matter.Its urgent!!! *-----------------------*
1
1092
by: Vidya | last post by:
Class in the System.Collection.Specialized namespace like NameValueCollection that is defined as a parameter in one of the Webmethod causes a reflection error at runtime and gives InvalidOperationException and forces to implement Add method.My webservice class is not extending or trying to implement NameValueCollection or Hastable, but just I want to use it as one of the parameters in a webmethod.Is there a work around or how do I use a...
12
4138
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport) {
2
1958
by: farseer | last post by:
Hi, I have a few webservice questions i'd like to bounce of you... 1. Can a webservice contain a paramterized contructor ( can't the contructor take parameters )? 2. If two users make an initial call to a webservice, will diferent instances of the webservice object be instantiated on the server? (assuming the service is not designed to be a singleton)
3
1914
by: Pebble | last post by:
Hi folks, I have a WebService that simply acts as a thin wrapper to a .Net dll. Literally almost zero code in the WebService. Parameters passed to the WebService are simply used as parameters to methods on the dll, and all parameters to my web methods are strings. (The strings, just for further info, contain XML).
2
2581
by: rn5a | last post by:
I have created the following WebService named NConnect.asmx using which I want an ASPX page to first authenticate a user & after successful user validation, the ASPX page should display a few TextBoxes for users to enter some data in those TextBoxes which will finally be inserted in a SQL Server 2005 DB table: <%@ WebService Language="VB" Class="NConnect" %> Imports System Imports System.Data
7
13475
by: Sam Shrefler | last post by:
I'm working on creating a WebService / WebMethod to receive a record in real time from another system. The record contains about 20 fields. 10 of which aren't required. I was planning on just making a method with 20 parameters. But, I see there is no way to make an "optional" c# parameter. I was just wondering if anyone had an suggestions on how to implement this? The parameters are all different primitive types (int, string,...
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10329
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.