I am new to c# and web services… Normally i use python for a long time…
I need to wirete a web service that will be run on IIS, local debugging was successful, i deploy it to my local test server but since that is ona another computer, i could not test it completely via a web browser…
When i try to access it iwth suds (python), my first test function Hello World runs correctly, that shows me my serice is accessible…
but when i try to call a service funton that accepts a parameter and return a custon defined data type, my service simply returns object reference not set to an instance of an object
As i said, i am new to c# and web services… So i could not spot my mistake 🙁
public class Balance{
private decimal _currentBalance;
public decimal currentBalance
{
get { return _currentBalance; }
set { _currentBalance = value; }
}
}
public class Service1 : System.Web.Services.WebService
{
private string _deviceId;
public string deviceId
{
get { return _deviceId; }
set { _deviceId = value; }
}
CrAc conn;
CResult connResult;
private void connectToServer()
{
conn= new CrAc();
connResult= conn.Connect(deviceId);
}
private bool connectionControl()
{
return connResult.CRCStatus;
}
[WebMethod(Description="asdf")]
public Balance checkBalance(string deviceId) {
Balance balance = new balance {currentBalance= 0.00m};
this.deviceId = deviceId;
connectToServer();
if (connectionControl())
{
XResult askBalance = conn.someFunc(deviceId);
balance.currentBalance = askBalance.availableBalance;
}
return balance;
}
}
What am i missing?
Finally, we solve the problem…
I was using a DLL that i got from api provider, which has some control function for cpu and network device id’s. My development machine was a win7, but on the test server, we have virtual win7 that runs on virtual box… Since virtual Operating systems do not have real cpu or network IDs’, api DLL fails on a virtual operating system,but runs perfectly on a real machine…