RE: Bypassing Serialization/Deserialization in WebService/AP.NET
From: Henk de Koning (HenkdeKoning_at_discussions.microsoft.com)
Date: 01/10/05
- Next message: David Laub: "Re: Problems accessing dot net web service from java client"
- Previous message: Henk de Koning: "RE: debug"
- In reply to: ashoksrini: "Bypassing Serialization/Deserialization in WebService/AP.NET"
- Next in thread: ashoksrini: "RE: Bypassing Serialization/Deserialization in WebService/AP.NET"
- Reply: ashoksrini: "RE: Bypassing Serialization/Deserialization in WebService/AP.NET"
- Reply: Dilip Krishnan: "RE: Bypassing Serialization/Deserialization in WebService/AP.NET"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 Jan 2005 12:31:05 -0800
Actually it turns out this is quite simple. Just use a normal web method, but
type its (one) parameter as [XmlAnyElement] XmlNode [] theBodyStuff.
Now the direct children of your <soap:body> element will be directly morphed
into the XmlNode array without deserialization.
You can process soap header like normal. Here is a prototype of a webmethod
which should do what you want. It takes any body without deserialization and
allows you to touch any header sent to it:
public class CFlexservice
{
public SoapUnknownHeader[] _theHeaders;
[WebMethod]
[SoapHeader("_theHeaders", Direction=SoapHeaderDirection.InOut)]
[return:XmlAnyElement]
public XmlNode [] FlexMethod([XmlAnyElement] XmlNode [] _bodyStuff)
{
// ... your stuff here ...
}
}
BTW, I typed this by heart, so don't trust me ;-)
HTH,
-- Henkk
"ashoksrini" wrote:
> Hi All,
>
> I have the below requirement and would like to get some feeback from the
> group on the best way to implement:
>
> 1. I have WSDL defined exposing few web services.
> 2. We dont have a requirement to have a server web service class. (reasons
> below)
> 3. I want to develop something like this - when client makes a web service
> call, on the server I can intercept the SOAP message (XML doc itself),
> inspect some headers and then get the SOAP body and then pass on the body
> (XML) to a method in another class. As you can see, there is no use of having
> a ASP.NET server class, since all my web services have to be dealt in the
> same way (i.e get the body xml and call the same method on the same class
> passing the xml).
> 4. What we are trying to avoid, is the unecessary serialization and
> deserialization that happens when web service call has to be converted to a
> service class method object and etc.
>
> Given this, one of the ways to do it is to have a custom httphandler
> (registered in web.config) and get the http request stream in the handler
> class, inspect it and pass on the body. This would imply that when the
> handler class receive the response back, then it would have to manually
> create the SOAP response XML, which would mean that the handler should
> maintain the request that came in and map the request to response etc.
> So finally my question....is it possible to do this another way, leveraging
> the ASP.NET infrastructure (creating soap response, faults etc), but without
> the additional serialization, deserialization overhead?
>
> If you have read till here, thanks for your patience
>
>
>
- Next message: David Laub: "Re: Problems accessing dot net web service from java client"
- Previous message: Henk de Koning: "RE: debug"
- In reply to: ashoksrini: "Bypassing Serialization/Deserialization in WebService/AP.NET"
- Next in thread: ashoksrini: "RE: Bypassing Serialization/Deserialization in WebService/AP.NET"
- Reply: ashoksrini: "RE: Bypassing Serialization/Deserialization in WebService/AP.NET"
- Reply: Dilip Krishnan: "RE: Bypassing Serialization/Deserialization in WebService/AP.NET"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|