C
Cesar
Hello,
I have an asp.net ajax enabled web site that has one aspx page to call a web
service method via the script manager using the service reference.
My problem is that it's only works if my web serivce resides on the same
project; otherwise it doesn't. It has nothing to do with any misconfuguration
(e.g not having tested the "/js" on the webservice's url). The web service
method only returns the result of (A * B).
When I invoke the web service I get the following message: The server method
'Test' failed
This part of the client code of the aspx page:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference
Path="http://localhost:1064/AJAXWebServiceTest/MyWebService.asmx" />
</Services>
</asp:ScriptManager>
A = <input type="text" id="a" /><br />
B = <input type="text" id="b" /><br /><br />
C = <span id="c"></span><br /><br />
<input type="button" value="Get Data" onclick="GetMyData();" />
Now the javascript code ...
<script language="javascript">
function Resultado()
{
var myValue1 = parseInt(document.getElementById("a").value);
var myValue2 = parseInt(document.getElementById("b").value);
//
// Web service call: ajax (WebService = class name)
//
WebService.Test(myValue1,myValue2,callComplete,callError);
}
function callComplete(result)
{
document.getElementById("c").innerHTML = result;
}
function callError(result)
{
document.getElementById("c").innerHTML = "Something went wrong: <br/>1)
" + result.get_exceptionType() + "<br/>2) " + result.get_message() + "<br/>3)
" + result.get_stackTrace();
}
</script>
Please remember that if the path of the ServiceReference is set to
"MyWebService.asmx" it works perfectly but if it's
"http://localhost:1064/AJAXWebServiceTest/MyWebService.asmx" it doesn't
Any ideas?
Thanks in advance,
Cesar
I have an asp.net ajax enabled web site that has one aspx page to call a web
service method via the script manager using the service reference.
My problem is that it's only works if my web serivce resides on the same
project; otherwise it doesn't. It has nothing to do with any misconfuguration
(e.g not having tested the "/js" on the webservice's url). The web service
method only returns the result of (A * B).
When I invoke the web service I get the following message: The server method
'Test' failed
This part of the client code of the aspx page:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference
Path="http://localhost:1064/AJAXWebServiceTest/MyWebService.asmx" />
</Services>
</asp:ScriptManager>
A = <input type="text" id="a" /><br />
B = <input type="text" id="b" /><br /><br />
C = <span id="c"></span><br /><br />
<input type="button" value="Get Data" onclick="GetMyData();" />
Now the javascript code ...
<script language="javascript">
function Resultado()
{
var myValue1 = parseInt(document.getElementById("a").value);
var myValue2 = parseInt(document.getElementById("b").value);
//
// Web service call: ajax (WebService = class name)
//
WebService.Test(myValue1,myValue2,callComplete,callError);
}
function callComplete(result)
{
document.getElementById("c").innerHTML = result;
}
function callError(result)
{
document.getElementById("c").innerHTML = "Something went wrong: <br/>1)
" + result.get_exceptionType() + "<br/>2) " + result.get_message() + "<br/>3)
" + result.get_stackTrace();
}
</script>
Please remember that if the path of the ServiceReference is set to
"MyWebService.asmx" it works perfectly but if it's
"http://localhost:1064/AJAXWebServiceTest/MyWebService.asmx" it doesn't
Any ideas?
Thanks in advance,
Cesar