Example - Jargon Service Java API

In this example, several data items are loaded into the JargonRequest object, the service is called, and the descriptions in the response are printed out.

public void jargonService() throws Exception
    {
	   //this uses the jargon capability
        loginEnv.getRequiredCapabilities().add("jargon");
 
  //create the request object, seeding it with a default system code of 01
        JargonRequest jargonRequest = new JargonRequest(loginEnv, "01"); // with default system code
 
	  //fill the list in the request with data items        
    jargonRequest.addDataItem("AN8");  //uses default system code
    jargonRequest.addDataItem("MCU","04");  //use system code 04 for this one
    jargonRequest.addDataItem("PAN8");
    jargonRequest.addDataItem("ITM","55");
       
 
        //call the jargon service
        String response = JDERestServiceProvider.jdeRestServiceCall(loginEnv, jargonRequest, JDERestServiceProvider.POST_METHOD, JDERestServiceProvider.JARGON_SERVICE);
 
        
        //response can be serialized to JargonResponse class
        JargonResponse jargonResponse = loginEnv.getObjectMapper().readValue(response, JargonResponse.class);
 
 
        //print the response
        if(jargonResponse != null)
        {
            if(jargonResponse.getRequestedItems() != null && jargonResponse.getRequestedItems().size() >0 )
            {
                for(JargonResponseItem item: jargonResponse.getRequestedItems())
                {
                    System.out.println("Item " + item.getSzDict() + " " + item.getRowDescription());
                }
            }
        }
    }