Tex-Mex.... mmmmm mmmm.
We at Improving are pleased to introduce TexMex, a spicy ws-metadataexchange implementation. As I have mentioned before, it is implemented as an ASP.NET soap extension. The solution contains three projects:
TexMex - this is the core soap extension.
TexMex.Service - a test asp.net web service project.
TexMex.Test - an NUnit (2.2) test project.
There isn't a lot of code, and that is indicative of two things:
- I wanted to have a really simple solution.
- I haven't really put much time into it yet :)
In the implementation, TexMex avoids DOM-style parsing in favor of XPathNavigator+XmlWriter. It does support either Soap 1.1 or Soap 1.2, which is to say if you send 1.1 you will receive 1.1, and likewise for 1.2. It assumes that the metadata is stored in files relative to the service itself, that they do not contain an xml declaration, and that they are well-formed and valid for the given dialect. One way to put it, I suppose, is that TexMex treats dialects as completely opaque arrays of [UTF-8] chars.
TexMex does *not* respect all of the WS-Addressing rules yet, in particular, it does not properly deal with ReferenceProperties and ReferenceParameters. I don't think I am handling the replyto exactly correctly, either, but that should be fairly trivial to fix. I hope to get time to remedy the Reference* soon. If someone else is interested in taking it on and submitting changes, let me know. TexMex currently only supports inlined metadata in responses. I think I will amend the solution shortly to support the other two options, url and epr, via additional attributes, e.g. MetadataLocation (...) and MetadataReference(...). Finally, I would like to try out some very low level (byte-array-style) caching just for grins, because most of the messaging is static content.
To use TexMex, you must declare the soap extension in your web.config:
<configuration>
<system.web>
<webServices>
<soapExtensionTypes>
<add type="TexMex.MetadataExchangeExtension, TexMex" priority="1" group="0" />
</soapExtensionTypes>
</webServices>
...
And then add MetadataAttribute declarations to your service class. The example from the TexMex.Service. This service actually just returns the wsdl and schema for ws-metadataexchange itself, as well as a sample policy from the WS-Policy specification.
using System;
using System.Web;
using System.Web.Services;
using TexMex;
namespace TexMex.Service
{
[
Metadata(Dialects.WSPolicy, "TestServicePolicy.xml"),
Metadata(Dialects.Wsdl11, "metadataexchange.wsdl", Dialects.WSMetadataExchange),
Metadata(Dialects.XmlSchema10, "metadataexchange.xsd", Dialects.WSMetadataExchange)
]
public class TestService : System.Web.Services.WebService
{
public TestService()
{
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
Recent Comments