Need to write web service

  • Thread starter Thread starter cj
  • Start date Start date
C

cj

I have used web services before WSDL files and such but never written
one. I need some basic starting info.

1. Can I write a web service in a windows app? or are all web services
asp web apps? In other words what type of program do I create?

2. Anyone point me to a tutorial that is very basic like write one that
takes two numbers and returns the sum?

3. Getting a bit deeper now, but I need to know if to use VB 2003 or
2005. One of our business partners who is going to have to use it
insists I have to write it in .net 1.1 and not 2.0. I really don't see
why he would care what it is written in. I would think using it over
the web would be generic.
 
I have used web services before WSDL files and such but never written
one. I need some basic starting info.

1. Can I write a web service in a windows app? or are all web services
asp web apps? In other words what type of program do I create?
Web Services are web applications but they can be used in any .NET
type (ASP, Windows, Mobile Device, etc.). When you have created your
webservice in your windows app when you go to add references you can
select Add Web Reference to add a webservice.

2. Anyone point me to a tutorial that is very basic like write one that
takes two numbers and returns the sum?
<WebMethod()>_
public function Sum (byval Num1 as integer, byval Num2 as integer) as
integer
return Num1 + Num2
end function

3. Getting a bit deeper now, but I need to know if to use VB 2003 or
2005. One of our business partners who is going to have to use it
insists I have to write it in .net 1.1 and not 2.0. I really don't see
why he would care what it is written in. I would think using it over
the web would be generic.

While I'm not an expert on webservices by any means at all since its
compiled into XML before sending the request it shouldn't matter.
When using web services you'll find that your more complex object
types are tougher to send (ArrayList, List(of), Hashtable). Meaning
that you'll generally instead of sending a List(of String) you'll send
an array of string (String()). Also any objects you plan on sending
must be <Serializable()> in order to pass through the webservice which
would also mean that any language should interpret it.

The only real excuse I can find for this is ignorance or they might
want to maintain the webservice at some point and don't want to mess
with 2.0.
 
cj said:
1. Can I write a web service in a windows app? or are all web services
asp web apps? In other words what type of program do I create?

You can host web services in a desktop application IF you're using .NET 3.0
and WCF.

..NET 2.0 you must use ASP.NET

3. Getting a bit deeper now, but I need to know if to use VB 2003 or
2005. One of our business partners who is going to have to use it
insists I have to write it in .net 1.1 and not 2.0. I really don't see
why he would care what it is written in. I would think using it over
the web would be generic.

Perhaps he's stuck on the .NET 1.1 platform. I would use .NET 2.0 or even
WCF (.NET 3.0).
 
How would I use .net 3.0 in a VB or ASP .Net 2005 program? I know it
uses 2.0 but I don't know how to change that. Just curious, I don't
really think I'll go to 3.0 yet.
 
Oh, also, what's WCF? Curiosity again.


Spam said:
You can host web services in a desktop application IF you're using .NET 3.0
and WCF.

.NET 2.0 you must use ASP.NET



Perhaps he's stuck on the .NET 1.1 platform. I would use .NET 2.0 or even
WCF (.NET 3.0).
 
I'm afraid I need to go more basic. When I start VB2005. I choose
create web site, Correct? I've done one web app so far back about 6
months ago and don't really remember that much. I've been doing windows
apps for years. I think for my web app I chose ASP.NET Web Site next
but perhaps it was Empty Web Site--not sure, but I see ASP.NET Web
Service which sounds more like what I want this time. Correct?
 
I'm afraid I need to go more basic. When I start VB2005. I choose
create web site, Correct? I've done one web app so far back about 6
months ago and don't really remember that much. I've been doing windows
apps for years. I think for my web app I chose ASP.NET Web Site next
but perhaps it was Empty Web Site--not sure, but I see ASP.NET Web
Service which sounds more like what I want this time. Correct?

File> New Website
ASP.Net Web Service - this will create your web service

The easiest way to deal with a webservice within another application
is to clump it all together into the same solution. So if your
Windows app already exists you can go to File > Add Project > Add New
Website and then choose ASP.Net Web Service. Once the web service is
created you should have a service.vb file in there somewhere, this is
where you'll code all your web methods. It will take a little bit to
get the hang of using it.
 
