Forum Discussion

Former_Member's avatar
Former_Member
Accelerator III
9 years ago

Creating java classes using AML schema

Hi all , I want to create an application in Java which connects to aras innovator and fetch data from it . For that I want to create  java classes for  business objects  like Item , Relationship ,etc using aras aml schema using Jaxb . But there is no fixed aml schema available for it . So how can I create classes to store fetched data and metadata of business objects in aras using Java ? Is there any other way to integrate it  ? Thanks for help !

5 Replies

  •   Hi Eli , Thanks for reply . As you mentioned above I have used the SOAP request to send the request to server . And I got the response in the form of SOAP message . But I cannot always use that XML format for further processing . I want that response to be stored in some java objects so that I can use it easily . So I searched for it and I found that Jaxb can convert a schema to its equivalent java classes but there was no fixed schema definition for AML . So is there any way so that I can get AML schema from server or some method to convert that response to its java objects ? Thanks for help ! Ketan .
  • eli_donahue's avatar
    eli_donahue
    Community Manager
    Hi Ketan, An AML response will always have the following general structure: The exact structure of the response depends on your data model and the query criteria sent to the server. However, if you know the structure of your data model in Aras and you know what data you'll need in your Java application, you can get a consistent AML result by tweaking your AML query (use the select attribute to retrieve only the properties you need) and use that as your "schema" for Jaxb. If you can't achieve the XML structure you need through modifying the AML query alone, you could also use XPATH/XSLT to transform the AML result into a structure that is more compatible with Jaxb. Hope that helps. Eli
    Eli Donahue Aras Labs Software Engineer
  • Hi Eli, Thanks for reply ! It is very helpful . -Ketan .  
  • The Aras AML schema is documented in the "XSLT Report Tool Users Guide" on page 19. I've extracted it from the document and pasted it below: <xsd:schema xmlns:xsd="">www.w3.org/.../XMLSchema"> <xsd:complexType name="Item"> <xsd:all> <!-- Any user elements defined by the ItemType for the item --> <xsd:complexType name="Relationships" minOccurs="0" maxOccurs="1"> <xsd:all> <xsd:element name="Item" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:all> <!-- Any user elements defined by the ItemType for the item --> <xsd:attribute name="id" type="xsd:ID" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="typeID" type="xsd:IDREF" /> <xsd:attribute name="action" type="xsd:string" /> <xsd:attribute name="sort_order" type="xsd:integer" /> </xsd:all> </xsd:complexType> </xsd:element> </xsd:all> </xsd:complexType> </xsd:all> <xsd:attribute name="id" type="xsd:ID" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="typeID" type="xsd:IDREF" /> <xsd:attribute name="action" type="xsd:string" /> <xsd:attribute name="select" type="xsd:string" /> <xsd:attribute name="order_by" type="xsd:integer" /> <xsd:union> <xsd:attributeGroup> <xsd:attribute name="pagesize" type="xsd:integer" /> <xsd:attribute name="page" type="xsd:integer" /> </xsd:attributeGroup> <xsd:attributeGroup> <xsd:attribute name="levels" type="xsd:integer" /> <xsd:attribute name="config_path" type="xsd:string" /> </xsd:attributeGroup> </xsd:union> </xsd:complexType> </xsd:schema>