"Sandy" <sa*********@gm ail.comwrote in message
news:11******** *************@m 79g2000cwm.goog legroups.com...
>I am defining a web service to receive data that represents an
application form and that returns a message indicating if the
application form has been successfully validated or not, listing any
errors.
I would like to use XPath to define the validation rules that will be
executed within the web service. Clearly, to do this my data has to be
in XML format.
However, I would like my WSDL to describe explicitly the schema of the
application form. i.e. I don't want to use XMLElement or XMLNode as
the input parameter type, as this will not provide my subscribers with
any information on how they should format their submissions.
I suspect that the only way that I am going to achieve this by writing
a soap extension.
You don't need a SOAP extension for this! Just create the schema for the
application form, use it in a hand-generated WSDL, and _then_ use XMLElement
parameters.
You don't need to be a slave to the server stub code generated by WSDL.EXE.
You can totally ignore it if you don't need access to any of the data types
it contains. Otherwise, you can use it in your code, but only for the data
types, not for the definitions it contains of the operations in your web
service.
You then define your web service class as inheriting directly from
System.Web.Serv ices.WebService , not from the server stub. There's an article
on this somewhere on MSDN, but I'm afraid I couldn't find it just now.
Here's the definition of one of the more useful web methods in a web service
I'm developing (names changed to protect my job):
using System.Web.Serv ices;
using System.Web.Serv ices.Descriptio n;
using System.Web.Serv ices.Protocols;
using System.Xml;
using System.Xml.Seri alization;
/// <summary>
/// A service demonstrating the use of Ping
/// </summary>
[WebService(
Name = "PingServic e",
Description=" A service demonstrating the use of Ping",
Namespace = "urn:base")]
[SoapDocumentSer vice(
SoapBindingUse. Literal,
SoapParameterSt yle.Bare,
RoutingStyle = SoapServiceRout ingStyle.Reques tElement)] // ws-i
Basic Profile 1.1 Requirement R1109
public class Service : WebService
{
#region Operations
/// <remarks/>
[WebMethod()]
[SoapDocumentMet hod("",
Use=SoapBinding Use.Literal,Par ameterStyle=Soa pParameterStyle .Bare)]
[return : XmlElement("pin gResponse", Namespace="urn: messageTypes.ba se")]
public XmlElement Ping(
[XmlAnyElement(" pingRequest", Namespace="urn: messageTypes.ba se")]
XmlElement pingRequest)
{
return pingRequest;
}
#endregion
}
Where the request (and response) parameters are defined as follows:
<xs:complexTy pe name="PingConte nts">
<xs:sequence>
<xs:any namespace="##an y" processContents ="skip" minOccurs="0"
maxOccurs="unbo unded"/>
</xs:sequence>
<xs:anyAttribut e namespace="##an y" processContents ="skip"/>
</xs:complexType>
Good Luck,
John