Option Variable Web service Nav 2009R2

BeliasBelias Member Posts: 2,998
edited 2013-03-12 in NAV Three Tier
hi everyone, YES...i still work with NAV but i really have so little time to write to my favourite forum :(
I need your help: i've published a list page as web service and i specified some fields and a pair of variables..
-First question: will the variables be correctly evaluated in this list, as soon as i populate them in the onaftergetrecord field?
-Second question: my colleague is working on the web part that will consume the web service. He can see and use Mytextvariable, but he cannot see MyOptionVariable in the wsdl...is it normal or are we doing something wrong?
thanks in advance
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Comments

  • MarijnMarijn Member Posts: 69
    Can you be a bit more specific about your problem? A List Page and a Card Page do expose the very same bunch of typical CRUD (Create Update Delete) methods. It doesn't matter which one you expose because it will publish the very same methods based on the table the List or Card page is based on. (You can extend the CRUD methods of a page with those of a codeunit however if you want to). Assuming you are calling a Read method, then you can expect every normal field (no flowfields, blobs etc.) to be present in the response. You do not need to put any code in OnAfterGetRecord triggers. Regarding your second question: Only simple type parameters like text strings are to be used with webservices as input parameters, so exotic typical NAV parameters like options or recs cannot be used and will not be visible in a WSDL. If you want to expose these kind of functions, write a wrapper function around them to convert simple input strings to intergers, options, recs and so on.
  • BeliasBelias Member Posts: 2,998
    1. i mean that i have a pair of variables in my list that are shown to the user as additional columns (they are calculated values based on some other tables, and they cannot be flowfields). I am populating those variables in onaftergetrecord, so i am asking if they will be correctly shown into a web page.
    2. one of these variables are options. I wonder why i cannot see my option variable in the wsdl if i can see the "document type" field, for example.

    I WANT TO REMARK THIS: the option variable is not randomly put in my code and used for some calculation. It IS shown in the page as a column. It resembles a normal field, to the user...except it is not editable/filterable
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • MarijnMarijn Member Posts: 69
    Pages really only expose the CRUD methods and therefore they are an interface to the tables and fields. Only real database fields excluding blobs are exposed. Other variables and flowfields will not be exposed as a field because they are no field. If you can't insert, modify or delete your value, then it won't show up in the WSDL. You can create a codeunit which returns your desired value and expose that codeunit as a webservice. You can merge the methods of that codeunit with the CRUD methods of the page if you want to, but that is not neccesary. For performance reasons, you might want to cache the values in your application to reduce the number of webservices being called.
  • pawanppawanp Member Posts: 90
    edited 2013-03-12
    Belias wrote:
    1. i mean that i have a pair of variables in my list that are shown to the user as additional columns (they are calculated values based on some other tables, and they cannot be flowfields). I am populating those variables in onaftergetrecord, so i am asking if they will be correctly shown into a web page.
    Yes they are correctly shown in the webpage.
    Belias wrote:
    2. one of these variables are options. I wonder why i cannot see my option variable in the wsdl if i can see the "document type" field, for example.
    Unfortunately option variable niether shows up in the page object nor as a enum.
  • BeliasBelias Member Posts: 2,998
    :-k
    this is a chunck of wsdl:
    <xsd:simpleType name="PalmSerialNo_Fields">
    - <xsd:restriction base="xsd:string">
      <xsd:enumeration value="Code" /> 
      <xsd:enumeration value="Blocked" /> 
      <xsd:enumeration value="Item_No" /> 
      <xsd:enumeration value="ItemDescription" /> !!!!!!!!!!!!
      <xsd:enumeration value="Last_Inv_Reason_Code" /> 
      <xsd:enumeration value="Last_Entry_No" /> 
      <xsd:enumeration value="Last_Source_Type" /> 
      <xsd:enumeration value="Last_Source_Code" /> 
      <xsd:enumeration value="Posted_Series_No" /> 
      <xsd:enumeration value="Document_No" /> 
      <xsd:enumeration value="Location_Code" /> 
      <xsd:enumeration value="Responsibility_Center_Code" /> 
      <xsd:enumeration value="Vendor_Serial_No" /> 
      <xsd:enumeration value="Ship_to_Code" /> 
      <xsd:enumeration value="Ship_to_Patient" /> 
      <xsd:enumeration value="Patient_Code" /> 
      <xsd:enumeration value="Our_Property" /> 
      <xsd:enumeration value="Property_Type" /> 
      <xsd:enumeration value="Property_No" /> 
      <xsd:enumeration value="Certificate" /> 
      <xsd:enumeration value="Customer_Warranty_Date" /> 
      <xsd:enumeration value="Lot_No" /> 
      <xsd:enumeration value="Inventory_No" /> 
      <xsd:enumeration value="OTType" /> !!!!!!!!!!!!
    
    i marked a pair of values with "!"..these values are only variables, not fields...i agree with you that it's strange to expose such things, but it's just the beginning of this project and we're testing some things. The web developer can "consume" ItemDescription (i've asked him if he can show it up correctly), but cannot consume OTType field.
    EDIT: thanks pawanp.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.