issue with EVENTINVENTORY WEB SERVICES

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

issue with EVENTINVENTORY WEB SERVICES

Post by itsmani1 »

I am using EVENTINVENTORY WEB SERVICES and here is the code they have given in the documnetation. Here are their requirements :

In order to gain access to data, you need the following:

1) A valid security token
2) External IP address of the computer accessing Web Services. This IP Address should be a static IP Address (not dynamic.)
Please pass the above information and we would register your IP Address with EventInventory We Services
I have taken the "CLIENTID" and registered my IP i don't know where to pass it so that i can access it.

Code: Select all

/*
1.    Get the nuSoap.php version of 0.6.3. This works fine.
Or
2.    If you still want to use the 0.6.9 version or later, then replace the following line in nusoap.php
$payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
With
$payload .= $this->serialize_val($v,"$nsPrefix:$k",false,false,false,false,$use);
*/


// include the SOAP classes
require_once('nusoap.php');

// define parameter array
$param = array( 'APPCLIENT_ID' => '*CLIENTID*','EVENT_ID' => '','STARTDATE' => '','INCDAYS' => '');

// define path to server application
// Do not hard code the URL here. Get it from a central place like 
// configuration file. The below URL is hard coded just for example
// purpose.
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx';

//define method namespace
$namespace="http://www.eventinventory.com/webservices/";

// create client object
$soapclient = new soapclient($serverpath);

//set soap Action
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';

//to see debug messages
//$soapclient -> debug_flag = 1;

 // make the call
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction);

// if a fault occurred, output error info
if (isset($fault)) {
        print "Error: ". $fault;
        }
else if ($result) {

        if ($result[faultstring])
        {
         print"<h2>Error:</h2>
         $result[faultstring]";
        }
        else   //show results
        {
  $root=$result[ROOT];
              $data = $root[DATA];
  $row = $data[row];             

for($i=0;$i<count($row);$i++)
             {
                 $venueId = $row[$i]['!VID'];
                 $venueName = $row[$i]['!Name'];
                 $city = $row[$i]['!City'];
                 $state = $row[$i]['!State'];
                 $zip = $row[$i]['!ZipCode'];
                 print"$venueId : $venueName : $city : state :$zip<br>";
             }
        }
}
else {
        print "No result";
        }
// kill object
unset($soapclient);
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

It looks like you need to fill in the $param array something like this:

Code: Select all

$param = array(
        'APPCLIENT_ID' => 'YOUR_CLIENTID_GOES_HERE',
        'EVENT_ID' => $my_evend_id,
        'STARTDATE' => $my_start_date,
        'INCDAYS' => $my_inc_days,
        );
Your Client ID is always the same, but I assume the Event ID, Date and Days will be set by the application so you can set those somewhere else (e.g. data from a form).
(#10850)
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

arborint wrote:It looks like you need to fill in the $param array something like this:

Code: Select all

$param = array(
        'APPCLIENT_ID' => 'YOUR_CLIENTID_GOES_HERE',
        'EVENT_ID' => $my_evend_id,
        'STARTDATE' => $my_start_date,
        'INCDAYS' => $my_inc_days,
        );
Your Client ID is always the same, but I assume the Event ID, Date and Days will be set by the application so you can set those somewhere else (e.g. data from a form).
seems ok but i don't know what i have to do if i want to get list of all events and their start date?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Why do we have to read the docu for you?
http://services.preview.eventinventory.com/webservices/TicketSearch.asmx wrote:The following operations are supported. For a formal definition, please review the Service Description.

* GetAllVenues

* GetVenueList

* GetRegion

* GetAllRegions
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

nusoap.php problem

Post by itsmani1 »

From the help document:
4.2.6 PHP Clients

PHP has the luxury of using the NuSOAP Client to make Webservice calls. If you are using PHP, please download the latest version from http://sourceforge.net/projects/nusoap. Special thanks to Mangesh Bhamkar of Show Me Tickets for his work in providing a PHP Web Services client. Here is an example of making a call using PHP and NuSOAP. Put your own Client ID where *CLIENTID* is.

1. Get the nuSoap.php version of 0.6.3. This works fine.
Or
2. If you still want to use the 0.6.9 version or later, then replace the following line in nusoap.php
$payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
With
$payload .= $this->serialize_val($v,"$nsPrefix:$k",false,false,false,false,$use);

<?
// include the SOAP classes
require_once('nusoap.php');
// define parameter array
$param = array( 'APPCLIENT_ID' => '*CLIENTID*','EVENT_ID' => '','STARTDATE' => '','INCDAYS' => '');
// define path to server application
// Do not hard code the URL here. Get it from a central place like
// configuration file. The below URL is hard coded just for example
// purpose.
$serverpath ='http://services.Preview.EventInventory. ... earch.asmx';
//define method namespace
$namespace="http://www.eventinventory.com/webservices/";
// create client object
$soapclient = new soapclient($serverpath);
//set soap Action
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';
//to see debug messages
//$soapclient -> debug_flag = 1;
// make the call
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction);
// if a fault occurred, output error info
if (isset($fault)) {
print "Error: ". $fault;
}
else if ($result) {

if ($result[faultstring])
{
print"<h2>Error:</h2>
$result[faultstring]";
}
else //show results
{
$root=$result[ROOT];
$data = $root[DATA];
$row = $data[row];

for($i=0;$i<count($row);$i++)
{
$venueId = $row[$i]['!VID'];
$venueName = $row[$i]['!Name'];
$city = $row[$i]['!City'];
$state = $row[$i]['!State'];
$zip = $row[$i]['!ZipCode'];
print"$venueId : $venueName : $city : state :$zip<br>";
}
}
}
else {
print "No result";
}
// kill object
unset($soapclient);

