[GLLUG] consuming .net web services with javascript without using SOAP

Nihal Sinha nihals at gmail.com
Sun Jun 25 12:52:35 EDT 2006


I don't have any sample code on hand; however, there must be plenty of
resources online.  Try looking googling AJAX (Asynchronous Javascript and
XML) and ASP.NET.  AJAX is a term which encompasses making HTTP requests in
Javascript without refreshing the page.  Here's a typical scenario :

   - the browser makes an HTTP POST or GET request to query the web
   service
   - the web service returns a response in the form of an XML string --
   the XML does not have to use the SOAP format
   - the browser parses the response containing XML using a particular
   Javascript DOM implementation (which varies from browser to browser) and is
   then free to do whatever it wants with the data

I'm a Java guy and don't know much about ASP.NET, though I'm sure the
paradigms used in .NET are similar to their Java counterparts.  Here's a
simple example with pseudo-code:

// .NET code inside your main service method

string xml = "<person><first>John</first><last>Doe</last></person>";
Writer writer = response.getWriter();
writer.write(xml);
writer.close();

// End

Now the Javascript code gets a bit lengthy so I'm not going to post it.
However, the following URLs have plenty of code you can use to get started:

http://www.w3schools.com/ajax/ajax_example.asp
http://www.w3schools.com/dom/dom_parser.asp

Once you understand all that you can move on to using AJAX and .NET
frameworks, which greatly simplify things.  You could use frameworks to
begin with, but IMO it's important to understand what the frameworks do
under the hood before using them.

Hope this helps...
-Nihal

On 6/24/06, David Smith <smithd98 at gmail.com> wrote:
>
> Hello,
>
> I'm wondering if anyone can provide some sample code to consume an asp.netweb service with javascript without using SOAP?
>
> Thanks!
>
> --dave
> _________________
> David Smith
>
> (517) 944-1872
> smithd98 at msu.edu
> 614 Theo
> Lansing MI 48917
>
> _______________________________________________
> linux-user mailing list
> linux-user at egr.msu.edu
> http://mailman.egr.msu.edu/mailman/listinfo/linux-user
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.egr.msu.edu/mailman/public/linux-user/attachments/20060625/f5e11474/attachment.html


More information about the linux-user mailing list