C# Webservice
Jay Altec
-
mefm233 -
mefm233 -
Bonjour,
Je developpe actuellement un WebService en C# et je rencontre un problème.
Mon objet de retour fonctionne bien en tant qu'objet simple, mais dès que je fais un tableau de cet objet, ça ne marche plus...
Mon objet :
[Serializable]
public class BRequest
{
public string bDate;
public string bPlace;
public string bGuests;
public string bStyle;
public int bId;
public int bStatus;
}
Mon code tableau :
[WebMethod]
public BRequest[] GetPending()
{
BRequest[] brq = new BRequest[2];
brq[0].bDate = "TEST";
brq[0].bPlace = "TESTPLACE";
brq[0].bGuests = "TESTGUESTS";
brq[0].bStyle = "TESTSTYLE";
brq[0].bId = 2;
brq[0].bStatus = 0;
brq[1].bDate = "TEST";
brq[1].bPlace = "TESTPLACE";
brq[1].bGuests = "TESTGUESTS";
brq[1].bStyle = "TESTSTYLE";
brq[1].bId = 2;
brq[1].bStatus = 0;
return brq;
}
Et cela me retourne dans le cas du tableau :
System.NullReferenceException: Object reference not set to an instance of an object.
at bookings.GetPending()
Pouvez vous m'aider svp ? Je suis un peu perdu je dois dire ..
Merci beaucoup.
Jay
Je developpe actuellement un WebService en C# et je rencontre un problème.
Mon objet de retour fonctionne bien en tant qu'objet simple, mais dès que je fais un tableau de cet objet, ça ne marche plus...
Mon objet :
[Serializable]
public class BRequest
{
public string bDate;
public string bPlace;
public string bGuests;
public string bStyle;
public int bId;
public int bStatus;
}
Mon code tableau :
[WebMethod]
public BRequest[] GetPending()
{
BRequest[] brq = new BRequest[2];
brq[0].bDate = "TEST";
brq[0].bPlace = "TESTPLACE";
brq[0].bGuests = "TESTGUESTS";
brq[0].bStyle = "TESTSTYLE";
brq[0].bId = 2;
brq[0].bStatus = 0;
brq[1].bDate = "TEST";
brq[1].bPlace = "TESTPLACE";
brq[1].bGuests = "TESTGUESTS";
brq[1].bStyle = "TESTSTYLE";
brq[1].bId = 2;
brq[1].bStatus = 0;
return brq;
}
Et cela me retourne dans le cas du tableau :
System.NullReferenceException: Object reference not set to an instance of an object.
at bookings.GetPending()
Pouvez vous m'aider svp ? Je suis un peu perdu je dois dire ..
Merci beaucoup.
Jay