HTML5 Web Services

I have a doubt regarding HTML5 Web Services. I tried to access a sample Web Service from HTML5, but not able to access. [The same web service is able to access from ASP .NET].

The web service return 'Hello World'.

I am using RhoElements 1.0. I tried this to run from Desktop  itself[Both Program in same computer]. The HTML5 Program I have written is given below.

<!DOCTYPE html>

<html>

<head>

<title>Hello World</title>

<script type="text/javascript">

var iCallID;

function InitializeService()

{

service.useService("http://localhsot/getService/Service1.asmx?WSDL", "HelloWorldService");

service.HelloWorldService.callService("HelloWorld");

}

function ShowResult()

{

alert(event.result.value);

}

</script>

</head>

<body  onload="InitializeService()" id="service" style="behavior:url(webservice.htc)" onresult="ShowResult()">

    </body>

</html>

I tried using ‘Json’ also but still not producing result.

Reply soon

Anonymous (not verified)
Not sure if this is the

Not sure if this is the problem, but "localhost" is misspelled.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Basith rahman
Hi Dan,Thanks for your reply,

Hi Dan,

Thanks for your reply, if i change to localhost also.. its not producing result. I am using web service developed using .net 2003 [asp .net web service].

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Aric Aune
Yep, "localhost" is spelled

Yep, "localhost" is spelled "localhsot"

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Basith rahman
Aric,Thanks for your reply

Aric,

Thanks for your reply.That was a type error. i have spelled correctly. but not getting the result.

My Web service is as follows:

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using System.Xml;

service1.asmx.cs

namespace getService

{

          /// <summary>

          /// Summary description for Service1.

          /// </summary>

          public class Service1 : System.Web.Services.WebService

          {

                    public Service1()

                    {

                              //CODEGEN: This call is required by the ASP.NET Web Services Designer

                              InitializeComponent();

                    }

[WebMethod]

                    public string HelloWorld()

                    {

                              return "Hello World";

                    }

}

}

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robert Galvin
I would suggest you try

I would suggest you try loading the same html that you are trying to load with RhoE inside of Chrome browser on your desktop. Then look at the Chrome developer tools to help debug. Does it work here and not in RhoE?

Sent from my Verizon Wireless 4G LTE DROID

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adel Sari
Hi Rob,Trying to access web

Hi Rob,

Trying to access web service (the same holloWord example listed above) fails for me,

i have download the webservice.htc file from Microsft web site, and test in google Chome (18.0.1025.142 m).

The error generated is:

  1. Uncaught TypeError: Object #<HTMLInputElement> has no method 'useService'
    1. callWebService
    2. (anonymous function)
    3. onclick

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Simon Wood
I'd guess the chance of this

I'd guess the chance of this working on anything other than IE is low.

Make your webservice JSON compliant and use the Rho::AsyncHttp.  The attributes you'll need for your web service method are:

    interface IMyInterface

    {

        [OperationContract]

        [WebGet(UriTemplate = "Job/{callsign}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]

        List<JobData> MyMethod(string callsign);

Don't forget the WebHttpBehaviour on the endpoint

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments