# SOAP envelope

The SOAP Envelope houses the entire message structure to be delivered. It is made up of an optional Header element, and a required Body element.

### **SOAP header**  <a href="#soapenvelope-soapheader" id="soapenvelope-soapheader"></a>

The SOAP Header element is the location of message meta-data. Information such as username, password, action code, and transaction ID are present in the various SOAP Header elements and attributes.  Username and password will correspond to an account created on the ENTERPRISE CONNECTIVITY customer portal ([my.pegs.com](http://my.pegs.com)). This account will need to be enabled for HCD updates via Web services in order for the messages to be processed.

While the SOAP specification allows the Header to be an optional element, ENTERPRISE CONNECTIVITY requires it to be present in each request. Further, the use of the ebXML:MessageHeader element, and the wsse:Security elements are also required. The following links point to the schema files for the ebXML:MessageHeader element and the wsse:Security element. Clients can reference these schemas to determine required elements and attributes.

* <http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd>
* <http://schemas.xmlsoap.org/ws/2002/12/secext>

The following table illustrates specific values that should be present in these elements.

| **Element**    | **Attribute**           | **R / O / C** | **Usage**                             | **Description**                                                                           |
| -------------- | ----------------------- | ------------- | ------------------------------------- | ----------------------------------------------------------------------------------------- |
| MessageHeader  | <p><br></p>             | R             | <p><br></p>                           | <p><br></p>                                                                               |
| <p><br></p>    | SOAP-ENV:mustUnderstand | R             | <p>0</p><p>1</p>                      | Indicates “true” or “false”                                                               |
| <p><br></p>    | version                 | R             | 2.0                                   | Indicates the ebXML version                                                               |
| :From          | <p><br></p>             | R             | <p><br></p>                           | <p><br></p>                                                                               |
| PartyId        | <p><br></p>             | R             | <p><br></p>                           | Supplier Name                                                                             |
| To             | <p><br></p>             | R             | <p><br></p>                           | <p><br></p>                                                                               |
| PartyId        | <p><br></p>             | R             | ENTERPRISE CONNECTIVITY               | <p><br></p>                                                                               |
| CPAId          | <p><br></p>             | R             | HCDUpdateInterfa ce                   | The destination system                                                                    |
| ConversationId | <p><br></p>             | R             | *some value*                          | This value can be used by the client to group a set of transactions into a “conversation” |
| Service        | <p><br></p>             | R             | HCDUpdateInterfa ce                   | The destination service                                                                   |
| <p><br></p>    | type                    | R             | 1.0                                   | Defines the version of the eb:Service element                                             |
| Action         | <p><br></p>             | R             | <p>Add Update</p><p>Upsert Delete</p> | Defines the action to be performed on the property                                        |
| MessageData    | <p><br></p>             | R             | <p><br></p>                           | <p><br></p>                                                                               |
| MessageId      | <p><br></p>             | R             | <p><br></p>                           | Unique Record ID                                                                          |
| Timestamp      | <p><br></p>             | R             | <p><br></p>                           | <p><br></p>                                                                               |
| Security       | <p><br></p>             | R             | <p><br></p>                           | Defines the wsse Security element                                                         |
| UsernameToken  | <p><br></p>             | R             | <p><br></p>                           | Defines the UsernameToken element                                                         |
| <p><br></p>    | Username                | R             | *user name*                           | The client’s username will be defined by ENTERPRISE CONNECTIVITY                          |
| <p><br></p>    | Password                | R             | *password*                            | The client’s password will be defined by ENTERPRISE CONNECTIVITY                          |

### **SOAP body**  <a href="#soapenvelope-soapbody" id="soapenvelope-soapbody"></a>

The SOAP Body contains the message payload. In the case of the HCD XML Update Interface, this is an OTA\_HotelDescriptiveContentNotifRQ OTA XML document.

<br>

**Example of SOAP envelope**&#x20;

&#x20;The following example SOAP Envelope shows the use of the ebXML Header and wsse Security elements within the SOAP Header.<br>

\<env:Envelope xmlns:env="<http://schemas.xmlsoap.org/soap/envelope/>" env:encodingStyle="<http://schemas.xmlsoap.org/soap/encoding/>" xmlns:enc="<http://schemas.xmlsoap.org/soap/encoding/>"

xmlns:ns0="<http://webservices.pegs.com/HCD/update_interface/HotelDescriptiveContent> WS/HotelDescriptiveContentWS" xmlns:xsd="<http://www.w3.org/2001/XMLSchema>" xmlns:ns2="<http://www.opentravel.org/OTA/2003/05>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>">

\<env:Header>

\<ns2:MessageHeader xmlns:ns1="<http://schemas.xmlsoap.org/soap/envelope/>" ns1:mustUnderstand="false" xmlns:ns2="<http://www.oasis-open.org/committees/ebxml-> msg/schema/msg-header-2\_0.xsd" ns2:version="2.0">

\<ns2:From>

\<ns2:PartyId ns2:type="partyIdType">Chain Name\</ns2:PartyId> \</ns2:From>

\<ns2:To>

\<ns2:PartyId ns2:type="partyIdType">ENTERPRISE CONNECTIVITY\</ns2:PartyId>

\</ns2:To>

\<ns2:CPAId>HCDUpdateInterface\</ns2:CPAId>

\<ns2:ConversationId>ConvoID\</ns2:ConversationId>

\<ns2:Service ns2:type="1.0">HCDUpdateInterface\</ns2:Service>

\<ns2:Action>UPSERT\</ns2:Action>

\<ns2:MessageData>

\<ns2:MessageId>ID12345\</ns2:MessageId>

\<ns2:Timestamp>2006-09-05T08:57:04.576-07:00\</ns2:Timestamp>

\</ns2:MessageData>

\</ns2:MessageHeader>

\<Security xmlns="<http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-> wssecurity-secext-1.0.xsd">

\<UsernameToken>

\<Username>username@[pegs.com](http://pegs.com)\</Username>

\<Password>password\</Password>

\</UsernameToken>

\</Security>

\</env:Header>

\<env:Body>

\<ns2:OTA\_HotelDescriptiveContentNotifRQ xmlns="<http://www.opentravel.org/OTA/2003/05>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" Version="4.000" PrimaryLangID="en">

.

.

.

.

\</ns2:OTA\_HotelDescriptiveContentNotifRQ>

\</env:Body>

\</env:Envelope>

**Action codes**

The action codes are defined in the SOAPHeader/eb:MessageHeader/eb:Action element. These codes, in conjunction with the “overwrite” and “removal” flags within the OTA\_HotelDescriptiveContentNotifRQ element, define what will happen to the property data within the message. The supported action codes are: Add, Update, Upsert, and Delete.

**Add**

An action code of “Add” is equivalent to a database “insert.”

If the action code is “Add”, all required elements and attributes must be present in the

OTA\_HotelDescriptiveContentNotifRQ message. If the message fails validation, an error will be returned to the client, and no data will be stored.

If the action code is “Add”, and the property is found to exist in the HCD, an error will be returned, and the property data will not be modified.

When a property is being added to the HCD, it must contain a minimum set of data elements in order to be considered valid. The following table describes these data requirements.

| **Element**                          | **Attribute**           |
| ------------------------------------ | ----------------------- |
| OTA\_HotelDescriptiveContentNotiflRQ | <p><br></p>             |
| <p><br></p>                          | Version                 |
| <p><br></p>                          | PrimaryLangID           |
| HotelDescriptiveContents             | <p><br></p>             |
| HotelDescriptiveContent              | <p><br></p>             |
| <p><br></p>                          | BrandCode               |
| <p><br></p>                          | HotelCode               |
| <p><br></p>                          | CurrencyCode            |
| <p><br></p>                          | HotelName               |
| HotelInfo                            | <p><br></p>             |
| <p><br></p>                          | HotelStatus             |
| <p><br></p>                          | HotelStatusCode         |
| CategoryCodes                        | <p><br></p>             |
| LocationCategory                     | <p><br></p>             |
| <p><br></p>                          | Code                    |
| SegmentCategory                      | <p><br></p>             |
| <p><br></p>                          | Code                    |
| HotelCategory                        | <p><br></p>             |
| <p><br></p>                          | Code                    |
| Services                             | <p><br></p>             |
| Service                              | <p><br></p>             |
| <p><br></p>                          | Code                    |
| <p><br></p>                          | ProximityCode           |
| FacilityInfo                         | <p><br></p>             |
| GuestRooms                           | <p><br></p>             |
| GuestRoom                            | <p><br></p>             |
| <p><br></p>                          | ID                      |
| Amenities                            | <p><br></p>             |
| Amenity                              | <p><br></p>             |
| <p><br></p>                          | RoomAmenityCode         |
| Policies                             | <p><br></p>             |
| Policy                               | <p><br></p>             |
| PolicyInfo                           | <p><br></p>             |
| <p><br></p>                          | CheckInTime             |
| <p><br></p>                          | CheckOutTime            |
| <p><br></p>                          | UsualStayFree CutoffAge |
| <p><br></p>                          | KidsStayFree            |
| TaxPolicies                          | <p><br></p>             |
| TaxPolicy                            | <p><br></p>             |
| <p><br></p>                          | Percent                 |
| <p><br></p>                          | Amount                  |
| <p><br></p>                          | ChargeUnit              |
| <p><br></p>                          | Code                    |
| AreaInfo                             | <p><br></p>             |
| Attractions                          | <p><br></p>             |
| Attraction                           | <p><br></p>             |
| <p><br></p>                          | AttractionCategoryCode  |
| <p><br></p>                          | Code                    |
| <p><br></p>                          | ID                      |
| ContactInfos                         | <p><br></p>             |
| ContactInfo                          | <p><br></p>             |
| Addresses                            | <p><br></p>             |
| Address                              | <p><br></p>             |
| <p><br></p>                          | UseType                 |
| AddressLine                          | <p><br></p>             |
| Cityname                             | <p><br></p>             |
| StateProv                            | <p><br></p>             |
| <p><br></p>                          | StateCode               |
| Countryname                          | <p><br></p>             |
| <p><br></p>                          | Code                    |
| Phones                               | <p><br></p>             |
| Phone                                | <p><br></p>             |
| <p><br></p>                          | PhoneLocationType       |
| <p><br></p>                          | PhoneTechType           |
| <p><br></p>                          | Phonenumber             |

**Update**

An action code of “Update” is equivalent to a database “update”. If the action code is “Update” and the property is not found to exist in the HCD, an error will be returned to the client.

Messages with an action code of “Update” will examine the “overwrite” and various “removal” flags that can be present in the OTA message structure to determine what course of action to take with the data in the request.

When the “overwrite” attribute in the HotelDescriptiveContent element is set to “true” (false is assumed if the attribute is not present) it causes a “refresh” of the data to occur. This means that ALL property data will be removed and re-inserted with the data in the request transaction. Any child “removal” attributes will be ignored.

Care must be taken to ensure that the resulting property record continues to meet the minimum required data elements as defined by ENTERPRISE CONNECTIVITY. If this is not the case, an error will be returned, and the property data will not be updated.

The “removal” attribute will work in a similar way. Any “removal” attribute that is set to “true” (false is assumed if the attribute is not present), causes the property data at that element level to be removed. This means that any data in the element containing the “removal” attribute, AND all the data of that element’s children, will be removed.

Again, care must be taken to ensure that the resulting property record continues to meet the minimum required data elements as defined by ENTERPRISE CONNECTIVITY. If this is not the case, an error will be returned, and the property data will not be updated.

Sample of an Update message with Removal Flag = true:<br>

\<OTA\_HotelDescriptiveContentNotifRQ xmlns="<http://www.opentravel.org/OTA/2003/05>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" PrimaryLangID="EN">

\<HotelDescriptiveContents>

\<HotelDescriptiveContent CurrencyCode="USD" TimeZone="CST" BrandCode="ZZ" HotelCode="AA123" HotelName="Test

Hotel" Overwrite="false">

\<FacilityInfo>

\<MeetingRooms>

\<MeetingRoom RoomName="Meeting Room Name" Removal="true"/> \</MeetingRooms>

\</FacilityInfo>

\</HotelDescriptiveContent>

\</HotelDescriptiveContents>

**\</OTA\_HotelDescriptiveContentNotifRQ>**

**Upsert**

An action code of “Upsert” is equivalent to a database “Update” or “Insert”.

If an action code is “Upsert”, a search for the property’s information will be performed. If the property is found, the data contained in the “Upsert” message will be used to update the HCD. If not found and the minimum required data set is not met, an error will be returned to the client. If the minimum required data set is met, then the property will be added to the HCD.

Please refer to the action code of “Update” for the guidelines of the “Overwrite” and “Removal” flags.<br>

**Delete**

An action code of “Delete” is equivalent to a database “delete”.

If the action code is “Delete”, only the following attributes will be validated:

| **Element**                           | **Attribute** |
| ------------------------------------- | ------------- |
| OTA\_HotelDescriptiveContentNoti flRQ | <p><br></p>   |
| <p><br></p>                           | Version       |
| <p><br></p>                           | PrimaryLangID |
| HotelDescriptiveContents              | <p><br></p>   |
| HotelDescriptiveContent               | <p><br></p>   |
| <p><br></p>                           | BrandCode     |
| <p><br></p>                           | HotelCode     |

All other elements and attributes, including those of the HotelDescriptiveContent element, will be ignored. If the action code is “Delete”, and the property is not found in the database, an error will be returned to the client.

When sending an action code of Delete, the property will be deleted for all languages when the primary language code = EN (English). When sending an action code of Delete and the language code is not EN (English), only the data associated to the provided language code will be deleted.
