473,509 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I pass a message or variable to a web service?

I have this in my web service:

public XmlDocument GetDataFromDB(string name)
{
....
do some stuff with name variable..on the database...
return the XmlDocument to my datagrid;
}

Now, in my client default.aspx I have a button that calls this
function:

public void DataBindFrmWS(string name)
{
try
{
XmlDocument myServiceDoc = new XmlDocument();
System.Xml.XmlNode neNode;
//Adding the resulting XML from WebMethod to a user created
XmlNode
neNode = myService1.GetDataFromDB(name); //from above
....

It breaks on this last line when compiling saying:

"No overload for method "GetDataFromDB' takes '1' arguments."

What does this mean?

I read that I should think not of this as passing variables as in
functions calls, but sending messages. I can't figure out how to send
this simple message. I only want to send a simple string with a last
name.

Thank you for any help.

Aug 31 '06 #1
14 1872
Well, I would disagree that you should think of web service calls as
"passing messages". You should, in fact, think of them as remote procedure
(function) calls. If the webmethod requires a parameter, then you must pass
one to the function.

Are you sure that your web service project has been re-built and than your
web service reference has been refreshed?
<ne***********@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>I have this in my web service:

public XmlDocument GetDataFromDB(string name)
{
...
do some stuff with name variable..on the database...
return the XmlDocument to my datagrid;
}

Now, in my client default.aspx I have a button that calls this
function:

public void DataBindFrmWS(string name)
{
try
{
XmlDocument myServiceDoc = new XmlDocument();
System.Xml.XmlNode neNode;
//Adding the resulting XML from WebMethod to a user created
XmlNode
neNode = myService1.GetDataFromDB(name); //from above
...

It breaks on this last line when compiling saying:

"No overload for method "GetDataFromDB' takes '1' arguments."

What does this mean?

I read that I should think not of this as passing variables as in
functions calls, but sending messages. I can't figure out how to send
this simple message. I only want to send a simple string with a last
name.

Thank you for any help.

Aug 31 '06 #2
"Scott M." <s-***@nospam.nospamwrote in message
news:OJ**************@TK2MSFTNGP04.phx.gbl...
Well, I would disagree that you should think of web service calls as
"passing messages". You should, in fact, think of them as remote
procedure (function) calls. If the webmethod requires a parameter, then
you must pass one to the function.
Scott, remember that there are two styles of web service: the RPC style, and
the Document style. Some like the latter, for generality (I do).

John
Sep 1 '06 #3
I'm sorry John, I don't know what you mean by "document style" web service.
"John Saunders" <john.saunders at trizetto.comwrote in message
news:e7**************@TK2MSFTNGP06.phx.gbl...
"Scott M." <s-***@nospam.nospamwrote in message
news:OJ**************@TK2MSFTNGP04.phx.gbl...
>Well, I would disagree that you should think of web service calls as
"passing messages". You should, in fact, think of them as remote
procedure (function) calls. If the webmethod requires a parameter, then
you must pass one to the function.

Scott, remember that there are two styles of web service: the RPC style,
and the Document style. Some like the latter, for generality (I do).

John


Sep 1 '06 #4

John Saunders wrote:
"Scott M." <s-***@nospam.nospamwrote in message
news:OJ**************@TK2MSFTNGP04.phx.gbl...
Well, I would disagree that you should think of web service calls as
"passing messages". You should, in fact, think of them as remote
procedure (function) calls. If the webmethod requires a parameter, then
you must pass one to the function.

Scott, remember that there are two styles of web service: the RPC style, and
the Document style. Some like the latter, for generality (I do).

John
Any idea on how to pass the variable to the service? Anyone? Thank
you again for any help.

Sep 1 '06 #5
Hi,

Can you pass the entire code, as from your code it doesn't seems you have
done anything wrong. It must be related to the settings or environment...or
something else

--
Regards,

Debasish Pramanik
Assetlink India.
Phone: +91 20 26119531 (226)

<ne***********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
>
John Saunders wrote:
"Scott M." <s-***@nospam.nospamwrote in message
news:OJ**************@TK2MSFTNGP04.phx.gbl...
Well, I would disagree that you should think of web service calls as
"passing messages". You should, in fact, think of them as remote
procedure (function) calls. If the webmethod requires a parameter,
then
you must pass one to the function.
Scott, remember that there are two styles of web service: the RPC style,
and
the Document style. Some like the latter, for generality (I do).

John

Any idea on how to pass the variable to the service? Anyone? Thank
you again for any help.

Sep 1 '06 #6
"Scott M." <s-***@nospam.nospamwrote in message
news:OD**************@TK2MSFTNGP04.phx.gbl...
I'm sorry John, I don't know what you mean by "document style" web
service.
In the <wsdl:bindingsection, if you use <soap:binding style="document"
/>, then you are effectively saying that you want the messages in this
binding to be considered, each, as a single XML document, as opposed to a
set of RPC-style parameters. The single document can represent multiple
parameters, and, depending on your platform, can be processed as multiple
parameters.This allows you to think in terms of sending and receiving entire
XML documents, possibly complicated ones, instead of restricting your
thinking to a flat set of procedure call parameters.

John
Sep 1 '06 #7
That's probably way too much code, but here is someone that had the
same problem:

http://groups.google.com/group/micro...c244dfa9208c7f

That is where I got part of my information from.

Here is the code up to that point in my .asmx:

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Runtime.InteropServices;
using System.Data.Odbc;
using System.Configuration;
using System.Diagnostics;
using System.Data;
using System.Xml;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {

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

[WebMethod]
public string HelloWorld() {
return "Hi";
}
[WebMethod]
public XmlDocument GetDataFromDB(string name)
{
string errorMessage = "";
XmlDocument myDatas = new XmlDocument();
....

In my client .aspx:

protected void Button1_Click(object sender, EventArgs e)
{

DataBindFrmWS(TextBox1.Text);

}

Thanks again for any help. Everything works, as long as I don't pass
it a variable.

This
Debasish Pramanik wrote:
Hi,

Can you pass the entire code, as from your code it doesn't seems you have
done anything wrong. It must be related to the settings or environment...or
something else

--
Regards,

Debasish Pramanik
Assetlink India.
Phone: +91 20 26119531 (226)

<ne***********@gmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...

John Saunders wrote:
"Scott M." <s-***@nospam.nospamwrote in message
news:OJ**************@TK2MSFTNGP04.phx.gbl...
Well, I would disagree that you should think of web service calls as
"passing messages". You should, in fact, think of them as remote
procedure (function) calls. If the webmethod requires a parameter,
then
you must pass one to the function.
>
Scott, remember that there are two styles of web service: the RPC style,
and
the Document style. Some like the latter, for generality (I do).
>
John
Any idea on how to pass the variable to the service? Anyone? Thank
you again for any help.
Sep 1 '06 #8

ne***********@gmail.com wrote:
I have this in my web service:

public XmlDocument GetDataFromDB(string name)
{
...
do some stuff with name variable..on the database...
return the XmlDocument to my datagrid;
}

Now, in my client default.aspx I have a button that calls this
function:

public void DataBindFrmWS(string name)
{
try
{
XmlDocument myServiceDoc = new XmlDocument();
System.Xml.XmlNode neNode;
//Adding the resulting XML from WebMethod to a user created
XmlNode
neNode = myService1.GetDataFromDB(name); //from above
...

It breaks on this last line when compiling saying:

"No overload for method "GetDataFromDB' takes '1' arguments."

What does this mean?

I read that I should think not of this as passing variables as in
functions calls, but sending messages. I can't figure out how to send
this simple message. I only want to send a simple string with a last
name.

Thank you for any help.
I finally got it working. I looked at the WSDL and found this:

<s:element name="GetDataFromDB">
<s:complexType />
</s:element>

So I went to Visual Studio and updated my web reference and it produced
this:

<s:element name="GetDataFromDB">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="name"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>

I guess I need understand how all the pieces work together better.
Thanks.

Sep 1 '06 #9
But you still, are, in fact, calling procedures and receiving back function
return values. The transport mechanism may be a complete XML document, but
what you are doing (why you are using the services) doesn't change
fundamentally.

"John Saunders" <john.saunders at trizetto.comwrote in message
news:uB**************@TK2MSFTNGP03.phx.gbl...
"Scott M." <s-***@nospam.nospamwrote in message
news:OD**************@TK2MSFTNGP04.phx.gbl...
>I'm sorry John, I don't know what you mean by "document style" web
service.

In the <wsdl:bindingsection, if you use <soap:binding style="document"
/>, then you are effectively saying that you want the messages in this
binding to be considered, each, as a single XML document, as opposed to a
set of RPC-style parameters. The single document can represent multiple
parameters, and, depending on your platform, can be processed as multiple
parameters.This allows you to think in terms of sending and receiving
entire XML documents, possibly complicated ones, instead of restricting
your thinking to a flat set of procedure call parameters.

John


Sep 1 '06 #10
If you look at my first response to your question and the last thing I
wrote, you'll see that I had already suggested that:

"Are you sure that your web service project has been re-built and than your
web service reference has been refreshed?"
<ne***********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
>
ne***********@gmail.com wrote:
>I have this in my web service:

public XmlDocument GetDataFromDB(string name)
{
...
do some stuff with name variable..on the database...
return the XmlDocument to my datagrid;
}

Now, in my client default.aspx I have a button that calls this
function:

public void DataBindFrmWS(string name)
{
try
{
XmlDocument myServiceDoc = new XmlDocument();
System.Xml.XmlNode neNode;
//Adding the resulting XML from WebMethod to a user created
XmlNode
neNode = myService1.GetDataFromDB(name); //from above
...

It breaks on this last line when compiling saying:

"No overload for method "GetDataFromDB' takes '1' arguments."

What does this mean?

I read that I should think not of this as passing variables as in
functions calls, but sending messages. I can't figure out how to send
this simple message. I only want to send a simple string with a last
name.

Thank you for any help.

I finally got it working. I looked at the WSDL and found this:

<s:element name="GetDataFromDB">
<s:complexType />
</s:element>

So I went to Visual Studio and updated my web reference and it produced
this:

<s:element name="GetDataFromDB">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="name"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>

I guess I need understand how all the pieces work together better.
Thanks.

Sep 1 '06 #11
"Scott M." <s-***@nospam.nospamwrote in message
news:e4**************@TK2MSFTNGP02.phx.gbl...
But you still, are, in fact, calling procedures and receiving back
function return values. The transport mechanism may be a complete XML
document, but what you are doing (why you are using the services) doesn't
change fundamentally.
How do you know that you're calling a procedure? You could, for instance, be
calling a BizTalk orchestration, or something equally bizarre.

John
Sep 1 '06 #12
Well, I would characterize any process that needs to be invoked a procedure.
"John Saunders" <john.saunders at trizetto.comwrote in message
news:Or**************@TK2MSFTNGP06.phx.gbl...
"Scott M." <s-***@nospam.nospamwrote in message
news:e4**************@TK2MSFTNGP02.phx.gbl...
>But you still, are, in fact, calling procedures and receiving back
function return values. The transport mechanism may be a complete XML
document, but what you are doing (why you are using the services) doesn't
change fundamentally.

How do you know that you're calling a procedure? You could, for instance,
be calling a BizTalk orchestration, or something equally bizarre.

John


Sep 1 '06 #13
Well, I would characterize any process that needs to be invoked a
procedure.
Sending a message is, then, also invoking a procedure.
Since it requires invoking a method to pust it to the wire and somebody on
the other side to grab it and process it -- of course, a method involed
Just my few thoughts
:-)
--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://articles.edujinionline.com/webservices
-------------------
Sep 7 '06 #14
Well no, not really. Sure, you need to invoke a method to post a message,
but that method works on a local object, web services invoke a remote
object's method.... A bit of a difference. I can send and receive XML
messages quite easily and never get near web services. In other words,
sending and receiving XML messages does not constitute web services.
"Gaurav Vaish (www.EduJiniOnline.com)"
<ga*****************@nospam.gmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
>Well, I would characterize any process that needs to be invoked a
procedure.

Sending a message is, then, also invoking a procedure.
Since it requires invoking a method to pust it to the wire and somebody on
the other side to grab it and process it -- of course, a method involed
Just my few thoughts
:-)
--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.com
http://articles.edujinionline.com/webservices
-------------------


Sep 7 '06 #15

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

Similar topics

2
2345
by: HelLind | last post by:
Hello everyone ! Is there any way to pass session variables between two websites ( diff domains) ? I've two websites and I want to integrate them. I used to use the querystring but there is...
1
2186
by: jaya | last post by:
Hi, I am using asp.net to pass parameters from .aspx page to my Microsoft reporting service. My .aspx page has checkbox. If it is checked it the chekbox should pass value =0 to my report <INPUT...
2
2010
by: Quarantine | last post by:
I am still a noob at the whole .NET, but I have a question and hope someone can help me out. I am taking user input, then want to query a database and return the results to either a datagrid, or a...
4
3310
by: James | last post by:
I succesfully pass username , domain and password via this function (taken from MSDN) Private Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUsername As , _ ByVal lpszDomain As...
2
6536
by: SQLScott | last post by:
I know that passing variables "ByRef" to a web web service is permitted, but what I am expreriencing is quite odd. If I take out my ByRef parameter from the method of my web service, i can step...
0
1305
by: rolandheller | last post by:
Hello! We're currently looking at migrating some of our code to .NET. Our old application written in VB6 has a DLL function that passes an Array of Variants to another function. We're planning...
3
3275
by: abarberis | last post by:
I'm very confused with this. I have a .NET web service that I am trying to pass a variant byte array to from the client side. If the signature of the web service is set to accept an Object it seems...
5
7802
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into...
2
4460
by: =?Utf-8?B?dmlzaHJ1dGg=?= | last post by:
Hi, I have 2 applications running, one Windows application project and the other windows services project. I want to call my Windows application in my windows services. I want to run them as...
0
7135
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
7342
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,...
1
7067
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...
1
5060
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...
0
4729
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...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
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 ...
0
440
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...

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.