473,785 Members | 2,651 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(s tring 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(s tring name)
{
try
{
XmlDocument myServiceDoc = new XmlDocument();
System.Xml.XmlN ode neNode;
//Adding the resulting XML from WebMethod to a user created
XmlNode
neNode = myService1.GetD ataFromDB(name) ; //from above
....

It breaks on this last line when compiling saying:

"No overload for method "GetDataFro mDB' 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 1904
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.goo glegroups.com.. .
>I have this in my web service:

public XmlDocument GetDataFromDB(s tring 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(s tring name)
{
try
{
XmlDocument myServiceDoc = new XmlDocument();
System.Xml.XmlN ode neNode;
//Adding the resulting XML from WebMethod to a user created
XmlNode
neNode = myService1.GetD ataFromDB(name) ; //from above
...

It breaks on this last line when compiling saying:

"No overload for method "GetDataFro mDB' 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.nosp amwrote in message
news:OJ******** ******@TK2MSFTN GP04.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.saunder s at trizetto.comwro te in message
news:e7******** ******@TK2MSFTN GP06.phx.gbl...
"Scott M." <s-***@nospam.nosp amwrote in message
news:OJ******** ******@TK2MSFTN GP04.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.nosp amwrote in message
news:OJ******** ******@TK2MSFTN GP04.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...o r
something else

--
Regards,

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

<ne***********@ gmail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...
>
John Saunders wrote:
"Scott M." <s-***@nospam.nosp amwrote in message
news:OJ******** ******@TK2MSFTN GP04.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.nosp amwrote in message
news:OD******** ******@TK2MSFTN GP04.phx.gbl...
I'm sorry John, I don't know what you mean by "document style" web
service.
In the <wsdl:bindingse ction, 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.Serv ices;
using System.Web.Serv ices.Protocols;
using System.Runtime. InteropServices ;
using System.Data.Odb c;
using System.Configur ation;
using System.Diagnost ics;
using System.Data;
using System.Xml;

[WebService(Name space = "http://tempuri.org/")]
[WebServiceBindi ng(ConformsTo = WsiProfiles.Bas icProfile1_1)]
public class Service : System.Web.Serv ices.WebService
{
public Service () {

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

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

In my client .aspx:

protected void Button1_Click(o bject sender, EventArgs e)
{

DataBindFrmWS(T extBox1.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...o r
something else

--
Regards,

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

<ne***********@ gmail.comwrote in message
news:11******** **************@ i3g2000cwc.goog legroups.com...

John Saunders wrote:
"Scott M." <s-***@nospam.nosp amwrote in message
news:OJ******** ******@TK2MSFTN GP04.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***********@g mail.com wrote:
I have this in my web service:

public XmlDocument GetDataFromDB(s tring 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(s tring name)
{
try
{
XmlDocument myServiceDoc = new XmlDocument();
System.Xml.XmlN ode neNode;
//Adding the resulting XML from WebMethod to a user created
XmlNode
neNode = myService1.GetD ataFromDB(name) ; //from above
...

It breaks on this last line when compiling saying:

"No overload for method "GetDataFro mDB' 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="GetDataFr omDB">
<s:complexTyp e />
</s:element>

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

<s:element name="GetDataFr omDB">
<s:complexTyp e>
<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.saunder s at trizetto.comwro te in message
news:uB******** ******@TK2MSFTN GP03.phx.gbl...
"Scott M." <s-***@nospam.nosp amwrote in message
news:OD******** ******@TK2MSFTN GP04.phx.gbl...
>I'm sorry John, I don't know what you mean by "document style" web
service.

In the <wsdl:bindingse ction, 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

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

Similar topics

2
2372
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 a limit to length of the querystring. I've tried ASP-TEAR but I doubt it can work.
1
2207
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 id="ReviewedBy" style="WIDTH: 16px; HEIGHT: 20px" type="checkbox" name="ReviewedBy" value = 0> if the check box is unchecked it should pass value = 1. i.e. <INPUT id="ReviewedBy" style="WIDTH: 16px; HEIGHT: 20px"
2
2018
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 dynamically created table. I want to be able to pass a variable to the SQL command that I have created, but I don't know how to get the format right. Here is a snippet of my code I know that the format of my SQL command is totally wrong after...
4
3327
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 , ByVal lpszPassword As , _ ByVal dwLogonType As Integer, ByVal dwLogonProvider As Integer, _
2
6556
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 through (F11) into the web service for debugging. If I put in a ByRef parameter in the method of the web service, F11 (stepping into the method) does not work. It acts as though I hit the F10 key (Step Over).
0
1326
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 to put a Web Service as a bridge to unglue the 3-tier architecture ... so old: VB6 -> Array(variants) -> VB6
3
3303
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 to pass it in but I can't access the array that should be in there. If I set the signature as a byte array I get an error in webservice.htc. It seems to be trying to encode the variable to base 64 and it fails when trying to do a .length on it....
5
7823
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 a WebService is that essentially we are passing an address of an object which resides on the 'local machine' i.e. a local machine object address. Surely when the WebService method is called and run 'on the server', the reference type will be...
2
4498
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 seperate process. If my windows application starts running,only if it completes fully, then my windows services should continue its execution. My main process is Windows service.
0
9643
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...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9947
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
8968
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...
0
6737
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
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
2877
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.