469,283 Members | 2,263 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

Is there a simlpe SOAP -> method call example that doesn't use any transports, etc.?

I have not had any luck searching for a simple, simple example that
calls a method on an object given a SOAP string. Here's what I'm
looking for (in pseudocode):

string SOAPCall = "bla bla bla"; // SOAP method invocation XML
string SOAPResponse;
MyObject x = new MyObject();
// and here's where I don't know what to do
/* call the method on x as specified in SOAPCall and
get the output into SOAPResponse. */

Can anyone be of any assistance?

Thank you!
Nov 12 '05 #1
3 4723
"Nimai Malle" <ni*********@yahoo.com> wrote in message news:7a**************************@posting.google.c om...
I have not had any luck searching for a simple, simple example that
calls a method on an object given a SOAP string.
That's probably because it's impractical. What's the point of
SOAP without any transport? If I wanted to call a method on
an object I'm holding in my hand, creating a SOAP envelope
is the last thing I want to do.

SOAP's usefulness is when I want to call a method on the
object in Billy Jean's hand, over there. Or an object in
Heather's hand, in San Diego. Or an object in Dieter's
warehouse in Cologne, Germany, that's running on an
AS/400 midrange machine requiring me to digitally sign
the method call so Dieter knows it came from me and
not Heather.
string SOAPCall = "bla bla bla"; // SOAP method invocation XML
string SOAPResponse;
MyObject x = new MyObject();
Why not get rid of SOAPCall and SOAPResponse and just
say x.MyMethod( blah, blah)? It's both easier, and much
more efficient. :-)
Can anyone be of any assistance?


For the particular three objects you have in your example,
you could parse the SOAPCall string as XML and interpret
it to route to the correct method of MyObject using a number
of System.Reflection methods, call the method and then
return a value that you'd have to format as SOAP to store
in SOAPResponse.
Derek Harmon
Nov 12 '05 #2
Thank you Derek. I guess, this being the usenet and all, I forgot to
mention that:

I AM NOT A TOTAL IDIOT!

In the interest of keeping my original post brief, I did not include
the entire context surrounding my interest in acquiring such an
example. I would have thought it obvious that I wasn't trying write a
stand-alone application using SOAP calls.
That said, what I am interested in is what .NET Framework methods are
available (and possible used internally) for implementing the
functionality in HttpRuntime.ProcessRequest, for example.

Anyway, I understand your reply. Thank you.
Nov 12 '05 #3
"Nimai Malle" <ni*********@yahoo.com> wrote in message news:7a**************************@posting.google.c om...
That said, what I am interested in is what .NET Framework methods are
available (and possible used internally) for implementing the
functionality in HttpRuntime.ProcessRequest, for example.
From your first post and subject line, I would never have guessed you
were interested in the implementation of HttpRuntime.ProcessRequest( );
what it dealing with HTTP transport, and largely unrelated to SOAP? ;-)

ProcessRequest handles incoming HTTP requests (not necessarily SOAP,
but you know that) for ASP.NET. The file extension of the requested
resource is mapped to an HttpHandler implementation that knows how
to process and respond to that particular request. The handler is created,
and responsibility for driving the response is turned over to it.

If you look in the machine.config file, you will see an <httpHandlers> section
which associates types with various paths (often file extensions). When you
look at path="*.vb" for instance, you see it associated with the type: System.
Web.HttpForbiddenHandler. ASP.NET does not want IIS to answer requests
for source files that may exist in the web applications' folders, so this class will
construct a response that gets sent back to the end user saying "Forbidden."

One of those HttpHandlers, of course, is for the path="*.asmx", which is
a ASP.NET web service document. It's type is System.Web.Services.
Protocols.WebServiceHandlerFactory. That's about as soapy as Process-
Request itself gets.

If you want to see what .NET Framework methods HttpRuntime.Process-
Request uses internally, I suggest running ILDASM -- it's included in the
FrameworkSDK /bin folder (or the popular Reflector tool by Lutz Roeder)
-- on the System.Web assembly. It's not necessary to be fluent in MSIL
to read the disassembly, all of the .NET Framework method calls will jump
right out at you.

: : Anyway, I understand your reply. Thank you.

"Derek Harmon" <lo*******@msn.com> wrote in message news:uP*************@TK2MSFTNGP10.phx.gbl...

: :
For the particular three objects you have in your example,
you could parse the SOAPCall string as XML and interpret
it to route to the correct method of MyObject using a number
of System.Reflection methods, call the method and then
return a value that you'd have to format as SOAP to store
in SOAPResponse.


Let me elaborate, you may not have seen how this applies.

Use the System.Xml.* classes to interpret the SOAP envelope that
you're (it sounds like to me) posting from your SimpleWorkerRequest
subclass. The .NET Framework also uses System.Xml.Serialization
and the System.Runtime.Serialization.Formatters.Soap; but were I
writing it, I'd avoid using those if possible.

Use the classes in the System.Reflection namespace to instantiate an
instance of your object (e.g., ConstructorInfo or the CreateInstance( )
method of Type or AppDomain if you prefer) and invoke the right
method (e.g., MethodInfo or PropertyInfo; Invoke( ) or SetValue( )
methods).

Go back to the System.Xml.* classes to create the response containing
the method's return value; or to create a fault for any Exception you've
caught.

The actual WebService handler ASP.NET uses will look for (using
reflection) all sorts of Attributes adorning MyObject's metadata to
drive through certain parts of it's deserialization, processing, and
serialization of the response.
Derek Harmon
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Russell | last post: by
reply views Thread by chr | last post: by
8 posts views Thread by xmail123 | last post: by
reply views Thread by Daniel | last post: by
reply views Thread by Michael_R_Banks | last post: by
1 post views Thread by gcmartijn | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.