I was able to successfully set this up in my development environment by adding the web services to the same project as my client pages. I am now trying to connect to a different web services outside of my project that is being hosted in IIS.
If i open a browser and type in the url for the .svc file everything looks fine, I can even append the \js and the proxy code is generated. However on my client side I get erros in my javascript code "object doesn't support this property or method" Below I have pasted my javascript, scriptmanager, interface class and web services class. Can someone help me narrow down where my problem is? If so I would greatly appreciate it.
--Javascript:
<script type="text/javascript" language="javascript">function test()
{
ret = BWWebXChangeWCF.TestLibrary(OnComplete, OnTimeOut, OnError);
return(true);
}
function OnComplete(args)
{
alert(args);
}
function OnTimeOut(args)
{
alert("Service call timed out.");
}
function OnError(args)
{
alert("Error calling service method");
}
function Button2_onclick() {
test();
}
-- Script Manager:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="http://denqasoweb1/BWWebXChangeWCF/BWWebXChangeWCF.svc" />
</Services>
<Scripts>
<asp:ScriptReference Path="http://denqasoweb1/BWWebXChangeWCF/BWWebXChangeWCF.cs" />
</Scripts>
</asp:ScriptManager>
-- Interface class:
namespace BWWebXChangeWCF
{
[ServiceContract(Namespace = "")]
public interface IBWWebXChangeWCF
{
[OperationContract]
string TestLibrary();
}
-- Here is web service class:
namespace BWWebXChangeWCF
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[System.Web.Script.Services.
ScriptService()]
public class BWWebXChangeWCF : IBWWebXChangeWCF
{
private string DBITSSQLServer = "";
private string SSACustConnectString = "";private string SSADefsConnectString = "";
private string SSASaleConnectString = "";private string SSAWebSaleConnectString = "";
private string IntegratedDBConnectString = "";private string BWLoginConnectString = "";
private EventLog _evtLog = null;private ssiSQL.ssiSQLDB ssiSQLDB = new ssiSQL.ssiSQLDB();
private long iCompanyID = 0, iLogID = 0;
//localConfig will get populated as long as you call ValidateUserprivate ssiLocalConfig.ssiLocalConfigns localConfig;
private ssiMasterConfig.ssiMasterConfigns masterConfig;private long ssiCorpID = 0; public BWWebXChangeWCF()
{
try
{
ssiSQLDB.DB.SQLWorkstationName = Environment.MachineName;
ssiSQLDB.DB.SQLApplicationName =
"bwWebXChangeWCF";ServerConfig.BwConfig bw = new ServerConfig.BwConfig("SFA");
ssiSQLDB.DB.SQLUserName = bw.GetConfigSetting(
"sUserName", "");ssiSQLDB.DB.SQLUserPassword = bw.GetConfigSetting("sPassword", "");BWLoginConnectString = bw.GetServerConnectString().Replace("BrandwiseOperations", "BrandwiseLogin");
ssiSQLDB.DB.BWSQLServerName = bw.sBWLoginServerName;
DBITSSQLServer = bw.GetConfigSetting(
"sDBITSServerName", "");if (DBITSSQLServer == "")
{
Exception ex = new Exception("DBITS SQL Name not set in Application Module Settings");throw ex;
}
bw =
new ServerConfig.BwConfig("Brandwise System");SSACustConnectString = bw.GetConfigSetting("SSACustConnectString", "");
SSADefsConnectString = bw.GetConfigSetting(
"SSADefsConnectString", "");SSASaleConnectString = bw.GetConfigSetting("SSASaleConnectString", "");
SSAWebSaleConnectString = bw.GetConfigSetting(
"SSAWebSaleConnectString", "");localConfig = new ssiLocalConfig.ssiLocalConfigns(this.ssiSQLDB);masterConfig = new ssiMasterConfig.ssiMasterConfigns(ssiSQLDB);
}
catch
{
ssiSQLDB = null;throw;
}
}
public void Dispose()
{
try
{
ssiSQLDB.DB.CloseAll();
}
catch { }ssiSQLDB = null;
}
public string TestLibrary()
{
return "HELLO WORLD";
}