Maverick

Friday, August 17, 2007

Calling Web Service using XMLHTTP Object

Filed under: ASP.NET, C# — debasishpramanik @ 8:26 pm
Tags: , , ,

Follow the steps to invoke a webservice using a XMLHTTP object in javascript

Step  1: Create a soap envelope for the requested method.

soapenvelope.gif

 var envelope = <The above string>;

Step 2: Create Instance of XMLHTTP Object

Now in the Javascript method create an instance of the XMLHTTP object

 xmlhttp.gif

 Step 3: Prepare the Webservice Request

 As shown above the url points the target webservice which is Service.asmx file and named of the method is HelloWorld. The syntax to be used

url1.gif
http://<Host Name>/<Virtual Directory>/<Webservice>/Method Name

in the next line we are initiating a POST request for the webservice url.

Step 4: Handling the Callback

callback.gif

Here when the response from the web service returns it just display the return string in alert box.

Step 5: Sending the  Request

 sendrequest1.gif

As shown above, the send message is send with the envelope  for the Web Method prepare in the Step 1.

Step 6: Executing the Web Service

calloutput.gif

Refer to this link for more  http://support.microsoft.com/default.aspx/kb/893659

Hello World using Apollo/Adobe AIR

Filed under: Latest Trends, RIA — debasishpramanik @ 5:19 pm
Tags: , , , ,

Its been days that I was trying to write a simple app using AIR, the buzz word these days, so downloaded the following

  1. Adobe AIR SDK.
  2. Adobe AIR SDK documentation.

Extract these above stuff after downloading. The documentation is quite good for a HTML /Javascript developer like me. Here I write a Hello World html file using AIR framework.

There are three things to be done

  1. Application XML file.
  2. HTML File.
  3. Executing the application.
Application XML File 
  1. Create a XML file named <AppName>-app.xml, here appname can be HelloAIR.
  2. The structure of XML is

   

xml.gif

    The text of rootContent element represents the name of the html file that is associated with the xml.

HTML File

The following the html code

HTML Code

The appLoad is invoked when the page is loaded. As shown above we are including the standard AIRAliases.js file in the HTML file, so AIR runtime will be initialized. If its initialized the Air.Trace statement is used to print on AIR console “Hello Air”. Then XMLHTTP request is made for getting request.txt file and dumping the content of that file onto the AIR console.

Executing the Application

When the AIR sdk is extracted there are two programs that come

  1. ADL: To execute the AIR application
  2. ADT: to package the AIR application

Use the adl command to execute the AIR application.

The ADL command

When you execute the command with XML as parameter then the following is displayed

commandline.gif

 

 

execute.gif

As shown above the Hello.AIR is the Air.Trace output and the white console displays thee content of the request.txt file.

Blog at WordPress.com.