473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Web Services

Hi all-

I am new to web services, so please bear with me. I have to have a web
service (Coded in Visual C#), and I need to have it work with Netscape
7.0 (Mozilla 1.0 I believe). I have it working perfectly with IE (with
the help of webservice.htc), but cannot get it working in Netscape 7.0.
I have read articles on how to access Web Services through Javascript
with SOAP, but I get errors saying that "SOAPCall is undefined", etc.
Does anybody know how to access web service methods in javascript for
Netscape 7.0? Any help would be greatly appreciated. Thanks in
advance.

Jul 23 '05 #1
9 2193
VK
> I have to have a web service (Coded in Visual C#),
and I need to have it work with Netscape 7.0
(Mozilla 1.0 I believe).


I don't think that you can do it, especially with .htc blocks that you
call "web service" and which is Microsoft "behaviors" in the reality.
It *should* work though on Netscape 8.0 that has its dual-mode property
(so it can act as FF or IE upon the curcumstances). It makes me
suspitius though that you mention C# and .htc blocks in one context.
Could you give a sample HTML/XML page your're calling server-side
blocks from?

Jul 23 '05 #2


M B HONG 20 wrote:
I am new to web services, so please bear with me. I have to have a web
service (Coded in Visual C#), and I need to have it work with Netscape
7.0 (Mozilla 1.0 I believe). I have it working perfectly with IE (with
the help of webservice.htc), but cannot get it working in Netscape 7.0.
I have read articles on how to access Web Services through Javascript
with SOAP, but I get errors saying that "SOAPCall is undefined", etc.
Does anybody know how to access web service methods in javascript for
Netscape 7.0? Any help would be greatly appreciated. Thanks in
advance.


As far as I remember SOAPCall is around since Mozilla 1.0 and thus
should be supported in Netscape 7.0. Do you have code that works with
later Netscape or Mozilla versions but gives the "SOAPCall is undefined"
error in Netscape 7.0? Do you have a URL where the error occurs?
I have no Mozilla 1.0 build here but in the Mozilla 1.1 build I have
SOAPCall is defined.

Of course 7.0 is quite old so it is always a good idea to upgrade (or
get your users to upgrade).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3
Hey thanks to both of you for your replies.

As for Netscape 7.0, I am aware that WSDL is supported in Netscape
7.1(Mozilla 1.4), but making it work for Netscape 7.0 is a must for me
im afraid. I have read some articles on calling web service methods
from Netscape 7.0 with SOAP, but I get a "SOAPCall is undefined" error
when i try running the script. Basically in my Web Service (C#) i just
have a simple function:

[WebMethod]
public bool ReturnTrue()
{
return true;
}

and in my client side script i have something like:
var soapCall = new SOAPCall();
soapCall.transportURI = ..... etc.

but the error occurs on the top line of the script, which is the
initialization of the SOAPCall. Do I need any sort of plugin or
additional reference to make this work? i used this site for
reference, by the way:
http://devedge-temp.mozilla.org/view.../index_en.html

regards.

Jul 23 '05 #4


M B HONG 20 wrote:

As for Netscape 7.0, I am aware that WSDL is supported in Netscape
7.1(Mozilla 1.4), but making it work for Netscape 7.0 is a must for me
im afraid. I have read some articles on calling web service methods
from Netscape 7.0 with SOAP, but I get a "SOAPCall is undefined" error
when i try running the script. Basically in my Web Service (C#) i just
have a simple function:

[WebMethod]
public bool ReturnTrue()
{
return true;
}

and in my client side script i have something like:
var soapCall = new SOAPCall();
soapCall.transportURI = ..... etc.

but the error occurs on the top line of the script, which is the
initialization of the SOAPCall. Do I need any sort of plugin or
additional reference to make this work? i used this site for
reference, by the way:
http://devedge-temp.mozilla.org/view.../index_en.html


The error is odd, I have grabbed a Mozilla 1.0 build and tried new
SOAPCall() and that creates an object.
The user agent string is
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530
and Netscape 7.0 should be some 1.0.1 or 1.0.2 release and thus have
SOAPCall too.

--

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

Thanks for your reply. You are right, it does work in Netscape 7.0 and
I got the SOAP object to be created. This brings me to another
question though, now that it is working, I can't seem to get the web
service method called. I think there is something wrong with my
syntax. Like i said before, my web service looks like this:

[WebMethod]
public bool SayGoodBye()
{
return false;
}

and my client script looks like this so far:

var soapCall = new SOAPCall(); //which now works, by the way
soapCall.transportURI = "http://localhost/test/Service1.asmx";
soapCall.encode(0, "SayGoodBye", null, 0, null, null, null);
var result = soapCall.invoke();
alert (result.value);
but I keep getting "undefined" instead of "false". I'm pretty sure its
my encode line, can you please tell me what's wrong? The webmethod
does not take any parameters, so i am not sure what to put there (the
last 2 parameters of the encode method). Thanks in advance.

Regards.

Jul 23 '05 #6


M B HONG 20 wrote:

You are right, it does work in Netscape 7.0 and
I got the SOAP object to be created.
Fine, then we have a starting point to work something out.
However when I have tested the interoperability of Mozilla and .NET web
services some while ago I have unfortunately found that Mozilla is able
to understand the SOAP response of a .NET RPC style web service but that
..NET does not understand Mozilla's SOAP requests. But as your example
does not pass anything to the web service it should be possible to get
it to work with Mozilla (but as far as I know only if the service is RPC
style).
So you would need .NET C# code alike

[WebService(Namespace="http://example.com/2005/06/BoolService")]
[SoapRpcService]
public class TestService : WebService {
This brings me to another
question though, now that it is working, I can't seem to get the web
service method called. I think there is something wrong with my
syntax. Like i said before, my web service looks like this:

[WebMethod]
public bool SayGoodBye()
{
return false;
}

and my client script looks like this so far:

var soapCall = new SOAPCall(); //which now works, by the way
soapCall.transportURI = "http://localhost/test/Service1.asmx";
I think you also need to set the action URI e.g.
soapCall.actionURL = "http://example.com/2005/06/BoolService/SayGoodBye";
soapCall.encode(0, "SayGoodBye", null, 0, null, null, null);
That should be
soapCall.encode(
0,
"SayGoodBye"
"http://example.com/2005/06/BoolService",
0,
null,
0,
null
);
where the URL is the one defined for your web service.
var result = soapCall.invoke();
alert (result.value);


It is not that easy that the return value of the invoke call has a value
property. You should first check for an error e.g.
if (result.fault) {
alert(result.fault.faultString);
}
else {
var responseValues = result.getParameters(false, {});
alert(responseValues[0].value);
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #7
Martin - your continued help is greatly appreciated.

I have made some changes to my Web Service and client form to follow
your examples, but I'm afraid i am still getting "undefined" for the
values. My web service looks exactly like this, and is located in the
RemoteScripting folder inside of the wwwroot folder.

namespace RemoteScripting
{
[WebService(
Namespace="http://localhost/RemoteScripting/Service1",
Name="HelloWebService",
Description="This says hello/goodbye")]
//[SoapRpcService]
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
InitializeComponent();
}

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}

#endregion

[WebMethod]
public string SayHello(String strMyName)
{
return "Hello " + strMyName;
}

[WebMethod]
public bool SayGoodBye()
{
return false;
}
}
}

upon compile, the line "[SoapRpcService]" hits me back with an error,
saying "Namespace SoapRpcService could not be found".

and my client scriptblock looks like this:

<body onload="init();" MS_POSITIONING="GridLayout">
<SCRIPT language="JavaScript">
var soapCall = new SOAPCall();
soapCall.transportURI =
"http://localhost/RemoteScripting/Service1.asmx";
soapCall.actionURI =
"http://localhost/RemoteScripting/Service1/SayGoodBye";
soapCall.encode(0, "SayGoodBye",
"http://localhost/RemoteScripting/Service1", 0, null, 0, null);
var result = soapCall.invoke();
document.Form1.elements["TextBox2"].value = result.value;
document.Form1.elements["TextBox1"].value =
result.fault.faultString;
the result.fault.faultString is null, so I'm guessing there are no
errors with the call. However, the value is still "undefined", when it
should be "false". Do you see anything that is overtly wrong? thanks
again.

Charles.

Jul 23 '05 #8


M B HONG 20 wrote:

upon compile, the line "[SoapRpcService]" hits me back with an error,
saying "Namespace SoapRpcService could not be found".
It is in the .NET namespace
System.Web.Services.Protocols
so you need
using System.Web.Services.Protocols;
in your C# code.

var soapCall = new SOAPCall();
soapCall.transportURI =
"http://localhost/RemoteScripting/Service1.asmx";
soapCall.actionURI =
"http://localhost/RemoteScripting/Service1/SayGoodBye";
soapCall.encode(0, "SayGoodBye",
"http://localhost/RemoteScripting/Service1", 0, null, 0, null);
var result = soapCall.invoke();
document.Form1.elements["TextBox2"].value = result.value;


Where did you get the idea that there is a single value property? There
is none, I have already outlined what you need to do:
var responseValues = result.getParameters(false, {});
var firstValue = responseValues[0].value;

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #9
That did the trick. Thank you Martin, your continued help is greatly
appreciated.

Charles.

Jul 23 '05 #10

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

Similar topics

4
by: rbt | last post by:
How does one associate a "Description" with a Windows service written in Python? I've just started experimenting with Python services. Here's my code... copied straight from Mr. Hammond's "Python...
6
by: cs | last post by:
I noticed there is some .net services on my winxp. One or two mention the CLR. Does that mean that my .net apps/services wont run before those services start? I need to run my service as early on...
0
by: Diego F. | last post by:
I've been days with that. I'm trying to work with web services sending and returning objects, and the web service must store some objects. - My first try (the most obvious in my opinion) was to use...
26
by: Mr Newbie | last post by:
What do I need to run a web service on my PC ? I know I need the .NET Framework, but do I need IIS Running ?
3
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types...
7
by: Stu | last post by:
Hi, I have a web service which returns a record set and works well integrated with an asp dot net page. However if I decided to develop a unix app will i be able to read the dataset as it is...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
2
by: sdstraub | last post by:
I have created 5 services in my project, in the 1st service I set servicestorun = array of all 5 services, I have a project installer with 5 service installers, one for each service. I have code...
0
by: krishnaraju | last post by:
HI to all, please help me.its urgent requirement. my question is this is the wsdl file i got from our client.please see at bottom. when iam trying to access that webmethods iam getting...
1
by: Data Entry Outsourcing | last post by:
Data Entry plays vital role in every business area. Data Entry is one such aspects of any business that needs to be handled properly for expanding your business. Data Entry is one of the leading...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...

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.