JSON Array Serialization Issue

Apache CXF Bug (occurs only on JSON response formats)

When requesting JSON-formatted hotel list responses, array elements such as HotelSummary and RoomRateDetails will not serialize correctly if they contain only one hotel/room. In these cases, the arrays will instead return as single instances instead of a hash table, which can cause issues with certain coding environments.

Example:

Handling JSON array serialization issues

Posted by Apache: http://cxf.apache.org/docs/jax-rs-data-bindings.html

There is a well known problem in the JSON community which shows itself in the wrong serialization of List objects containing a single value only. To work around this issue, one needs to enable a 'serializeAsArray' feature on a JSONProvider, with the additional option of specifying the individual fields which needs to be processed accordingly using an 'arrayKeys' property. 

Note that 'serializeAsArray' and 'arrayKeys' can be combined to produce so called natural convention sequences.

One example workaround:

<util:list id="jsonKeys">
  <value>HotelSummary</value>
</util:list>

<bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.JSONProvider">
  <property name="serializeAsArray" value="true" />
  <property name="arrayKeys" ref="jsonKeys" />
</bean>

Your own framework may require a different code. This one is provided only as an example.

Unrecoverable errors or authentication issues with booking requests

Some technologies, including PHP and Java, users have experienced issues passing properly-formed booking requests if the correct content-type value is missing from the request.

If you have troubleshot and verified your booking request URL structure and still receive unrecoverable errors, try setting the following in your HTTP headers:

Content-type: application/x-www-form-urlencoded Accept: application/xml

Also, remember that using &_type=json or &_type=xml only sets the response format. EAN only accepts XML content. 

For more information on Content Type review the Reservation Request outline.

Java Manual Conversion Code

Manual conversion example code from a passed 8859-1 to UTF-8.

private static String convertEncoding(String value) {
        if (value != null) {
            try {
                return new String(value.getBytes("8859_1"), "UTF-8");

            } catch (UnsupportedEncodingException e) {
                LOG.error("Unsupported Encoding.", e);
            }
        }

        return value;
    }

Axis Users

Axis Bug

There is a known bug in some versions of Axis that inaccurately generates source files which are not correct by changing some data types "(integer" instead of "int"), among other issues. These inaccuracies cause the source file to err when attempting to compile, or prevents the source file from interfacing with EAN Web Services successfully.

You may correct the data types in the source file BEFORE compiling, or you may update to a later Axis version that fixed the bug by going to http://axis.apache.org/axis/

You may use any version which works as expected for your application. We are not able to assist with server applications or server issues.

Axis 1.4 Bug

There is a known bug in version 1.4 of Axis to create nillable definitions even when min occurrence=0 and nillable=false is specified.

These inaccuracies cause requests to err when attempting to interface with EAN Web Services successfully.

Visit http://axis.apache.org/axis/ for advice on fixing this problem.

You may use any version which works as expected for your application. We are not able to assist with server applications or server issues.

.NET Users

.NET Knowledge base

By default, the .NET Framework has a maximum connection=2 in machine.config. This limits remote web calls to 2 connections per worker process at a time. If you experience long response times or your web service calls times out, you may want to look into this detail in your server set up.

CS.NET / MS WSDL 2.0+ Issues

We've received some reports of affiliates experiencing issues when generating the HotelFunctions.cs file for C#. This appears to be under the WSDL 2.0 or above. WSDL 1.1 and below do not create additional elements upon source file generation.

It appears this procedure creates it's own element called hotelIdSpecified along with other nillable elements and is defaulted to false.

  • This causes the hotel ID to be omitted from the request (or any other item that it generates this "specified" item), therefore an error results indicating the hotel ID cannot be resolved.
  • You must manually change this in your code to true in order for C# to send the hotel ID (or any other items that create the specified element) which may be required to receive availability results.
  • hotelIdSpecified (or any other "specified" items) are not part of the WSDL or the Web Services Request Objects and therefore you will not find this element in the documentation.
  • We are not seeing this issue with VB.NET or with MS WSDL 1.1 and the new element is not created when generating HotelFunctions.vb.