How to call a web service from Firefox

Hi, I have a problem with calling .Net web services with a Firefox
client. A simple example will be enough for me.
Server side code is like this:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}

Client side .html code:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Hello World Tryout</title>
<script type="text/javascript" src="helloWorld.js" > </script>
</head>
<body onload="init()">
Hello World Denemesi



<div id="service" style="BEHAVIOR: url(../webservice.htc)"></div>
<input id="edtHelloWorld" style="width: 250px; height: 30px"
type="text" disabled="disabled" /></td> 
<input type="button" style="width: 100px; height: 50px"
value="Print" onclick="print()"> </td>



</body>
</html>


Client side .js code:

var callObject;
function init(){
service.useService( "Service1.asmx?WSDL","Service");
callObject = service.createCallOptions();
callObject.async = false;

}
function print(){
callObject.funcName = "HelloWorld";
var oResult = service.Service.callService(callObject );
if( !oResult.error )
{
edtHelloWorld.value = oResult.value;
}
}


This web service works on IE but doesn't run at firefox because
webservice.htc (behaviour file) doesn't work for firefox. I need a
javascript or something like that wihch I cann use instead of htc
file...
Thanks for any response...
sermet [ Mi, 09 April 2008 07:55 ] [ ID #1938587 ]

RE: How to call a web service from Firefox

you can use XmlHttpRequest in firefox and safari to call a webservice, but
you need to build the packets yourself. the easiest way is to pick an ajax
library as most support soap calls. the microsoft one does. also I don't
believe MS supports the soap htc behavior anymore.

-- bruce (sqlwork.com)


"sermet" wrote:

> Hi, I have a problem with calling .Net web services with a Firefox
> client. A simple example will be enough for me.
> Server side code is like this:
>
> [WebService(Namespace = "http://tempuri.org/")]
> [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
> [ToolboxItem(false)]
> public class Service1 : System.Web.Services.WebService
> {
> [WebMethod]
> public string HelloWorld()
> {
> return "Hello World";
> }
> }
>
> Client side .html code:
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head>
> <title>Hello World Tryout</title>
> <script type="text/javascript" src="helloWorld.js" > </script>
> </head>
> <body onload="init()">
> Hello World Denemesi

>

> <div id="service" style="BEHAVIOR: url(../webservice.htc)"></div>
> <input id="edtHelloWorld" style="width: 250px; height: 30px"
> type="text" disabled="disabled" /></td>
> <input type="button" style="width: 100px; height: 50px"
> value="Print" onclick="print()"> </td>
>

>
> </body>
> </html>
>
>
> Client side .js code:
>
> var callObject;
> function init(){
> service.useService( "Service1.asmx?WSDL","Service");
> callObject = service.createCallOptions();
> callObject.async = false;
>
> }
> function print(){
> callObject.funcName = "HelloWorld";
> var oResult = service.Service.callService(callObject );
> if( !oResult.error )
> {
> edtHelloWorld.value = oResult.value;
> }
> }
>
>
> This web service works on IE but doesn't run at firefox because
> webservice.htc (behaviour file) doesn't work for firefox. I need a
> javascript or something like that wihch I cann use instead of htc
> file...
> Thanks for any response...
>
brucebarker [ Mi, 09 April 2008 16:27 ] [ ID #1938635 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » How to call a web service from Firefox

Vorheriges Thema: possible to write to outlook calendar
Nächstes Thema: asp:menu question - How to get a count of a childItem?