WebMethod parameter ByRef

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Franck

    #1

    WebMethod parameter ByRef

    Hi,
    Got this C# WebService I must Use :
    [WebMethod]
    public double BackwardPerf(re f double[] pRet, double[] pValues)
    {
    FinanceLibMappe rClass mapperLib = new UBPFinanceLibMa pperClas();
    System.Array pRetArray = (System.Array) pRet;
    System.Array pValuesArray = (System.Array) pValues;
    double res=mapperLib.B ackwardPerf(ref pRetArray, ref pValuesArray);
    //pRetArray is correctly filled
    return res;
    }

    So, in my app, I try this :
    Dim pRetVector() As Double
    ReDim pRetVector(pVal ues.Rows.Count - 1)
    oWsLibFin.AAMG_ BackwardPerf(pR etVector, 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.

  • Mauricio Pires

    #2
    RE: WebMethod parameter ByRef

    I have the same problem using dataset as parameter.
    may someone help us?


    "Franck" wrote:
    [color=blue]
    > Hi,
    > Got this C# WebService I must Use :
    > [WebMethod]
    > public double BackwardPerf(re f double[] pRet, double[] pValues)
    > {
    > FinanceLibMappe rClass mapperLib = new UBPFinanceLibMa pperClas();
    > System.Array pRetArray = (System.Array) pRet;
    > System.Array pValuesArray = (System.Array) pValues;
    > double res=mapperLib.B ackwardPerf(ref pRetArray, ref pValuesArray);
    > //pRetArray is correctly filled
    > return res;
    > }
    >
    > So, in my app, I try this :
    > Dim pRetVector() As Double
    > ReDim pRetVector(pVal ues.Rows.Count - 1)
    > oWsLibFin.AAMG_ BackwardPerf(pR etVector, 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.
    >
    >[/color]

    Comment

    • Allen St.Clair

      #3
      Re: WebMethod parameter ByRef

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


      "Mauricio Pires" <MauricioPires@ discussions.mic rosoft.com> wrote in message
      news:D0BF67C5-8BF9-4977-9BBF-5C40A1A2B771@mi crosoft.com...[color=blue]
      >I have the same problem using dataset as parameter.
      > may someone help us?
      >
      >
      > "Franck" wrote:
      >[color=green]
      >> Hi,
      >> Got this C# WebService I must Use :
      >> [WebMethod]
      >> public double BackwardPerf(re f double[] pRet, double[] pValues)
      >> {
      >> FinanceLibMappe rClass mapperLib = new UBPFinanceLibMa pperClas();
      >> System.Array pRetArray = (System.Array) pRet;
      >> System.Array pValuesArray = (System.Array) pValues;
      >> double res=mapperLib.B ackwardPerf(ref pRetArray, ref pValuesArray);
      >> //pRetArray is correctly filled
      >> return res;
      >> }
      >>
      >> So, in my app, I try this :
      >> Dim pRetVector() As Double
      >> ReDim pRetVector(pVal ues.Rows.Count - 1)
      >> oWsLibFin.AAMG_ BackwardPerf(pR etVector, 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.
      >>
      >>[/color][/color]


      Comment

      Working...