Tutorial for Web Service

D

Dale

So, Mark.. interesting that the CPS would support trading eBooks in a
fashion most likely in violation of the copyright and license agreements,
but with your voluminous number of posts for trading ebooks, you should be
able to find a web services tutorial in one of them.

Dale
 
A

Andrew

Kondratyev Denis said:
I found this fustrating to find one that explains ALL the steps - I
don't have VisualStudio so I think there's a few added steps, but see:

http://www.asp.net/tutorials/quickstart.aspx
look under: Writing a Simple XML Web service
look at the MathService example this is the one I did.

You'll need to download the MS.Net SDK:
http://www.microsoft.com/downloads/...A6-3647-4070-9F41-A333C6B9181D&displaylang=en

Then:

1. Create webservice code in asmx file: - MathService.asmx
Get wsdl from asmx file by typing something like following in the
browser (point to wherever your .asmx file is located):
http://localhost/webservice/mathservice.asmx?wsdl

then cut and paste it or do a "save as" and save it in a .wsdl file -
all expect the first line:
<?xml version="1.0" encoding="utf-8" ?>
-

2. Use WSML file to compile source for dll - this will produce
MathService.VB
To consume this service, you need to use the Web Services Description
Language command-line tool (WSDL.exe) included in the SDK to create a
proxy class that is similar to the class defined in the .asmx file.
(It will contain only the WebMethod methods.) Then, you compile your
code with this proxy class included.
WSDL.exe accepts a variety of command-line options, however to create
a proxy only one option is required: the URI to the WSDL. In this
example, we are passing a few extra options that specify the preferred
language, namespace, and output location for the proxy. We are also
compiling against a previously saved WSDL file instead of the URI to
the service itself:

from cmd-prompt either( depends if you want it in CS or VB):
wsdl.exe /l:CS /n:MathService /out:MathService.cs MathService.wsdl

wsdl.exe /l:VB /n:MathService /out:MathService.vb MathService.wsdl

Once the proxy class exists, you can create objects based on it. Each
method call made with the object then goes out to the URI of the XML
Web service (usually as a SOAP request).

3. Compile MathService.VB to MathService.dll
Once the source file is created either CS or VB from the WSDL then you
can compile the dll - you need to reference all the system components
you are calling:

e.g:

from cmd-prompt:
vbc.exe /t:library /r:System.dll /r:System.Web.dll
/r:System.Web.Services.dll /r:System.Xml.dll /r:System.Data.dll
MathService.vb


4. Add Dll to bin directory - e.g. c:\inetpub\bin

5. Add Reference in web.config to namespace dll.

<assemblies>
<add assembly="MathService"/>
</assemblies>

6. Create ASPX file to call new namespace

<%@ Import Namespace="MathService" %>


The only trick I want to try, don't know if you know is to Strong name
the dll so I can put it in the GAC. Do you or anyone else out there
know how.

Hope this helps - it took me a while to figure out all these extra
steps. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top