Solved

Soap/XML

Posted on 2006-11-30
5
672 Views
Last Modified: 2013-11-19
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
Comment
Question by:wsessoms
  • 3
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18044882
I am not quite sure that I can see a question in there.

Bob
0
 

Author Comment

by:wsessoms
ID: 18044923
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18045040
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
 

Author Comment

by:wsessoms
ID: 18048558
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 18063385
In your request, I don't see the <barceloDS_requests> element.

Bob
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now