[Mono-devel-list] ASP.NET Web Services support in Mono
Lluis Sanchez
lluis at ideary.com
Wed Jul 9 15:40:33 EDT 2003
Hi all!
Mono now supports server side ASP.NET web services. Some of the features we
support are:
* asmx files
* Method calls with complex parameters (whatever XmlSerializer can currently
serialize, which is a quite a lot).
* ref and out parameters
* Soap headers (In, Out and InOut)
* Soap extensions, both global (configured in web.config) and particular to
methods (configured using attributes)
We don't support yet:
* Asynchronous calls
* Web service documentation page (will be based on Erik's WSDL work)
There are also some nice samples in the XSP test directory (see the
explanation below)
Enjoy!
Lluis.
P.S. This is a copy of the README file in xsp/test.
About Web Services samples
--------------------------
Summary of files:
TestService.asmx: A simple web service
ConverterService.asmx: Currency converter web service
DumpExtension.cs: Soap extension that dumps all requests to a file.
EncryptExtension.cs: Soap extension that encrypts all requests.
TraceExtension.cs: Soap extension that logs the soap messages.
ServiceClient.cs: Simple web service client
Reference.cs: Web service client proxies.
ServiceClient.exe.config: Configuration file for ServiceClient.
There are two sample web services, implemented in TestService.asmx and
ConverterService.asmx.
TestService.asmx is a very simple web services with two methods. It shows
how
simple is to implement web services using ASP.NET.
The ConverterService implements a simple currency converter. With it you can
make conversions between a limited set of currencies, get a list of currency
rates, get the rate of a given currency or change the rate of a currency.
This sample shows most of the functionality you can get from ASP.NET
web services.
The service uses Soap headers to keep information about the currently logged
user. Before calling any other method, the client must call Login(). This
method generates an Out header with user information that is sent and stored
in the client. All subsequent calls will include that header so the server
will be able to validate the user.
This WS also makes extensive use of Soap extensions. There are three of
them:
- DumpExtension (DumpExtension.cs): This is a global extension that must be
configured in the web.config file. It dumps all requests and responses to
the file dump.log. It will only dump the calls of classes that have the
[Dump] attribute.
- EncryptExtension (EncryptExtension.cs): This extension uses the Rijndael
algorithm to encrypt all information exchanged between the server and the
client. For it to work, the web service class must have the [Encrypt]
attribute. The client proxy class used to connect to the service must also
have that attribute (see Reference.cs). This is also a global extension
that must be configured in web.config.
- TraceExtension (TraceExtension.cs): This extensions logs the soap requests
and responses to the file trace.log. The difference between TraceExtension
and DumpExtension is that TraceExtension logs requests after it's been
deserialized, so it can log the method name and parameter types and values.
On the other hand DumpExtension just does a raw dump of the received stream.
Another difference is that TraceExtension can be applied to individual
methods, using the attribute [TraceExtension].
In the client side, the client proxies are implemented in Reference.cs.
There is a sample client implemented in ServiceClient.cs that makes some
calls
to the services.
How to test
-----------
Build XSP and start the server as usual.
cd to xsp/test and run ServiceClient.exe.
After execution, you should see the files trace.log and dump.log in
xsp/server/test with the traces of the requests. You can try to add and
remove
the encrypt extension from web.config and ServiceClient.exe.config and see
in dump.log the information being sent in each case.
More information about the Mono-devel-list
mailing list