?>
All data will be returned in “row” tags with attributes containing the data for each field. Example:

<DATA xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<row THISID="2" THISNAME="Alabama" />
<row THISID="55" THISNAME="Alberta" />
</DATA>

The above example shows row tags inside the DATA tag. The DATA tag contains all the data returned from the database. The row tags contain data for each column. In this example, there are two columns: THISID and THISNAME. Two rows of data were returned. Different Webservice Methods may return different data that has different attributes within the row tags. You will need to familiarize yourself with each Webservice Method’s result set so that you will know what attributes to expect. We will provide documentation on the result set to expect for each Webservice Method.

Now you can extract data from XML served up by EventInventory Web Services to display however you wish on your Web site.
Now I have downloaded nusoap-0.7.2 and tried to use it this way:

Code: Select all

// include the SOAP classes
require_once('lib/nusoap.php');
// define parameter array
$param = array( 'APPCLIENT_ID' => '2220','EVENT_ID' => '66','STARTDATE' => '','INCDAYS' => '');

// define path to server application
// Do not hard code the URL here. Get it from a central place like 
// configuration file. The below URL is hard coded just for example
// purpose.
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx';

//define method namespace
$namespace="http://www.eventinventory.com/webservices/";

// create client object
$soapclient = new soapclient($serverpath);

//set soap Action
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';

//to see debug messages
//$soapclient -> debug_flag = 1;

 // make the call
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction);

// if a fault occurred, output error info
if (isset($fault)) {
        print "Error: ". $fault;
        }
else if ($result) {

        if ($result[faultstring])
        {
         print"<h2>Error:</h2>
         $result[faultstring]";
        }
        else   //show results
        {
  $root=$result[ROOT];
              $data = $root[DATA];
  $row = $data[row];             

for($i=0;$i<count($row);$i++)
             {
                 $venueId = $row[$i]['!VID'];
                 $venueName = $row[$i]['!Name'];
                 $city = $row[$i]['!City'];
                 $state = $row[$i]['!State'];
                 $zip = $row[$i]['!ZipCode'];
                 print"$venueId : $venueName : $city : state :$zip<br>";
             }
        }
}
else {
        print "No result";
        }
// kill object
unset($soapclient);
Result:
Fatal error: Cannot redeclare class soapclient in /opt/lampp/htdocs/projects/abc/lib/nusoap.php on line 7240
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

