473,651 Members | 2,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling Web Services from Mozilla Browsers

Hi,

Can anybody give me a simple example of how to Call Web Services from
Mozilla based Browsers ? I can call web services from IE browser using
web service behavior file, without any problems. Just wanted to know an
easy way to call them from Firefox or Netscape.

Thanks,
Nifty.

Jul 23 '05 #1
5 6763


ni*******@gmail .com wrote:

Can anybody give me a simple example of how to Call Web Services from
Mozilla based Browsers ? I can call web services from IE browser using
web service behavior file, without any problems. Just wanted to know an
easy way to call them from Firefox or Netscape.


Since Mozilla 1.4 (respectively Netscape 7.1) there is a web service
proxy facility implemented in Mozilla that reads the WSDL description of
a service and creates a proxy object in JavaScript, see
<http://www.mozilla.org/projects/webservices/>
In earlier versions there is support for a (lower level) SOAP API.
Unfortunately there are issues with SOAP/WSDL clients and servers not
being as interoperable as they are supposed to be, perhaps you can
report back to the group how your service is implemented and whether you
get the Mozilla proxy object and the service interoperate with each
other successfully.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
My web service is written in C# and ASP.NET. The name of the service is
Service1. The web methods exposed under this service is "WebAdd". This
webmethod takes two integers as an input and returns the result of
addition of both the integers.

I have this service hosted in a folder called "MathOps" in my localhost
(IIS Webserver). I want to write a simple html file, which has two text
boxes to take those inputs and upon clicking an "Add" Button, it prints
the result to the screen.

I have accomplished this task using IE with the help of HTML Component
for web serrvices (WebServices.ht c) provided by Microsoft. I researched
a lot on calling web services from netscape/mozilla based browsers but
to no avail. I have visited the site you told me, but I am surprised to
find out their examples dont run on Firefox 1.0 I havent tried other
mozilla based browsers though.

My HTML file looks like this (when I use webservices.htc for IE)
*************** *************** *************** *************** *************
<HTML>
<HEAD>
<TITLE>Consumin g the ADD Web Service</TITLE>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaS cript">
<!--
function init() {

myWebService.us eService("http://localhost/MathOps/Service1.asmx?W SDL",

"simpleCalcWebS ervice");
}

function addNumbers(a, b) {
myWebService.si mpleCalcWebServ ice.callService (addResult, "WebAdd",
first.value, second.value);
}

function addResult(resul t) {
theResult1.inne rHTML = result.value;
}
// -->
</SCRIPT>
</HEAD>
<BODY onload="init()" >
<DIV ID="myWebServic e" STYLE="behavior :url(webservice .htc)"></DIV>
<TABLE BORDER="0">
<TR><TD>Numbe r 1: </TD><TD><INPUT SIZE="4" TYPE="text" ID="first"
STYLE="text-align:'right'"> </TD></TR>
<TR><TD>Numbe r 2: </TD><TD><INPUT SIZE="4" TYPE="text" ID="second"
STYLE="text-align:'right'"> </TD></TR>
<TR><TD><HR></TD><TD><INPUT VALUE="Add" TYPE="button"
onclick="addNum bers();"></TD></TR>
<TR><TD>Resul t: </TD><TD><DIV ID="theResult1 "
STYLE="text-align:'right'"> </DIV></TD></TR>
</TABLE>
</BODY>
</BODY>
</HTML>

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

Please let me know if you need more info on this..

Thanks,
Nifty

Jul 23 '05 #3


ni*******@gmail .com wrote:
My web service is written in C# and ASP.NET.
Unfortunately there are incompabilites between the SOAP requests ASP.NET
wants and understands and the SOAP requests Mozilla creates, at least as
far as I can tell currently.
There are some bugs filed on that:
<https://bugzilla.mozill a.org/show_bug.cgi?id =137490>
I researched
a lot on calling web services from netscape/mozilla based browsers but
to no avail. I have visited the site you told me, but I am surprised to
find out their examples dont run on Firefox 1.0 I havent tried other
mozilla based browsers though.


Which examples have you tried exactly, and what happens exactly when an
example doesn't "run"?
For instance
<http://www.mozilla.org/projects/webservices/>
links to the example
<http://mgalli.com/wsdom/moz-crossportal/fs-4/>
and that works here for me with Firefox 1.0, if you click the "get"
button then a conversion rate is displayed.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4
I have tried out this example:

http://www.mozilla.org/projects/webs...sdl/index.html

When I run this in firefox, I get two javascript errors.

