473,396 Members | 1,893 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.

How to use Webservice?

nirmalsingh
218 100+
hai all,

i am new to web service(c#), i just tried helloworld, woked Perfectly!.
now i want to work in 3 different computers.
for eg: A, B, and C.

in computer A i have a simple demo.aspx page, i want to pass two parameters to web service in computer B (webTest.asmx) and in Computer C i have a sqlserver 2000 database in which i have to save the parameter passed.

Plz help me to implement this concept.

thanking you
-Nirmal.
Apr 24 '08 #1
3 1053
kenobewan
4,871 Expert 4TB
Congratulations on getting hello world to work! Now you have the task of creating another. What have tried so far? If you don't have a solution, or part thereof, you don't have a problem.

hai all,

i am new to web service(c#), i just tried helloworld, woked Perfectly!.
now i want to work in 3 different computers.
for eg: A, B, and C.

in computer A i have a simple demo.aspx page, i want to pass two parameters to web service in computer B (webTest.asmx) and in Computer C i have a sqlserver 2000 database in which i have to save the parameter passed.

Plz help me to implement this concept.

thanking you
-Nirmal.
Apr 24 '08 #2
nirmalsingh
218 100+
Thanx for ur reply,
my Code for webservice
[HTML]using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://nirmalsingh.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 RenderMessage(string firstName,string secondName) {
try
{
return "Welcome" + firstName + " " + secondName + " !";
}
catch (Exception ex)
{
return ex.Message;
}
}

}[/HTML]
client side code
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<form target="_blank" action='http://localhost:1274/WebSite1/Service.asmx/RenderMessage'
method="POST">
<table>
<tr>
<td>First Name:</td>
<td><input type="text"
size="30" name="firstName"></td>
</tr>
<tr>
<td></td>
<td align="right"></td>
</tr>
<tr>
<td>Second Name:</td>
<td><input type="text"
size="30" name="secondName"></td>
</tr>
<tr>
<td></td>
<td align="right"> <input type="submit"
value="Submit" class="button"></td>
</tr>
</table>
</form>
</body>
</html>
[/HTML]

and also i tried it in code behind as
[HTML]WebService curWS = new WebService();

Service a = new Service ();
Response.Write(a.RenderMessage('a','b'));[/HTML]
i have use both of this is in same machine, now i want to take it to remote. that is accesing webservice from another machine. is this right way i am moving? how should i proceed it to next level? plz guide me.
thanx in advance.
Apr 25 '08 #3
Frinavale
9,735 Expert Mod 8TB
Have you considered creating a Web Application (ASP.NET application) which consumes your WebService...

Your ASP.NET application would probably take care of the "Welcome SoAndSo..."

Your WebService would be responsible for taking care of your business logic and returning this to your ASP.NET application.

I don't see how you are going to make a simple HTML page consume a Web Service. That is the responsibility of the ASP.NET application...the ASP.NET application would then generate your HTML and serve it to the web browser.

-Frinny
Apr 25 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: DraguVaso | last post by:
Hi, I'm new to WebServices, and I'm doing some tests (with a small VB.NET-application) to know the performance-difference between a WebService and the 'normal'-way of getting data (just...
6
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a...
1
by: Nalaka | last post by:
Hi, I am testing with Visual studio 2005, web projects. Situation: I have one solution with two web projects, created as file system projects. (I am tesing using the built in server, not IIS)...
2
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2...
7
by: Alessandro Benedetti | last post by:
Hi. I'm calling two methods of a .NET Webservice (A) from another Webservice (B). The A Webservice is made like this: public class WSA: System.Web.Services.WebService { private int X = 0;
7
by: Nalaka | last post by:
Hi, I created a sinple web service that returns a dataSet. Then I created a client program that uses this web service (that returns the Dataset). My question is, how did the client figure...
5
by: AliR | last post by:
Hi Everyone, I have a Visual C++ MFC program, and I am trying to use a webservice written in C#. When I add the webservice to my project using Add Web Reference the sproxy compiler complains...
5
by: | last post by:
Hi, How long do webservice objects live for? In particular, if i have static variables filled with data from a static constructor in a webservice, how long will that data persist? thxs
0
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi All, Problem in deploying my WebService developed using Asp.net WebServices 2005. I have designed simple WebService using Asp.net Webservices 2.0 , The webservice look this , using System;...
4
by: =?Utf-8?B?QmlsbEF0V29yaw==?= | last post by:
Hi, We recently converted a 1.1 project to 2.0 and this included a webservice which accepted XML for one of the parameters. Since converting to 2.0 I am getting the following message: --- A...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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...
0
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,...
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
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
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...
0
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,...

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.