Options

Logging in WebService with XMLport as parameter

MiguelOliveiraMiguelOliveira Member Posts: 13
edited 2011-06-02 in NAV Three Tier
Hi,

I have successfully created an NAV webservice with an XMLPORT as an input parameter.
I would like to have a logging logic but i'm having a few problems with that.

My codeunit Customer WS that is exposed as a Webservice is the following
ImportCustomer(CustImport : XMLport "WS ImportCustomer";VAR myCust : XMLport "WS ReturnCustomer") : Text[50]
CustImport.IMPORT;
BEGIN
  Cust.FINDFIRST();
  Cust.SETRANGE(Cust."No.",CustImport.GetCustomer);
  myCust.SETTABLEVIEW(Cust);
END;

cuMgtLogs.LogsMgmt;

In order for me to do a try catch scenario i would have to do the following
Codeunit Import Customer
ImportCustomer(CustImport : XMLport "WS ImportCustomer";VAR myCust : XMLport "WS ReturnCustomer") : Text[50]
ProcessCust.SetParam(CustImport,myCust);
IF NOT ProcessCust.RUN THEN
  LogMgt(GETLASTERRORMSG);


Codeunit Process Customer
SetParam(NewCustImport : XMLport "WS ImportCustomer";VAR NewmyCust : XMLport "WS ReturnCustomer")
CustImport := NewCustImport;
myCust := NewmyCust;


OnRun()
CustImport.IMPORT;
BEGIN
  Cust.FINDFIRST();
  Cust.SETRANGE(Cust."No.",CustImport.GetCustomer);
  myCust.SETTABLEVIEW(Cust);
END;

My Problem with the second scenario is that i can't do what i'm trying to the in the SetParam Function because NAV won't allow me.
I've tried using Instreams and Outstreams but with no success because the InStream in the CustImport is actually the input of the WebService.

Does anyone have any idea of how i could resolve this?

Thanks in Advance
Best Regards,
Miguel Oliveira

Comments

  • Options
    kinekine Member Posts: 12,562
    Try to define the first param in the SetParams as VAR.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    MiguelOliveiraMiguelOliveira Member Posts: 13
    Hi Kamil,

    Thanks for your reply but the problem begins in the line "CustImport := NewCustImport" since these are XMLPort variables.
    NAV gives me an error "Assignment is not allowed for this variable."

    I wanted to copy the content of one variable XMLport to another but i have not been sucessfull.
  • Options
    kinekine Member Posts: 12,562
    You cannot, it is not possible to do it in this way. You can try to use the Variant data type, but I think that it will not work for XMLPort...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    MiguelOliveiraMiguelOliveira Member Posts: 13
    I was afraid that was the case.

    I guess this means that it is not possible to use XMLPorts as a WebService parameter and have a Logging logic in NAV.

    I guess i'll try to find another solution.

    Thank you for your help.
  • Options
    MaciMaci Member Posts: 65
    Hi Miguel

    Do you find another solution for this case? I think we have the same!

    Thanks
Sign In or Register to comment.