SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    swl
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Data retrieval from XML based web service

    Hi there,
    I am new to XML,I have been given a project on XML - booking system that will be developed in PHP,A link is given bellow for the XML interface so that one can get a good idea about this senario:
    http://195.57.250.36/barceloDS/interface/example
    now the prb are
    the server hasnt got WSDL file,so that I can use nusoap to get data.
    PLS help me what are the alternative ways for getting data from this server by using php,i.e. NUSOAP or XML-RPC.
    waiting for your kind attention.
    thanking you in anticipation,
    Munnan

  2. #2
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using cURL to grab the XML and then process it with HTML_SAX or similar to parse

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    swl
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pls Chk This

    Hello all,
    I am struck with a XML document parsing.
    Following URL contain the Xml functions.
    http://195.57.250.36/barceloDS/interface/xml
    The method through which I am trying to access xml function in PHP is given below. But I am unable to get these functions to get data in PHP.
    PHP Code:
    <?php
    // includes nusoap classes
     
    require('nusoap.php');

      
    $l_aParam="<?xml version='1.0' encoding='ISO-8859-1'?>
        <barceloDS_requests>
        <request type='availability list' id='1'>
          <language_code>ING</language_code>
          <agency>
            <primary>78</primary>
            <secondary>88</secondary>
            <detail>888</detail>
            <branch>1</branch>
          </agency>
          <contract></contract>
          <check_in_date>20051201</check_in_date>
          <check_out_date>20051207</check_out_date>
          <location>
            <destination_code>PMI</destination_code>
            <zone_code></zone_code>
          </location>
          <establishment>
            <code></code>
            <category></category>
          </establishment>
          <board_type_code></board_type_code>
          <occupancy>
            <adults>2</adults>
            <children>0</children>
            <rooms>1</rooms>
          </occupancy>
        </request>
        </barceloDS_requests>"
    ;
        
      
    //print($l_aParam);
      
       // set parameters and create client

      
    $l_oClient  = new soapclient([url]http://195.57.250.36/barceloDS/interface/xml[/url]);

      // call a webmethod 
      
    $l_stResult $l_oClient->call('availability',$l_aParam);
     
    /*I think the problem area is this*/
      
      
    print_r($l_stResult);
      
      if (
    $l_oClient->getError()) {
          
           echo(
    "Error Found :".$l_oClient->getError());
      }
      else{
          echo(
    "No Error Found");
      }
     
    ?>

    Following is the sample code in ASP that company had provided me that is working fine.

    <%
    Dim xml

    xml = "xml=<?xml version='1.0' encoding='ISO-8859-1'?>" + _
    "<barceloDS_requests>" + _

    "<request type='availability list' id='1'>" + _
    " <language_code>ING</language_code>" + _
    " <agency>" + _
    " <primary>888</primary>" + _
    " <secondary>88</secondary>" + _
    " <detail>888</detail>" + _
    " <branch>1</branch>" + _
    " </agency>" + _
    " <contract></contract>" + _
    " <check_in_date>20041201</check_in_date>" + _
    " <check_out_date>20041207</check_out_date>" + _
    " <location>" + _
    " <destination_code>PMI</destination_code>" + _
    " <zone_code></zone_code>" + _
    " </location>" + _
    " <establishment>" + _
    " <code></code>" + _
    " <category></category>" + _
    " </establishment>" + _
    " <board_type_code></board_type_code>" + _
    " <occupancy>" + _
    " <adults>2</adults>" + _
    " <children>0</children>" + _
    " <rooms>1</rooms>" + _
    " </occupancy>" + _
    "</request>" + _

    "</barceloDS_requests>"

    '==================================
    'Response.Write xml
    'Response.End
    '==================================


    Dim xmlHTTP, URLPath

    Set xmlHTTP = Server.Createobject("MSXML2.ServerXMLHTTP")

    ' url test server
    URLPath = "http:// 194.224.184.162/barceloDS/interface/xml"

    xmlHTTP.open "POST", URLPath, False
    xmlHTTP.SetRequestHeader "Content-type","application/x-www-form-urlencoded"

    xmlHTTP.send(xml)

    'strXMLOut = xmlHTTP.responseText
    strXMLOut = xmlHTTP.ResponseXML.xml

    '==================================
    'Response.Write(strXMLOut)
    'Response.End
    '==================================

    Dim xmlDoc

    Set xmlDoc = Server.CreateObject("Msxml2.DOMDocument")
    xmlDoc.async = False
    xmlDoc.load ("strXMLOut")
    xmlDoc.validate

    If xmlDoc.parseError.errorCode <> 0 Then
    Response.Write("A parse error occurred.<br>")
    Response.Write("Error Code is: ")
    Response.Write(xmlDoc.parseError.errorCode)
    Response.Write("<br>")
    Response.Write("The reason is: ")
    Response.Write(xmlDoc.parseError.reason)
    Response.Write("<br>")
    Response.Write("Error in Line No.: ")
    Response.Write(xmlDoc.parseError.Line)
    Response.Write("<br>")
    Response.Write("Position: ")
    Response.Write(xmlDoc.parseError.linepos)
    Response.Write("<br>")
    Response.Write("Error in URL: ")
    Response.Write(xmlDoc.parseError.url)
    Response.Write("<br>")
    Response.End()

    End If
    %>





    I am unable to retrieve data through my php script(that I have provided above) ,please help me out by telling the ways to retrieve data through this xml document.
    Thanking you in anticipation,
    Munnan


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •