Saturday, March 24, 2012

my web service call works from one page, not from the other.

have a user control that uses Atlas to call a web service. I drop
this control on a page in the root directory and it works with no
problem. I then add the control to another control, which is on
another page and it will not work. It does not seem to know what the
webService is.

My web service is in the same project and the ascx control and is named
meterCommunication.asmx in a folder called webService.

The control is a button ond onClick it callas a javascript function
that has the following line for calling the web service:
meterCommunication.sendMessage(meterID, commType, _onRequestComplete);

The error that I get is a javascript error that says:
meterCommunication is undefined

I can't figure out what is different between the two pages. Since this
is on a user control they should be identical.

How does the javascript know what meterCommunication is?
I don't know enough about this to troubleshoot the problem.

You need to make sure that you import the web service proxy, either in your page or in the user control. This is done using:
<scriptsrc="/yourapp/subdir/YourService.asmx/js"type="text/javascript"></script>
Maybe you have that only on the page that works?

No comments:

Post a Comment