Reputation: 2413
hi when I invoke my web service It returns me :
<?xml version="1.0" encoding="UTF-8"?>
-<ArrayOfAnyType xmlns="http://localhost:5669/TAWebService.asmx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
<anyType xsi:nil="true"/>
</ArrayOfAnyType>
any idea what could be wrong ? and when I call it from my winapp It returns null ! but in the website that I have developed the webservice It works correct and returns me the object !
here is the linqtosql query I use to retrieve object :
[WebMethod]
public Object[] getPersonnel(string hashCode)
{
Personnel personnel = new Personnel();
Object[] objReturn = new Object[10];
try
{
db = new TimeAttendanceDataBaseDataContext();
personnel = db.Personnels.FirstOrDefault(x => x.HashRecord == hashCode.Substring(0,10));
objReturn[0] = personnel.ID;
objReturn[1] = personnel.UserName;
objReturn[2] = personnel.Password;
objReturn[3] = personnel.FirstName;
objReturn[4] = personnel.LastName;
objReturn[5] = personnel.Mobile;
objReturn[6] = personnel.Email;
objReturn[7] = personnel.HashRecord;
objReturn[8] = personnel.AccessLevel;
objReturn[9] = personnel.PersonnelCode;
}
catch
{
objReturn[0] = null;
objReturn[1] = null;
objReturn[2] = null;
objReturn[3] = null;
objReturn[4] = null;
objReturn[5] = null;
objReturn[6] = null;
objReturn[7] = null;
objReturn[8] = null;
objReturn[9] = null;
}
return objReturn;
}
Upvotes: 0
Views: 2038
Reputation: 2413
I got the answear , the problem was that I had to change my apppool to local system in iis and the I could login to the webservice through my other applications
Upvotes: 0
Reputation: 68400
An exception is happening inside your try
block. Set a breakpoint there an debug the code to see what's wrong.
Maybe hashcode
is null or have a length lower than 10? or db.Personnels.FirstOrDefault(...)
is returning null
?
As a side note, it would be good if you implement some logging logic so you can troubleshoot more easily in live environment. Log4net is a good option for this
Upvotes: 2