Customizing the Java CXF client

Customize the Java™ CXF client by updating the generated JAX-RS proxy Java class to ensure the correct behavior and the optimized processing in a z/TPF environment.

About this task

If you have field names in an OpenAPI descriptor that start with two or more uppercase letters, the Java CXF client behavior might be incorrect. To ensure the correct behavior for the Java CXF client, you can use Jackson annotations for the generated JAX-RS proxy Java class.

The following example shows a structure in the OpenAPI descriptor. A field name in the OpenAPI descriptor is UKY. The standard behavior of the Java CXF client might generate a wrong field name of uky.
updResponse": {
      "type":"object",
      "properties": {
        "rc":{"type":"integer"},
        "dbname":{"type":"string"},
        "msgtype":{"type":"string"},
        "cardnum":{"type":"string"},
        "partition":{"type":"integer"},
        "UKY":{"type":"integer"},
        "picType":{"type":"integer"},
      }
}
The structure is in the generated UpdResponse.java Java source file. In this file, you can find the definition and the getter method for the UKY field.
  @ApiModelProperty(value = "")
  private Integer UKY = null;
 
/**
   * Get UKY
   * @return UKY
  **/
  public Integer getUKY() {
    return UKY;
  }

Procedure

  1. To ensure the correct behavior, take the following action:

    In the generated Java source file, code the @JsonProperty annotation to identify the correct field name and code the @JsonIgnore annotation to hide the getter method. For example:

    @JsonProperty( value="UKY" )
      @ApiModelProperty(value = "")
      private Integer UKY = null;
    
    /**
       * Get UKY
       * @return UKY
      **/
    @JsonIgnore
      public Integer getUKY() {
        return UKY;
      }
  2. To ensure that the field generation order is compatible with the REST service interface, code the @JsonPropertyOrder annotation on the class definition.
    For example:
    @JsonPropertyOrder({ "rc", "dbname", "msgtype", "cardnum", "partition", "UKY", "picType"})
    
    public class UpdResponse  {
    
    ...
    
    }