473,626 Members | 3,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing raw XML in a web service using ASP.Net 2.0

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.

Before I get lost in code, can someone confirm that I will be able to
achieve my aims using a soap extension class. Is there a better way of
doing this? Does anyone have any clear samples or walk-throughs?

For clarity, my requirements are:
- to have access to the submitted data in its raw XML form from within
the service implementation (to allow XPath querying).
- I don't want to re-serialize data that ASP.Net has already
deserialized for me!
- WSDL for the service that explicitly describes my schema

Any advice gratefully received.

Sep 1 '06 #1
1 3314
"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
Sep 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2182
by: Keith E. | last post by:
I have implemented a Web Service on an IIS 5.0 platform using the ASP listener I can access the Web Service just fine from a VB 6 App and classic ASP using the SOAP 3.0 toolkit and its "MSSOAP.SoapClient30" object However, one of the servers that I'd like to call the Web Service from is a shared hosting platform that does not offer the "MSSOAP.SoapClient30" object It only has the MS XMLDOM. I have located an example of Accessing a Web...
4
4871
by: Eugen Walcher | last post by:
Hello all, I've tried posting this same question on other newsgroups with no luck. This group seems to have a lot more activity so I apologize if you have seen it before. I'm trying to create a web service in c# using paradox data. The data is stored locally on my development machine with IIS also installed. Web services are working to the point where I can return strings and ints using Access2000 data but whenever I try and...
1
3949
by: Eirik Brattbakk | last post by:
Hi I have some problems accessing a soap service made in c# using an ATL/MFC client over SSL. I have tried both CSoapMSXMLInetClient and CSoapWininetClient as template arguments with my stub class. The service is returning with the error code: -2147467259. I have not succeeded to find any additional information about the error. The "SoapFault" method seems to return only a bunch of question marks.
3
7660
by: Jim Lewis | last post by:
I have read several things that state accessing a Web Service through a Query String should work. However, when I try to execute http://localhost/webservice1/service1.asmx/HelloWorld I get the error below. Can I access a Web Service through a Query Sting. I need to send XML to a Flash movie using a Web Service. Thank You, Jim Lewis Server Error in '/WebService1' Application.
7
7102
by: David Laub | last post by:
I've also posted this issue to a Sun/java formum, but since it appears to be an integration issue, this may be the better place to posr: I have written a dot net/c# Web Services doesn't fully work with J2ME client a) c# web service works with c# WIndows Client (local & remote web service) b) c# web service works with J2ME client - when the Web Service is local c) c# web service fails with J2ME client - when the Web Service is remote ...
3
2489
by: Fredric Ragnar | last post by:
Hi, I am making a prototype system with Remoting in the bottom of the system. An XML Web Service is using the remote object on an IIS to present data. I am using a TcpChannel for communicating between the XML Web Service and the host for the remote object. Within the host a port is defined and the channel registered. It starts listening for requests. The destination port is therefore clearly defined.
4
3762
by: Khalique | last post by:
I have built a web service whose purpose is to copy files from a secure place to client machine and vice versa. The problem I am having is perhaps related to permissions and access rights. For testing purposes, the secure place is setup on the client machine. The client (window app) calls the web service (on a different machine) and connects successfully to the web service. However, when client calls a method that copies the file from...
3
4991
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
10
9755
by: Anton | last post by:
Hi, when accessing a secured 3rd party webservice i'm getting a 401 HTTP Statuscode (unauthorized). When entering the url in a browser and entering the username and password manually, the wsdl is returned. So the username and password should be ok. I'm using this code: Merchant myMerch = new Merchant(); myMerch.merchantIdentifier=merchantId;
0
8268
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2628
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.