0

Right there are like 10 of these subjects yet none of them actually tackle MY problem.

Heres the XML file.

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetStartEndPointResponse xmlns="http://www.etis.fskab.se/v1.0/ETISws">
         <GetStartEndPointResult>
            <Code>0</Code>
            <Message />
            <StartPoints>
               <Point>
                  <Id>81216</Id>
                  <Name>Lund C</Name>
                  <Type>STOP_AREA</Type>
                  <X>6178320</X>
                  <Y>1335414</Y>
               </Point>
               <Point>
                  <Id>81700</Id>
                  <Name>Lund Botulfsplatsen</Name>
                  <Type>STOP_AREA</Type>
                  <X>6177824</X>
                  <Y>1335838</Y>
               </Point>
               <Point>
                  <Id>81039</Id>
                  <Name>Lund Univ-sjukhuset</Name>
                  <Type>STOP_AREA</Type>
                  <X>6179057</X>
                  <Y>1336059</Y>
               </Point>
               <Point>
                  <Id>81156</Id>
                  <Name>Lund Bankgatan</Name>
                  <Type>STOP_AREA</Type>
                  <X>6177677</X>
                  <Y>1335945</Y>
               </Point>
               <Point>
                  <Id>81069</Id>
                  <Name>Lund Södra Tpl.</Name>
                  <Type>STOP_AREA</Type>
                  <X>6175456</X>
                  <Y>1335052</Y>
               </Point>
               <Point>
                  <Id>399686</Id>
                  <Name>LUNDAGATAN 1 FURULUND</Name>
                  <Type>ADDRESS</Type>
                  <X>6186112</X>
                  <Y>1330502</Y>
               </Point>
               <Point>
                  <Id>42789</Id>
                  <Name>LUNDAGATAN 2 HELSINGBORG</Name>
                  <Type>ADDRESS</Type>
                  <X>6216872</X>
                  <Y>1307608</Y>
               </Point>
               <Point>
                  <Id>30985</Id>
                  <Name>LUNDAGÅRD 1 MARIEHOLM</Name>
                  <Type>ADDRESS</Type>
                  <X>6196812</X>
                  <Y>1336430</Y>
               </Point>
               <Point>
                  <Id>122149</Id>
                  <Name>LUNDAHLS VÄG 23 GÄRDS KÖPINGE</Name>
                  <Type>ADDRESS</Type>
                  <X>6200964</X>
                  <Y>1394071</Y>
               </Point>
               <Point>
                  <Id>280721</Id>
                  <Name>LUNDASTIGEN 3 KÅGERÖD</Name>
                  <Type>ADDRESS</Type>
                  <X>6211135</X>
                  <Y>1330886</Y>
               </Point>
               <Point>
                  <Id>46335</Id>
                  <Name>Lund Lasarett</Name>
                  <Type>POI</Type>
                  <X>6179076</X>
                  <Y>1336073</Y>
               </Point>
               <Point>
                  <Id>35604</Id>
                  <Name>Lund Polishus</Name>
                  <Type>POI</Type>
                  <X>6178151</X>
                  <Y>1335171</Y>
               </Point>
               <Point>
                  <Id>222961</Id>
                  <Name>Lund Skånetrafikens kundcenter Centralst</Name>
                  <Type>POI</Type>
                  <X>6178373</X>
                  <Y>1335423</Y>
               </Point>
               <Point>
                  <Id>259298002</Id>
                  <Name>Lundagård</Name>
                  <Type>POI</Type>
                  <X>6178151</X>
                  <Y>1335824</Y>
               </Point>
               <Point>
                  <Id>50151</Id>
                  <Name>Lundahälsan Bondev</Name>
                  <Type>POI</Type>
                  <X>6179258</X>
                  <Y>1334425</Y>
               </Point>
            </StartPoints>
            <EndPoints>...</EndPoints>
         </GetStartEndPointResult>
      </GetStartEndPointResponse>
   </soap:Body>
</soap:Envelope>

Now if you right click on that text-pile and "inspect element" in Chrome you'll see how the XML is structured.

The URL to this file is http://www.labs.skanetrafiken.se/v2.2/querypage.asp?inpPointFr=lund&inpPointTo=ystad

How does one parse this from scratch. No shortcuts as many people here on these forums just get pointed somewhere else!

Florent
  • 12,310
  • 10
  • 49
  • 58
basickarl
  • 37,187
  • 64
  • 214
  • 335
  • Usually you would not parse this from scratch, you would have a WSDL that would tell you the structure of your request and response, and you would use PHP's SoapClient to take care of parsing the response. It has to start with a WSDL, though. Do you have one? – davidfmatheson Aug 07 '12 at 15:34
  • Now we are starting to get somewhere, can you give an example of this WSDL? – basickarl Aug 07 '12 at 15:46
  • Every WSDL is different, and is provided by the service provider. You are looking for an XML document that starts with `` or ``. It could be somewhere at that URL you mentioned. It looks like they've built a simple front end where they can pass URL parameters directly to the service. You can bet that, behind the scenes, they're taking `inpPointFr=lund` and `inpPointTo=ystad` and building a SOAP message that has `` (or something similar) in the ``. – davidfmatheson Aug 07 '12 at 16:01
  • Ah! that makes more sense. Here is the URL to that file? How do I implement this though?: http://www.labs.skanetrafiken.se/v2.2/GetStartEndPoint.xsd – basickarl Aug 08 '12 at 07:16
  • Just answered my own question here: http://stackoverflow.com/questions/11861081/php-how-to-link-soap-xml-with-xml-schema-xsd/11863994#11863994 – basickarl Aug 08 '12 at 11:59
  • Yes, you can always parse the XML manually, but you're always going to make your life easier if you find the service's WSDL. – davidfmatheson Aug 08 '12 at 12:31

0 Answers0