Web Resources  >  XML

XQuery Examples

XQuery Examples

 

SELECT     AtosEPIXml1.query('
{
for $x in /ROOT/Description
where $x/Element_ID = 80168
order by $x/Element_Name
return

  • {data($x/Element_Name)}
    }

    ')
                           AS ElementName
    FROM         NWDS_ATOS

REST Server or Client-side Web Service Calls

We are designing a .NET Portal application requiring accessing a REST Web service outside our domain. "How should our developers handle this?" They are much better .NET developers than Javascript developers. So I performed some research and found a nice article. It is posted here for our reference only. We didn't write this REST Web Service article, but I want to refer to it when discussing with our client the pros & cons of consuming the REST Web Service. To see the REST Web Service article in its natural form, go to http://thenewblack.sirotamail.com/2007/09/rest-web-service-call-client-vs-server.html

The following comes from the REST Web Service article.

My company is integrating with a 3rd party website that will provide Event and Calendar widgets. The data is accessible to us through a REST interface, basically XML over HTTP. A sample call might include:

http://domain.com/events/search?start_date=8/30/2007

This would return XML that looks like this:

<events>
<event>
<title>Mommy & Me</title>
<start_date>8/30/2007 10:00</start_date>
<end_date>8/30/2007 11:00</end_date>
</event>
<event>
<title>Mommy & Me</title>
<start_date>8/30/2007 10:00</start_date>
<end_date>8/30/2007 11:00</end_date>
</event>
</events>

We’ve been going back and forth about whether to make the call and parse the data on the client-side or the server-side.

If we did it on the server-side, we’d use .NET’s WebRequest object and deserialize the XML into .NET objects: Event, List<Event>. Then bind the data to the ASP.NET controls on the page.

If we did it on the client-side, we’d use a XMLHttpRequest, then a JavaScript XML toolkit to deserialize the XML into JavaScript objects and set the values on the client side like this:

event = [javascript object]
div = document.getElementById(divId)
if(div) { div.innerText = event.start_date; }
etc…

There are pluses and minuses to both methods, detailed here:

Server-Side Client-side
Too Many HTTP Connections can clog up the server HTTP burden is on the client computer
Can utilize built in data manipulation tools such as Sorting, Filtering, Pagination Team would have to either write custom code or use 3rd party javacript to do data manipulation
Easier to utilize built-in ASP.NET controls (such as Calendar) without passing ClientIDs to Javascript Easier to widgitize JavaScript libraries using DHTML for publishing to other sites (a la Google Maps)
Facilitates Caching of Requested Data on the Web Server Caching is less important because data is retrieved and stored on the client
Debugging, IDE tools are sophisticated in .NET Visual Studio 2008 has much better support for JavaScript debugging and FireFox plugins make coding in JavaScript easier than it used to be.
.NET has built-in toolkits for XML deserialization, JSON is not used as much with .NET. JavaScript can work well with JSON (which the web service supports) and XML
Our programmers tend to know more about .NET than JavaScript Ajax is the new black

If it weren’t for HTTP Connection load, my choice would clearly be Server-Side, but given that doing real-time queries on a web server can be resource-intensive, would we be painting ourselves into a corner performance-wise if we forced the web server to retrieve the data from the API?

***********************************

Finally, the author provides an update on his REST Web service choice.

UPDATE: it turns out that due to cross-site scripting attacks, most common browser settings don't allow you to call a cross-domain web service directly from javascript using XMLHttpRequest

That means that in order to do the request client side, either the web service company has to provide the javascript as a <script src=> or you have to wrap the web service on the server, which defeats the performance gains.

Server-side it is!

Exceptional Customer Service
Click here to see our extensive Alaska Web Designers portfolio! Webdesign companies provide services to many Alaska firms. Choose Alaska Web Designers to serve your company today. All of our Alaska Web Designers are professionally trained and stay current with latest website business techniques. Portfolio
Check out our extensive portfolio!
We specialize in: Web Design, Web Development, E-Commerce Integration, SEO Internet Marketing, Database Design and Software Development!
Click here to see how our Alaska Web Designers do business in Anchorage, Alaska. Good website developers offer clients value, thus making their companies more productive Our Process
Come see how our business works!
Our business process can and will save your company time and money!
We are your #1 Web Design choice in Alaska! Good service for your firm is our mission. Alaska Web Designers are available to serve your business needs. Web Design
Check out our Web design services!
We specialize in Web design. We can improve your company's presence on the Web.
We are your #1 Web Development choice in Alaska! Web Development
We build applications for the Web
We specialize in Web 2.0 application development. Our professional software engineers can make the Web application of your dreams.
Click here to see our e-commerce solutions for your company! Alaska Web Designers should always be providing value to your firm. Choose Alaska Web Designers to make your e-commerce run smoothly. E-Commerce
We can move your business onto the Web!
Let our software engineers optimize your sales potential. With our E-Commerce solutions your company can make sales 24-7!
Click here to see our Internet Marketing solutions and SEO packages! Our Alaska Web Designers are trained in SEO strategies to propel your firm to the top. Let Alaska Web Designers serve your business needs. Internet Marketing
Improve your company's marketability on the Web!
We can create a marketing plan that will improve your search engine ranking and get your company the reputation it deserves!

NWDS Alaska Web Design Company's webdesign offers affordable custom website design. Our full service website design company only hires formally trained website designers. Please contact us today at 907.227.1676 or chowell@nwds-ak.com for your next web site design project.

Web Site Map