Wednesday, May 28, 2014

RE: (Web Service) Using XML to Output HTML into my website

Hello,

 

I guess that you can parse the XML file using PHP and output that as HTML. For example:

http://blog.teamtreehouse.com/how-to-parse-xml-with-php5

http://www.php.net/manual/en/book.xml.php

 

Since you're using CakePHP, the "right" way is using a DataSource that does this conversion. You can either write that yourself (sounds scary, but it's not that bad, especially if you only need to read information), or try to find a community-written SOAP datasource that does what you want (or make little adjustments to make it work.) For example:"

http://blog.pagebakers.nl/2008/12/18/soapsource-a-soap-client-datasource-for-cakephp/

http://book.cakephp.org/2.0/en/models/datasources.html

 

Once you convert from SOAP to a CakePHP-DB like sort of thing, generating the HTML is simple enough.

 

An alternative way (non-CakePHP) would be to use XSLT (e.g., http://www.w3schools.com/xml/xml_xsl.asp) to convert from HTML to XML. You may either accomplish this client-side, or write a simple script (PHP or otherwise) that does the parsing. Then you can read the styled document and include it where needed.

 

That should get you started.

 

PS: Are you sure your domain name isn't supposed to be .tur.ar? https://nic.ar/dominios-tur-ar.xhtml

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of NHGDESIGN
Sent: 27. mai 2014 17:22
To: cake-php@googlegroups.com
Subject: (Web Service) Using XML to Output HTML into my website

 

Hello. I hope I can explain myself clearly so that I will get help here.

 

I've been given a web service access to show content to my website (The web service is in a another domain). The information is about Hotels (Hotels names, Hotel Images, Hotel Category, Hotels Locations, Hotels descriptions).

 

The file is like the following:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:bud="http://www.softur.com.ar/wsbridge/budget.wsdl" xmlns:bud1="http://www.softur.com.ar/wsbridge/budget.xsd">
   <soap:Header/>
   <soap:Body>
      <bud:searchHotelFaresRQ1>
         <!--Optional:-->
<cityLocation code="PMV" />
  <dateFrom>2014-05-30</dateFrom>
  <dateTo>2014-05-31</dateTo>
  <name></name>
  <pos>
    <id>FakeID</id>
    <password>FakePassWord</password>
  </pos>
  <currency>USD</currency>
  <OtherBroker>true</OtherBroker>
  <FareTypeSelectionList xmlns="http://www.softur.com.ar/wsbridge/budget.xsd">
    <FareTypeSelection OccupancyId="1">1</FareTypeSelection>
    <Ocuppancy OccupancyId="1">
      <Occupants type="ADT" />
      <Occupants type="ADT" />
    </Ocuppancy>
  </FareTypeSelectionList>
      </bud:searchHotelFaresRQ1>
   </soap:Body>
</soap:Envelope>

 

I am running that request using soapUI 3.5.1, which outputs an XML file with lots of data about Hotels.

 

<HotelFares UniqueId="HT|00000011080" BackOfficeCode="000814" BackOfficeOperatorCode="00658" xmlns="">
            <HotelAddress xmlns="http://www.softur.com.ar/wsbridge/budget.xsd">Hotel Address</HotelAddress>
            <Name>HOTEL AGUA DORADA</Name>            
            <Category >4 *</Category>            
            <HotelPhone xmlns="http://www.softur.com.ar/wsbridge/budget.xsd">5555555555</HotelPhone>
            <HotelZone xmlns="http://www.softur.com.ar/wsbridge/budget.xsd">Hotel Zone Area</HotelZone>
            <HotelAccess xmlns="http://www.softur.com.ar/wsbridge/budget.xsd">Address Description of the Hotel Here</HotelAccess>
            <HotelPosition xmlns="http://www.softur.com.ar/wsbridge/budget.xsd">
                <Latitude>-63.93631</Latitude>
                <Longitude>11.022754</Longitude>
            </HotelPosition>
</HotelFares>

 

I want to show that information as an HTML file into my website, but I don't know how to go about this. 

 

I guess saving these information appropriately into a database, and then spitting that information from the database to my website would be a way.

 

Any help I can get here using CakePHP so that I would know where to start would really help.

 

Thanks in advance.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Ricardo Vieitez | Student Assistant - Network Administration
University of Florida Department of Housing and Residence Education
PO Box 112100 | Gainesville, FL 32611-2100
office 352.392.2171 x
10355 | fax 352.392.6819 | RicardoV@housing.ufl.edu
StrengthsQuest Top 5: Analytical, Strategic, Learner, Responsibility, Relator - Find Out More
Please consider the environment before printing this email.

No comments: