Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 689
  • Last Modified:

Soap/XML

I am brand new to SOAP and XML. I am proficient with CFML. I need to request information from a hotel reservation webservice and store the response in a MS Access database to be used by my CFML application. I will be translating to mySQL later in the development of the application.

Below is the XML code that I received from the webservice provider:

Technical information

The Hotel interface runs onto HTTP protocol and both Xml request and responses should be into a SOAP message. This way allows multiple Xml functions in the same message and save in communications. But the main advantage is that SOAP offers many integration possibilities with many systems using free and available libraries by Internet. In any case the SOAP tags are optional and can be omitted.

See Soap-tags below:
Soap Request Sample    
<?xml version="1.0.1" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <barceloDS_requests>

.
.
.

    </barceloDS_requests>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>    


Soap Response Sample
<?xml version="1.0.1" encoding="ISO-8859-1" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
     <barceloDS_responses>

.
.
.

     </barceloDS_responses>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Webservice url address: http:// 194.224.184.162/barceloDS/interface/xml

'The XML Request Sample'

<?xml version="1.0" encoding="UTF-8"?>
<barceloDS_requests>
     <request type="availability list" id="1">
          <session_id>aaa6SP8c6P5BAJ</session_id>
          <language_code>ING</language_code>
          <agency>
               <primary>888</primary>
               <secondary>88</secondary>
               <detail>888</detail>
               <branch>1</branch>
          </agency>
          <contract/>
          <check_in_date>20030701</check_in_date>
          <check_out_date>20030707</check_out_date>
          <location>
               <destination_code>PMI</destination_code>
               <zone_code/>
          </location>
          <establishment>
               <code/>
               <category/>
          </establishment>
          <board_type_code/>
          <occupancy>
               <adults>2</adults>
               <children>1</children>
               <rooms>1</rooms>
          </occupancy>
     </request>
</barceloDS_requests>


The XML Response Sample
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<barceloDS_responses xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
     <response>
          <request type="availability list" id="1">
                <session_id>aaa6SP8c6P5BAJ</session_id>
               <language_code>ING</language_code>
               <agency>
                    <primary>888</primary>
                    <secondary>88</secondary>
                    <detail>888</detail>
                    <branch>1</branch>
               </agency>
               <contract/>
               <check_in_date>20030706</check_in_date>
               <check_out_date>20030707</check_out_date>
               <location>
                    <destination_code>PMI</destination_code>
                    <zone_code/>
               </location>
               <establishment>
                    <code/>
                    <category/>
               </establishment>
               <board_type_code/>
               <occupancy>
                    <adults>2</adults>
                    <children>1</children>
                    <rooms>1</rooms>
               </occupancy>
          </request>
          <establishment>
               <code>271</code>
               <description>TRYP BELLVER</description>
               <contract>3.V_BELLVER</contract>
               <child_min_age>2</child_min_age>
               <child_max_age>12</child_max_age>
               <location>
                    <destination>
                         <code>PMI</code>
                         <description>MALLORCA</description>
                    </destination>
                    <zone>
                         <code>10</code>
                         <description>PALMA</description>
                    </zone>
               </location>
               <category>
                    <code>4EST</code>
                    <description>4 STARS</description>
               </category>
               <incoming_contract>0</incoming_contract>
               <offer>YES</offer>
               <classification>SPE</classification>
               <room>
                    <code>DBL.TE</code>
                    <description>DOBLE TERRACE</description>
                    <availability>997</availability>
                    <type>P</type>
                    <occupancy>
                         <adults>2</adults>
                         <children>1</children>
                         <rooms>1</rooms>
                    </occupancy>
                    <price>
                         <board_type>
                              <code>SA</code>
                              <description>SELF CATERING</description>
                         </board_type>
                         <currency>EUR</currency>
                         <amount>14,08</amount>
                    </price>
                    <price>
                         <board_type>
                              <code>MP</code>
                              <description>HALF BOARD</description>
                         </board_type>
                         <currency>EUR</currency>
                         <amount>20,98</amount>
                    </price>
               </room>
               <room>
                    <code>A14.TE</code>
                    <description>APTO. 1 DORMITORIO 4 PAX TERRACE</description>
                    <availability>999</availability>
                    <type>U</type>
                    <occupancy>
                         <adults>2</adults>
                         <children>1</children>
                         <rooms>1</rooms>
                    </occupancy>
                    <price>
                         <board_type>
                              <code>SA</code>
                              <description>SELF CATERING</description>
                         </board_type>
                         <currency>EUR</currency>
                         <amount>36,8</amount>
                    </price>
                    <price>
                         <board_type>
                              <code>MP</code>
                              <description>HALF BOARD</description>
                         </board_type>
                         <currency>EUR</currency>
                         <amount>57,5</amount>
                    </price>
               </room>
          </establishment>
          <establishment>
               <code>297</code>
               <description>BARCELO PUEBLO PALMA</description>
               <contract>3.VARIOS</contract>
               <child_min_age>2</child_min_age>
               <child_max_age>12</child_max_age>
               <location>
                    <destination>
                         <code>PMI</code>
                         <description>MALLORCA</description>
                    </destination>
                    <zone>
                         <code>20</code>
                         <description>PLAYA DE PALMA</description>
                    </zone>
               </location>
               <category>
                    <code>3EST</code>
                    <description>3 STARS</description>
               </category>
               <incoming_contract>0</incoming_contract>
               <offer>YES</offer>
               <classification>SPE</classification>
               <room>
                    <code>DBL.ST</code>
                    <description>DOBLE STANDARD</description>
                    <availability>994</availability>
                    <type>P</type>
                    <occupancy>
                         <adults>2</adults>
                         <children>1</children>
                         <rooms>1</rooms>
                    </occupancy>
                    <price>
                         <board_type>
                              <code>MP</code>
                              <description>HALF BOARD</description>
                         </board_type>
                         <currency>EUR</currency>
                         <amount>16</amount>
                    </price>
               </room>
          </establishment>
     </response>