cj said:
How would I use .net 3.0 in a VB or ASP .Net 2005 program? I know it
uses 2.0 but I don't know how to change that. Just curious, I don't
really think I'll go to 3.0 yet.

You can download the add-on tools from Microsoft.
 
Oh, also, what's WCF? Curiosity again.


Windows Communications Framework. It unifies (replaces) .NET Remoting and
..NET Web services.

Microsoft is recommending new development be done in WCF while legacy code
be maintained with the current Web Service/Remoting framework.
 
oooooh, maybe I should insist this be done in WCF instead of a web
service. For once I could be on the cutting edge. Seems both ways
cause me to bleed anyway. :) I seriously doubt I could get my bosses to
go along with that idea though.
 
Spam Catcher
You can host web services in a desktop application IF you're using .NET
3.0
and WCF.

.NET 2.0 you must use ASP.NET


You can also do this with VB.Net < = 2005 in a windows application , you
just host a modified Casini dll ( source is provided by MS ) in a
application and ready you are
i have done this for my previous employer to create a platform independent
business logic control ( at start in VB .Net 2002 ) i just modified the
casini dll ( C# ) in such a way that it accepted remote connections in
short ( create a web service , start an application that inits the cassini
dll , point to the directory where the webservice is located and you are up
and running )

regards

Michel
 
Hi Cj,

For webservices, it is mainly used to let heterogenious clients(.net, java,
c++...) to consume it, therefore, it is recommended that we author WSDL so
as to make sure it is not platform dependent.

Of course, you do not have to use ASP.NET to build webservice, you can use
any components or services which can receive http/soap messages, process
them and return back http/SOAP messages. However, using Visual Studio's
webservice project type will make developing a webservice quite convenient.
Here are some tutorial on standard xml webservice and asp.net webservice:

#Web Services Tutorial
http://www.w3schools.com/webservices/default.asp

#Welcome to the ASP.NET Web Services QuickStart Tutorial
http://quickstarts.asp.net/QuickStartv20/webservices/

For WCF, it is the next generation communication technology of windows
platform, it can build webservice compatible services, but also provide
more other non-webserivce like remote services:

#Getting Started Tutorial
http://msdn2.microsoft.com/en-us/library/ms734712.aspx

#samples:
http://wcf.netfx3.com/files/default.aspx

Hope this also helps some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Date: Fri, 05 Oct 2007 19:07:29 -0400
From: cj <[email protected]>
 
Steven,

Why are you given this solution. I don't see any productivity in it while
there is already from VS 2002 a very nice WebService solution which takes
some hours. Going around this cost weeks. We don't have all that amount of
time as some Microsoft people think you have to realize solutions for simple
problems. (Lucky enough there also those who create real tools for the
business)

Ge has given in my idea the right answer. There was in my idea less to add
to his answers.

Cor
 
Thanks Cor,

Do you mean the "WCF" one? If so, I just provide it for the OP's reference
as he has mentioned some curiosity on this. Surely, I have nothing to do to
question the idea Ge showed.

Thanks for your care.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Cor Ligthert[MVP]" <[email protected]>
 
Spam Catcher



You can also do this with VB.Net < = 2005 in a windows application ,
you just host a modified Casini dll ( source is provided by MS ) in
a application and ready you are
i have done this for my previous employer to create a platform
independent business logic control ( at start in VB .Net 2002 ) i just
modified the casini dll ( C# ) in such a way that it accepted remote
connections in short ( create a web service , start an application
that inits the cassini dll , point to the directory where the
webservice is located and you are up and running )

True, but AFAIK, Casini was just a starter kit and not really
recommneded for production quality apps - especially ones that may be
potentially exposed to the Internet.

WCF on the otherhand provides a full framework for self-hosting.

Of course if you're stuck on .NET 1.1 or 2.0 ... Casini is your only
option, but if you have the ability to use 3.0, ServiceHost represents a
very attractive option.
 
Back
Top