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 8 3428
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
umm...not sure if that will work.
My web services defined in WSDL will look like this (represented in .NET
class)
CreateSalesOrder(SalesOrder)
CreatePurchaseOrder(PurchaseOrder) etc.
"Henk de Koning" wrote: 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
Hello Henk,
That will work provided you only have one soap action i.e. FlexMethod in
this case. However try using WSE 2.0 and use the soap receiver that can accept
any input and any action. Either way you would need to do what WSE does behind
the scenes ;)
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com http://www.geniant.com 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,
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
Use SoapExtension class and override othe ProcessMessage method, take a
lookt at the MSDN documentation for details
// then you can write your method someting like this, preserving the WSDL
[MyOwnSoapExtensionAttribute]
[WebMethod]
public SalesOrderResponse CreateSalesOrder(SalesOrder);
regards
erymuzuan msutapa
ashoksrini wrote: umm...not sure if that will work.
My web services defined in WSDL will look like this (represented in .NET class)
CreateSalesOrder(SalesOrder) CreatePurchaseOrder(PurchaseOrder) etc.
"Henk de Koning" wrote:
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
Well, the question was if it could be done using the aspnet pipeline ... I
agree you can do other stuff with WSE2, and you know what, with Indigo you
can ditch the web server entirely ;-)
Anyhow, you *can* expose multiple methods using the anyElement technique, as
long as you are willing to write the WSDL by hand (or tool, or create
skeleton webmethods first, capture the generated WSDL and then replace the
skeletons by corresponding any methods). The contract can be more strongly
typed than the implementation (or better, the typing can be enforced by
something else than the plumbing).
Remember that the only thing that determins delivery of a soap request to an
endpoint is the method name (in fact, the lack of support for overloading is
one of the big struggles in WSDL2 right now).
-- Henkk
"Dilip Krishnan" wrote: Hello Henk, That will work provided you only have one soap action i.e. FlexMethod in this case. However try using WSE 2.0 and use the soap receiver that can accept any input and any action. Either way you would need to do what WSE does behind the scenes ;)
HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com
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,
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
> Well, the question was if it could be done using the aspnet pipeline ... I agree you can do other stuff with WSE2, and you know what, with Indigo you can ditch the web server entirely ;-)
:)
Anyhow, you *can* expose multiple methods using the anyElement
You *cannot* expose multiple methods in ASP.net... only one method which
can handle many inputs!
technique, as long as you are willing to write the WSDL by hand (or tool, or create skeleton webmethods first, capture the generated WSDL and then replace the skeletons by corresponding any methods). The contract can be more strongly typed than the implementation (or better, the typing can be enforced by something else than the plumbing).
Remember that the only thing that determins delivery of a soap request to an endpoint is the method name (in fact, the lack of support for overloading is one of the big struggles in WSDL2 right now).
Exactly my point!
<snip>
I am looking at a trace of a wsdl generated proxy that goes to the following
webmethods:
[WebMethod]
[SoapHeader("_myHeaders", Direction=SoapHeaderDirection.InOut)]
[return:XmlAnyElementAttribute]
public XmlNode [] AnyMethod1([XmlAnyElement] XmlNode [] body)
{
body[0].InnerText = "Bye bye";
return body;
}
[WebMethod]
[SoapHeader("_myHeaders", Direction=SoapHeaderDirection.InOut)]
[return:XmlAnyElementAttribute]
public XmlNode [] AnyMethod2([XmlAnyElement] XmlNode [] body)
{
return body;
}
So, I rather believe my own eyes than your remarks ;-). I stick to my point:
you *can* do multiple anyElement webmethods (as long as you give them
different names). What makes you believe this would be impossible ?
-- Henkk
"Dilip Krishnan" wrote: Well, the question was if it could be done using the aspnet pipeline ... I agree you can do other stuff with WSE2, and you know what, with Indigo you can ditch the web server entirely ;-)
:)
Anyhow, you *can* expose multiple methods using the anyElement
You *cannot* expose multiple methods in ASP.net... only one method which can handle many inputs!
technique, as long as you are willing to write the WSDL by hand (or tool, or create skeleton webmethods first, capture the generated WSDL and then replace the skeletons by corresponding any methods). The contract can be more strongly typed than the implementation (or better, the typing can be enforced by something else than the plumbing).
Remember that the only thing that determins delivery of a soap request to an endpoint is the method name (in fact, the lack of support for overloading is one of the big struggles in WSDL2 right now).
Exactly my point!
<snip>
Hello Henk,
Not to start an email war.. but i think we misunderstood each other.
What I tried to say was you cannot have multiple soap actions being handled
by the same web method with XmlAnyElement :) This is by virtue of the fact
that the soap action is infered from the method name if the action (SoapDocumentMethod)Attribute
is not specified. You can by all means create as many methods as you want...
and all day. However it doesnt address the original problem
"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."
<snip> So, I rather believe my own eyes than your remarks ;-). I stick to my point: you *can* do multiple anyElement webmethods (as long as you give them different names). What makes you believe this would be impossible ?
Certainly possible ;)
Cheers!
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com http://www.geniant.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Snowman |
last post by:
Suppose I have a RootObject which holds a collection of other objects.
The other objects have a property (Parent) which refers back to the "parent"
collection (b.t.w. my collection is based on...
|
by: Jeff T. |
last post by:
Hello,
I have an existing set of C# classes that encapsulate our application data.
They are in a heirachy with each subclass defining more specific types of
data. I would like to serialize these...
|
by: psy000 |
last post by:
Hi,
I have a C# web service client that talks to a JAVA application sever.
I use AXIS to generate the WSDL file, use wsdl.exe to generate proxy
stub c# code. When I try to use c# client connect...
|
by: Maheal |
last post by:
I have been trying to Serialize an object that is the child of another
object which is also serializable. Here is the simplified scenario
(assume missing code is correct):
class One :...
|
by: Amadelle |
last post by:
Hi all and thanks in advance for your help,
I am having problems deserializing an object which seems to be serializing just fine. I save the byte array of the serialized object in the database...
|
by: Goethals Frederik |
last post by:
Hi,
I have some questions that are a little difficult to explain, so I give it a
try...
I have an application (aSP.NET with VB.NET codebehind) and I would like to
store my data on disk...
|
by: Miguel RS |
last post by:
Hi all,
I have a winforms app (app1), a webservice (ws1) and a webpage (wp1). The
webservice exposes a type (type1). When I generate a proxy (px1) for app1 I
get the type ws1.type1. The thing is...
|
by: Harold Howe |
last post by:
I am having a problem deserializing objects from a library when the
following conditions exist:
1- The library is strongly named
2- The serialized file was created with version 1.0 of the...
|
by: =?ISO-8859-1?Q?=22Andr=E9s_G=2E_Aragoneses_=5B_kno |
last post by:
Hello. I have this kind of object:
class classA
{
int x;
classA z;
public int X
{
get { return this.x; }
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
| |