</barceloDS_responses>

Thank you in advance for your help
0
wsessoms
Asked:
wsessoms
  • 3
  • 2
1 Solution
 
Bob LearnedCommented:
I am not quite sure that I can see a question in there.

Bob
0
 
wsessomsAuthor Commented:
How do would I communicate with the web service to comsume the information in the XML request. How do you format the request to the web service to get the response. The code is the samples that were supplied to me by the web service.
0
 
Bob LearnedCommented:
I am still trying to get my head around ColdFusion, so any suggestion may be slightly off base, but I have seen articles like this (using cfinvoke to interface with web services):

How to invoke a Web Service while omitting optional service method arguments
http://www.talkingtree.com/blog/index.cfm/2006/7/12/cfinvokeargument-omit-attr

It would be helpful to know what the web method signature looks like, rather than the request/response structure.

Bob
0
 
wsessomsAuthor Commented:
After doing some research I tried the code below to send a request to the web service and recieved the following error message:

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Invalid at the top level of the document. Error processing resource 'http://localhost:8500/cfapdesign/soapheaders/request.c...
POST /HTTP/1.1
^
 
Below is the code that I sent to the server:
POST /HTTP/1.1
Host: http://194.224.184.164/barceloDS/interface/xml
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "Some-URI"


<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body xmlns="http://194.224.184.164/barceloDS/interface/xml">
  <barceloDS_request type="availability list" id="1">
  <session_id>aaa6SP8c6P5BAJ</session_id>
  <language_code>ING</language_code>
    <agency>
        <primary>888</primary>
            <secondary>88</secondary>
            <detail>888</detail>
            <branch>1</branch>
   </agency>
   <contract/>
            <check_in_date>20030701</check_in_date>
            <check_out_date>20030707</check_out_date>
            <location>
                  <destination_code>PMI</destination_code>
                  <zone_code/>
            </location>
            <establishment>
                  <code/>
                  <category/>
            </establishment>
            <board_type_code/>
            <occupancy>
                  <adults>2</adults>
                  <children>1</children>
                  <rooms>1</rooms>
            </occupancy>  


    </barceloDS_request>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Can someon help me understand why I am getting the error and how to get the web service to send the XML  response.
0
 
Bob LearnedCommented:
In your request, I don't see the <barceloDS_requests> element.

Bob
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now