We help IT Professionals succeed at work.

How do I convert a coldfusion invoke web service to a php invoke web service

woodsy51
woodsy51 asked
on
How would i convert this cold fusion code to a php code i have tried several things but to no result
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<cfset WSDL_URL = "http://reiwa.com/cfc/webservice.cfc?wsdl">
Get 10 Residential Rental Listing IDs for Agency 11002, Branch 0
<cfinvoke webservice="#WebServiceApplication_WSDL_URL#"
method="getAgencyListingNumbers"
returnvariable="DataReturned">
<cfinvokeargument name="rowsrequired" value="10" />
<cfinvokeargument name="search_type" value="RESSALE" />
<cfinvokeargument name="agencyno" value="11002" />
<cfinvokeargument name="branchno" value="0" />
<cfinvokeargument name="days_back" value="0" />
</cfinvoke>
<cfset myXml = xmlParse(DataReturned)>
<cfdump var="#myXml#">
</body>
</html>

Open in new window

Comment
Watch Question

CERTIFIED EXPERT

Commented:
What is this supposed to do in Coldfusion? What would the user see?

Author

Commented:
Hi,
this should show a 10 row list of the agents property listings id's
you could use agents  id of 13451
CERTIFIED EXPERT
Commented:
Is there supposed to be a database somewhere? It seems to me that you are trying to do something like this (I've made up field and table names)



<?php
 
// Create DB connection
//
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password') or die('Could not connect: ' . mysql_error());
mysql_select_db('my_database') or die('Could not select database');
 
 
// Simple fetch of agency listings
//
function getAgencyListingNumbers( $agentId ) {
 
    $rs = @mysql_query("select * from agentsPropertyTable where agentId='$angentId' limit 10 ");
    if ( $rs ) 
        while ( $rw = @mysql_fetch_array($rs, MYSQL_ASSOC ) ) {
             echo $rw['propertyName'] . " " . $rw['proprtyPrice'] . "<br/>";
        }
 
}
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php getAgencyListingNumbers( 13451 ); ?>
</body>
</html>

Open in new window

Author

Commented:
the data base is a feed from the realestste portal "webservice"
http://reiwa.com/cfc/webservice.cfc?wsdl

what we are trying to do is list the property numbers
CERTIFIED EXPERT

Commented:
I wasn't sure how Coldfusion accesses its database, so I thought I would ask. I'm not a whiz at SOAP or XML, but I think what you need to do is to use something like CURL (or possibly fopen() ) to retrieve the data and then parse the XML locally. There are some notes at http://devzone.zend.com/node/view/id/1713#Heading4 about using SAX which, if I'm reading it right would load and parse the XML for you.

Something like this  $dom->load("http://reiwa.com/cfc/webservice.cfc?wsdl");

Author

Commented:
thanks i will give it a go

Author

Commented:
Thanks but did not get the gig
cheers