1.Error: [Exception... "'A script from "http://www.mozilla.org " was
denied UniversalBrowse rRead privileges.' when calling method:
[nsIWebServicePr oxyCreationList ener::onLoad]" nsresult: "0x8057001e
(NS_ERROR_XPC_J S_THREW_STRING) " location: "<unknown>" data: no]

2. Error: uncaught exception: A script from "http://www.mozilla.org "
was denied UniversalBrowse rRead privileges.

I have also tried the bablefish example. But seems like it is disabled.

I also tried the Translator Service.

http://www.mozilla.org/projects/webs...ple/index.html

This doesnt seem to work either. When I select an option to translate
into and click the button, nothing gets displayed next to "Results:" I
do not recieve any javascript errors on this one.. But still it doesnt
work.

I hope somebody fixes the "accessing .net web services from mozilla"
bug soon.. I am not the only one who will be using this. I wonder what
people with similar problem have done? Any other alternatives you can
suggest to get rid of this problem?

Thanks for your feedback,
Nifty

Jul 23 '05 #5


ni*******@gmail .com wrote:
I have tried out this example:

http://www.mozilla.org/projects/webs...sdl/index.html

When I run this in firefox, I get two javascript errors.

1.Error: [Exception... "'A script from "http://www.mozilla.org " was
denied UniversalBrowse rRead privileges.' when calling method:
[nsIWebServicePr oxyCreationList ener::onLoad]" nsresult: "0x8057001e
(NS_ERROR_XPC_J S_THREW_STRING) " location: "<unknown>" data: no]

2. Error: uncaught exception: A script from "http://www.mozilla.org "
was denied UniversalBrowse rRead privileges.
That example clearly explains ("Note about Security") that you would
need to change security settings before being able to run it from the
Mozilla web site as (usually with scripts) the page from mozilla.org is
not allowed to access a web service on amazon.com.
I hope somebody fixes the "accessing .net web services from mozilla"
bug soon.. I am not the only one who will be using this.
Yes, but the problem is not necessarily related to Mozilla only, it is
more a problem as to different people interpreting SOAP 1.1 differently
as it is not clear enough about XML namespaces applied on arguments or
result values. That Mozilla web service proxy code was obviously written
against web services where the problem did not occur.
I wonder what
people with similar problem have done? Any other alternatives you can
suggest to get rid of this problem?


If you are a writing web service with .NET then it usually does not only
accept SOAP requests but simple HTTP POST (or even HTTP GET) requests
too so you could ignore SOAP for the time being and simply use
XMLHttpRequest to send your data and receive the response.

The XMLHttpRequest object is decribed here:
<http://www.faqts.com/knowledge_base/view.phtml/aid/17226/fid/616>
<http://jibbering.com/2002/4/httprequest.htm l>

If you load your .NET .asmx page for the web service then it usually
displays a documentation about the methods and the page documenting a
method shows how the HTTP POST request for a method and the result would
look so it is rather easy then to use XMLHttpRequest to send the message
and to read the response.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6834
by: David List | last post by:
I'm having a problem using different properties of the document object in the example javascripts in my textbook with browsers that identify themselves as using the Mozilla engine. One example of these problems is using document.layers. I have Google'd for examples of how to use the document object specifically with Mozilla, but I cannot find anything that explains why my problems occur. Could anyone here see through the included example...
10
3579
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
5
3840
by: boe | last post by:
Hi everybody I have the page listed below and want the boxes to be in rows, line-wrapping neatly. In IE this looks right, but in mozilla (and possibly other browsers) it doesn't. the css commented out, with -moz-inline-box seems to help a bit for mozilla (linebreaks do not work, any suggestions?), but then again it does not work in IE anymore. How can I make this work, or make something which hase the same
3
1997
by: Disco-181 | last post by:
Hi, I have a script which isn't working in Mozilla based browser for some reason. I'm trying to run two functions from the body onload tag and it simply isn't happening. I have a cascading menu, where the primary dropdown selection determines the contents of a second dropdown. This is triggered by a function in the onchange tag of the primarys select tag. When triggered like this, the function and drop downs work fine. When
6
2827
by: hsomob1999 | last post by:
so i have a <ul> and I allow the user to append items to it. The problem is that on mozilla the <span class="line"> which is just a line to divide the sections gets overlaped and doesnt move down and adjust to the newly added items like it does in iE. It just occured to me that i dont really have to use a span, and a html <hr> tag could do the trick -I will go try. But aside from that could some one explain why this occurs? And will I get...
0
731
by: Francois Guerin | last post by:
I have an application calling a web service on a different machine. The application code runs under a local user account on the application server. The account (identical username/password) is created on the web service server. The web service uses Windows integrated security and ACLs are set on the web service to allow the remote application to use it. The problem is that everytime IIS' is recycled, I get an "unauthorized" error on the...
5
4632
by: mike | last post by:
If I have a document like: <script> function mike_test() {alert('hi');} </script> <iframe src="blank.html" id="my_iframe1"> </iframe> and in blank.html I have:
13
6683
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is getting as far as the iframe section as other parts of the html code work correctly. But it is not executing any code within the getPage() function as some "hello world" writes within getPage() wouldn't print. ...
22
3436
by: Archanak | last post by:
Hi, I am using 2-level CSS Drop Down Menu in my perl/CGI program. here is the code. #!c:/perl/bin/perl.exe use CGI qw(:standard);
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.