That error does sounds like you are including the nusoap code more than once.
(#10850)
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

arborint wrote:That error does sounds like you are including the nusoap code more than once.
thanks for the reply,

issue has been solved now.
I was using php 5.1.1 and it has builtin support for the soap and i was using it again by including where its class is been declared, that's why i was facing this problem.
when i tried :

Code: Select all

echo phpinfo();
I come to know that soap is enabled in it.

Now i have a small question,
how can i disable it. I wanted to disable soap
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

itsmani1 wrote:how can i disable it. I wanted to disable soap
Either do not load it in the php.ini file or to recompile without the --with-soap flag.
(#10850)
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

Please help me for this small problem as well: hope this will be the last one.

Code: Select all

$param = array( 'APPCLIENT_ID' => '2220','EVENT_ID' => '','STARTDATE' => '','INCDAYS' => '');

// define path to server application
// Do not hard code the URL here. Get it from a central place like 
// configuration file. The below URL is hard coded just for example
// purpose.
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx';

//define method namespace
$namespace="http://www.eventinventory.com/webservices/";

// create client object
$soapclient = new soapclient($serverpath);

//set soap Action
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';

//to see debug messages
//$soapclient -> debug_flag = 1;

 // make the call
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction);

// if a fault occurred, output error info
if (isset($fault)) {
        print "Error: ". $fault;
        }
else if ($result) {

        if ($result[faultstring])
        {
         print"<h2>Error:</h2>
         $result[faultstring]";
        }
        else   //show results
        {
  $root=$result[ROOT];
              $data = $root[DATA];
  $row = $data[row];             

for($i=0;$i<count($row);$i++)
             {
                 $venueId = $row[$i]['!VID'];
                 $venueName = $row[$i]['!Name'];
                 $city = $row[$i]['!City'];
                 $state = $row[$i]['!State'];
                 $zip = $row[$i]['!ZipCode'];
                 print"$venueId : $venueName : $city : state :$zip<br>";
             }
        }
}
else {
        print "No result";
        }
// kill object
unset($soapclient);
Result :

Warning: SoapClient::__construct() [function.--construct]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27

Warning: SoapClient::__construct(http://services.Preview.EventInventory. ... earch.asmx) [function.--construct]: failed to open stream: Connection refused in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27

Warning: SoapClient::__construct() [function.--construct]: I/O warning : failed to load external entity "http://services.Preview.EventInventory. ... earch.asmx" in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://services.Preview.EventInventory. ... earch.asmx' in /opt/lampp/htdocs/projects/Mannan/nutest.php:27 Stack trace: #0 /opt/lampp/htdocs/projects/Mannan/nutest.php(27): SoapClient->__construct('http://services...') #1 {main} thrown in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I'd prefer the php 5 built-in xml/soap capabilities to nusoap but that's just an opinion.
itsmani1 wrote:Warning: SoapClient::__construct() [function.--construct]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27
Your server is unable to resolve the web address. Is there a dns service up and running?
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

I have two servers one with php 5.1.1 with SOAP and other with php 4.x without SOAP

when i run it on server with soap gets following reslt:
Warning: SoapClient::__construct() [function.--construct]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27

Warning: SoapClient::__construct(http://services.Preview.EventInventory. ... earch.asmx) [function.--construct]: failed to open stream: Connection refused in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27

Warning: SoapClient::__construct() [function.--construct]: I/O warning : failed to load external entity "http://services.Preview.EventInventory. ... earch.asmx" in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://services.Preview.EventInventory. ... earch.asmx' in /opt/lampp/htdocs/projects/Mannan/nutest.php:27 Stack trace: #0 /opt/lampp/htdocs/projects/Mannan/nutest.php(27): SoapClient->__construct('http://services...') #1 {main} thrown in /opt/lampp/htdocs/projects/Mannan/nutest.php on line 27
and when i run the server without SOAP and use my own soap gets following result:

No result

here is my code : where soap is not installed, and where soap is installed i just out commnets with require_once('lib/nusoap.php');

Code: Select all

// include the SOAP classes
require_once('lib/nusoap.php');

// define parameter array
$param = array( 'APPCLIENT_ID' => '2220','EVENT_ID' => '','STARTDATE' => '','INCDAYS' => '');

// define path to server application
// Do not hard code the URL here. Get it from a central place like 
// configuration file. The below URL is hard coded just for example
// purpose.
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx';

//define method namespace
$namespace="http://www.eventinventory.com/webservices/";

// create client object
$soapclient = new soapclient($serverpath);

//set soap Action
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';

//to see debug messages
//$soapclient -> debug_flag = 1;

 // make the call
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction);

// if a fault occurred, output error info
if (isset($fault))
{
        print "Error: ". $fault;
}
else if ($result)
{

        if ($result[faultstring])
        {
         print"<h2>Error:</h2>
         $result[faultstring]";
        }
        else   //show results
        {
  $root=$result[ROOT];
              $data = $root[DATA];
  $row = $data[row];             

for($i=0;$i<count($row);$i++)
             {
                 $venueId = $row[$i]['!VID'];
                 $venueName = $row[$i]['!Name'];
                 $city = $row[$i]['!City'];
                 $state = $row[$i]['!State'];
                 $zip = $row[$i]['!ZipCode'];
                 print"$venueId : $venueName : $city : state :$zip<br>";
             }
        }
}
else {
        print "No result";
        }
// kill object
unset($soapclient);
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Still, your server cannot resolve the web address. This has nothing (almost nothing) to do with php or soap and there's no need to post the script code again.
Open a shell/command window on the server and type ping services.Preview.EventInventory.com
What does it return?
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

I tried :

ping services.Preview.EventInventory.com and got following result:

ping:unknow host services.Preview.EventInventory.com

what's the problem, is it working fine or not?

if there is a problem how can i solve it?

thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

No, this is not ok.
It should have been something like
Ping services.Preview.EventInventory.com [204.14.204.53]
204.14.204.53 beeing the actual address and services.Preview.EventInventory.com only the more or less human readable name.
Your server is not able to resolve services.Preview.EventInventory.com to 204.14.204.53
What type of server is it? Is this your own private (homebrew) server?
If you have a manual for it see if there are how-tos for address resolution, dns, arp or similar.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

volka wrote:No, this is not ok.
It should have been something like
Ping services.Preview.EventInventory.com [204.14.204.53]
204.14.204.53 beeing the actual address and services.Preview.EventInventory.com only the more or less human readable name.
Your server is not able to resolve services.Preview.EventInventory.com to 204.14.204.53
What type of server is it? Is this your own private (homebrew) server?
If you have a manual for it see if there are how-tos for address resolution, dns, arp or similar.

I opened the command window, tried it again and got the following result.

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>ping services.preview.eventinventory.com

Pinging services.preview.eventinventory.com [204.14
a:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 204.14.204.53:
Packets: Sent = 4, Received = 0, Lost = 4 (100%
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Please look at the above result and let me know if its ok or not? I think its ok as it responded once, yes I am using my own home based server. I don't know why i am stucked?
Post Reply