[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Soap/XML

Posted on 2006-11-30
5
Medium Priority
?
688 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 18063385
In your request, I don't see the <barceloDS_requests> element.

Bob
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

650 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