1 General Overview
The document provides an explanation and description of each of the exposed functions available in OHCWebServices and is used as the Technical Reference by third-party vendors who wish to develop and integrate their applications with the Oracle Hospitality Cruise Shipboard Property Management System (SPMS).
All of the web messages used here are based on:
-
Extensible Markup Language (XML) format,
-
JavaScript Object Notation (JSON) or
-
JSON with Padding (JSONP).
The examples provided here are based on Microsoft Visual Studio 2008. Accessing the web service through other programming language is possible and at your disposition. Oracle Hospitality Cruise will not provide any assistance on this.
Handling for JSON Format
-
All JSON date type must be passed in as JSON string in “YYYYMMDDHHMMSS” format. For example, 2011-01-14 3:14PM should be passed in as “20110114151400”.
-
All JSON object must be passed in as serialized JSON string.
Byte Array Handling
-
All JSON ByteArray must passed in as base64 serialized JSON string.
Passing Date Variable using XML format
By default, the XML Serialized Date is a format that includes time zone information. For example, if the server is in Florida (GMT-5) and the caller is in Malaysia (GMT+8), the value passed to web service is shown as:
2011-12-11T04:30:38.0946974+08:00
The server then de-serializes the date to “2011-12-10 3:30pm” as the server in Florida is 13 hours behind the caller in Malaysia.
If you want to preserve the date and time, you must make sure the XML Serialized Date format excludes the time zone info as shown below:
2011-12-11T04:30:38.0946974
Method to Handle Date Passing between different Time Zones
For a dataset, the method shown below ensures that the date/time remains the same between different time zones.
For Each oTable In oResponse.oDataSet.Tables
For nX = 0 To oTable.Columns.Count - 1
If oTable.Columns(nX).DataType.ToString = "System.DateTime" Then
oTable.Columns(nX).DateTimeMode =DataSetDateTime.Unspecified
End If
Next
Next
Shown below is the code used to ensure the date field will be serialized without a time zone. This function does not support properties with an additional parameter, it also does not support multi-dimension array.
Private Sub RemoveTimeZone(ByVal poObject As Object)
Dim oType As System.Reflection.PropertyInfo
Dim oField As System.Reflection.FieldInfo
For Each oType In poObject.GetType.GetProperties
Try
If oType.PropertyType.IsArray Then
Call RemoveArrayTimeZone(oType.GetValue(poObject, New Object() {}))
ElseIf oType.PropertyType.Name = "DateTime" Then
oType.SetValue(poObject, _
DateTime.SpecifyKind(oType.GetValue(poObject, _
New Object() {}), _
DateTimeKind.Unspecified), _
New Object() {})
End If
Catch ex As Exception
End Try
Next
For Each oField In poObject.GetType.GetFields
Try
If oField.FieldType.IsArray Then
Call RemoveArrayTimeZone(oField.GetValue(poObject))
ElseIf oField.FieldType.Name = "DateTime" Then
oField.SetValue(poObject, _
DateTime.SpecifyKind(oField.GetValue(poObject), _
DateTimeKind.Unspecified))
End If
Catch ex As Exception
End Try
Next
End Sub
Private Sub RemoveArrayTimeZone(ByVal poObject As Object)
Dim nX As Integer
If poObject(0).GetType.ToString = "DateTime" Then
For nX = 0 To poObject.Length - 1
poObject(nX) = DateTime.SpecifyKind(poObject(nX), _
DateTimeKind.Unspecified)
Next
ElseIf poObject(0).GetType.IsClass = True Then
For nX = 0 To poObject.Length - 1
Call RemoveTimeZone(poObject(nX))
Next
End If
End Sub
Dim gdCheckOpenDateTime As Date
gdCheckOpenDateTime = DateTime.SpecifyKind(Now(), _
DateTimeKind.Unspecified)
Connecting to OHC Web Services using Microsoft .NET
The Microsoft IIS is used to host the SOAP Web Service. Thus this document assumes that the reader is familiar with accessing the SOAP Web Service function.
How to use OHCWebServices with Microsoft .NET
-
Add a Web Reference for Web Service in your application. For example, named web reference as FidelioSPMSWS.
-
Add a variable reference to the Web Service reference like Public goWs As New FidelioSPMSWS FidelioSPMSWSSoapClient
-
With the above in place, you can then call the available web methods. For example:
-
goWs.FidelioSPMSWSJsonGet().
-
goWs.FidelioSPMSWSJsonPost().
-
goWs.FidelioSPMSWSXML().
-
Recommended EndPoint Setting
This section describes the recommended EndPoint setting for the application.
Configure the EndPoint in App.Config
Use Notepad to open the App.Config file and edit the address to the correct IP Address of the web server.
<client>
<endpoint address=http://localhost:50844/OHCWebServices/OHCWebServices.asmx
binding="basicHttpBinding"
bindingConfiguration="FidelioSPMSWSSoap"
contract="FidelioSPMSWS.FidelioSPMSWSSoap"
name="FidelioSPMSWSSoap" />
</client>Below is the recommended setting
<bindings>
<basicHttpBinding>
<binding name="FidelioSPMSWSSoap"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="10000000"
maxBufferPoolSize="524288"
maxReceivedMessageSize="10000000"
messageEncoding="Text"
textEncoding="utf-8"
transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32"
maxStringContentLength="1000000"
maxArrayLength="16384"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>