WebMethod parameter ByRef

  • Thread starter Thread starter Franck
  • Start date Start date
F

Franck

Hi,
Got this C# WebService I must Use :
[WebMethod]
public double BackwardPerf(ref double[] pRet, double[] pValues)
{
FinanceLibMapperClass mapperLib = new UBPFinanceLibMapperClas();
System.Array pRetArray = (System.Array) pRet;
System.Array pValuesArray = (System.Array) pValues;
double res=mapperLib.BackwardPerf(ref pRetArray, ref pValuesArray);
//pRetArray is correctly filled
return res;
}

So, in my app, I try this :
Dim pRetVector() As Double
ReDim pRetVector(pValues.Rows.Count - 1)
oWsLibFin.AAMG_BackwardPerf(pRetVector, pValues)
'pRetVector = {(0,0,0.....)
Return pRetVector

If I make a break point in the Web Service when the doubleArray is
filled, I can see the values... But in the end, pRetVector is a All
Zero Values array...

The ByRef declaration does not seem to work.
Do I Miss something ?

Thks for help.
 
Ref value, especially array, often work badly.
I suggest you use DataSet instead.


Mauricio Pires said:
I have the same problem using dataset as parameter.
may someone help us?


Franck said:
Hi,
Got this C# WebService I must Use :
[WebMethod]
public double BackwardPerf(ref double[] pRet, double[] pValues)
{
FinanceLibMapperClass mapperLib = new UBPFinanceLibMapperClas();
System.Array pRetArray = (System.Array) pRet;
System.Array pValuesArray = (System.Array) pValues;
double res=mapperLib.BackwardPerf(ref pRetArray, ref pValuesArray);
//pRetArray is correctly filled
return res;
}

So, in my app, I try this :
Dim pRetVector() As Double
ReDim pRetVector(pValues.Rows.Count - 1)
oWsLibFin.AAMG_BackwardPerf(pRetVector, pValues)
'pRetVector = {(0,0,0.....)
Return pRetVector

If I make a break point in the Web Service when the doubleArray is
filled, I can see the values... But in the end, pRetVector is a All
Zero Values array...

The ByRef declaration does not seem to work.
Do I Miss something ?

Thks for help.
 
Back
Top