Help in accessing a Web service

N

Nestor

Hello all,

I'm begining in the web services world and I've reading about how to
invoke them using javascript from Mozilla browser (version 2.0 in my
case).

I found a very interesting example here:
http://www.mozilla.org/projects/webservices/examples/babelfish-wsdl/index.html

The problem I have is this: When I try to adapt the invokation on the
example above by using the proper parameters I don't get the desired
output (in fact I don't get any output).

I have to invoke the service located at:
http://193.146.58.138:8080/axis/WS6Sep.jws . The WSDL file is here:
http://193.146.58.138:8080/axis/WS6Sep.jws?wsdl

In order to create the service request I copied the main babelfish
example page and I adapted the javascript file called in the main page,
which now looks like this (the main page is the same in my call):

var proxy = null;

var wsdl_uri = "http://193.146.58.138:8080/axis/WS6Sep.jws?wsdl";

//Aqui se llama a la traduccion

function Translate (aValue)

{

if (!proxy) {
alert("creating proxy");

var listener = {

onLoad: function (aProxy)

{

proxy = aProxy;

proxy.setListener(listener);

requestTranslation(aValue);

},



onError: function (aError)

{

alert(aError);

},



getURLCallback : function (aTranslatedValue)

{

document.getElementById("results").innerHTML=aTranslatedValue;


}

};

createProxy(listener);

}

else {
alert("I request the service");

requestTranslation(aValue);

}

}


//here I create the listener

function createProxy(aCreationListener)

{
alert ("here it begins the funcion that creates the proxy");

try {

var factory = new WebServiceProxyFactory();

factory.createProxyAsync(wsdl_uri, "WS6Sep", "", true,
aCreationListener);
alert("CORRECT: the proxy has been created succesfully");

}

catch (ex) {
alert("I have an error");

alert(ex);
alert("the proxy hasn't been created");

}
alert("CREATE proxy function ends here");

}


//Here I've to send the parameters to the service
//OLD babel fish function has been comented and copied below
/* function requestTranslation (value)

{

if (proxy) {

var parambabel="en_pt";

if (document.forms[1].optionto[0].checked) parambabel="en_pt";

if (document.forms[1].optionto[1].checked) parambabel="en_fr";

if (document.forms[1].optionto[2].checked) parambabel="en_de";

proxy.BabelFish(parambabel, value);

}

else {

alert("Error: Proxy set up not complete!");

}

}*/



function requestTranslation (value)
{
alert ("I send the request");
if (proxy) {
alert("proxy ok, sending request");
// var val = proxy.getURL(value);//value =Competency
var val = proxy.getURL("Competency");//value =Competency
alert("proxy ok, the response has been received");
}
else {
alert("Error: Proxy set up not complete!");
}
}

The value "Competency" is used because it is one of the few that are
available at the moment. ( in the future I'll have to receive it from
a form so I didn't deleted the code)

Do you know how can I solve my problem and get the correct output?
(which, I think, should look like an URL)

I will thank you very much any idea you may have because I have to call
the service as soon as possible and I don't know what else I can do in
order to do it.

Thanks a lot in advance.
Néstor
 
D

Daz

Nestor said:
Hello all,

I'm begining in the web services world and I've reading about how to
invoke them using javascript from Mozilla browser (version 2.0 in my
case).

I found a very interesting example here:
http://www.mozilla.org/projects/webservices/examples/babelfish-wsdl/index..html

The problem I have is this: When I try to adapt the invokation on the
example above by using the proper parameters I don't get the desired
output (in fact I don't get any output).

I have to invoke the service located at:
http://193.146.58.138:8080/axis/WS6Sep.jws . The WSDL file is here:
http://193.146.58.138:8080/axis/WS6Sep.jws?wsdl

In order to create the service request I copied the main babelfish

Your question seems somewhat complex, and comes across as saying that
'it's broken, how can I fix it?'

I believe I speak for the majority when I say that asking people for
help debugging an entire project might get you ignored. Instead, it
might pay off to try and debug it yourself with a JavaScript console
(which comes included in the latest version of Firefox, available from
www.getfirefox.com), and see what errors you get (if any), and then try
to fix it that way. If you are stuck, by all means, post the error(s)
here, and I am sure people will be happy to help you. However, if there
are no JavaScript errors, then your problem is not JavaScript related,
and is therefore off-topic.

Sorry I couldn't be of more assistance, and good luck with the
debugging. :)

Best regards.

Daz.
example page and I adapted the javascript file called in the main page,
which now looks like this (the main page is the same in my call):

var proxy = null;

var wsdl_uri = "http://193.146.58.138:8080/axis/WS6Sep.jws?wsdl";

//Aqui se llama a la traduccion

function Translate (aValue)

{

if (!proxy) {
alert("creating proxy");

var listener = {

onLoad: function (aProxy)

{

proxy = aProxy;

proxy.setListener(listener);

requestTranslation(aValue);

},



onError: function (aError)

{

alert(aError);

},



getURLCallback : function (aTranslatedValue)

{

document.getElementById("results").innerHTML=aTranslatedValue;


}

};

createProxy(listener);

}

else {
alert("I request the service");

requestTranslation(aValue);

}

}


//here I create the listener

function createProxy(aCreationListener)

{
alert ("here it begins the funcion that creates the proxy");

try {

var factory = new WebServiceProxyFactory();

factory.createProxyAsync(wsdl_uri, "WS6Sep", "", true,
aCreationListener);
alert("CORRECT: the proxy has been created succesfully");

}

catch (ex) {
alert("I have an error");

alert(ex);
alert("the proxy hasn't been created");

}
alert("CREATE proxy function ends here");

}


//Here I've to send the parameters to the service
//OLD babel fish function has been comented and copied below
/* function requestTranslation (value)

{

if (proxy) {

var parambabel="en_pt";

if (document.forms[1].optionto[0].checked) parambabel="en_pt";

if (document.forms[1].optionto[1].checked) parambabel="en_fr";

if (document.forms[1].optionto[2].checked) parambabel="en_de";

proxy.BabelFish(parambabel, value);

}

else {

alert("Error: Proxy set up not complete!");

}

}*/



function requestTranslation (value)
{
alert ("I send the request");
if (proxy) {
alert("proxy ok, sending request");
// var val = proxy.getURL(value);//value =Competency
var val = proxy.getURL("Competency");//value =Competency
alert("proxy ok, the response has been received");
}
else {
alert("Error: Proxy set up not complete!");
}
}

The value "Competency" is used because it is one of the few that are
available at the moment. ( in the future I'll have to receive it from
a form so I didn't deleted the code)

Do you know how can I solve my problem and get the correct output?
(which, I think, should look like an URL)

I will thank you very much any idea you may have because I have to call
the service as soon as possible and I don't know what else I can do in
order to do it.

Thanks a lot in advance.
Néstor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top