1 General Overview
The document provides an explanation and description of each of the exposed functions available in OHCWebService 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 are passed in as STRING in YYYYMMDDHHMMSS format. For example, 2011-01-14 3:14PM = 20110114151400.
-
If the input type is a JSON object, this need to be passed in as string serializes as JSON string.
-
If the input type is ByteArray, this need to be passed in as base64 string serializes as JSON string.
Passing Date Variable using XML format
By default, the XML Serialize Date is a format that includes time zone information. If the server is in Florida (GMT-5) and the caller is in Malaysia (GMT+8), the value passed to web service is shown in the following example:
2011-12-11T04:30:38.0946974+08:00
The Server then de-serializes the date to “2011-12-10 3:36pm”
as there are 13 hours difference between Malaysia and Florida.
If you want to preserve the date and time, you must make sure the XML Serialize the date to the following format:
2011-12-11T04:30:38.0946974
For the dataset, below is the method used to ensure the date/time remains the same between the 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
Below is the code used to ensure the that has the date field will serialize 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 Service using Microsoft .NET
The Microsoft IIS is used to provide the Web Service, thus this document assumes the reader is familiar with how to access the Web Service function.
How to use OHCWebService 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>