![]() |
|
|
Published: Monday, July 03, 2000 By Erick Stover
In Part 1 we looked at building a simple SOAP client. In this part we'll look at building a SOAP server that responds to client requests.
The first line of our server is very important. It keeps the program from sending the header back before you had the chance to customize it.
You then need to specify that the returning information is XML. (This needs to be your next line. Your code won't work without it.)
Next, open up your XML DOM objects.
Now we need to load the XML that the client sent over. This is rather easy
Now lets build the returning code. This code is responsible for sending a SOAP response back to the client. You could pull this stuff from a database, but for the purpose of this tutorial, I'm just keeping it SIMPLE.
Now we need to cycle through the client code and find the password and information request. To do this, we use the XMLDOM object and the childnode properties. In order to save typing later on, I like to set these to a variable.
Now, we check the data that the client sent and see if they qualify.
Now for the "hard part". We have to take the XML code we built earlier, and send it back to the client. It took me forever to figure out that all you need to do is:
That's it! Three hours searching through MSDN and that all it took. Arrgh! Finally, close your IF/Then and clean up your objects.
Wow, that's it. If it works correctly, and you're using IE5, you will see the words "XML Shall Set You Free!". From here, you could populate the XML code with data from a database depending on what the client requested. Then you could use the XMLDOM object on the client side to merge the data with a XSL style sheet, which would make it visible on any browser. The possibilities are endless! p.s. I had a little trouble getting the XMLDOM and XMLHTTP object to show up in Visual Interdev. If you are having these problems, Microsoft (with all their glory) has already solved the problem. Check out: http://support.microsoft.com/support/kb/articles/Q262/1/28.ASP?LN=EN-US&SD=gn&FR=0 Happy Programming!
Attachments client.asp in text formatserver.asp in text format
Erick Stover
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||