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:

Web Services

Post by itsmani1 »

Hello

I am bit new to nuSOAP. I wanted to send request using nuSOAP using xml to a web services and then after getting the response i need to display the next page. Can anyone help me out?

I don't know how to send and then after getting the response dispaly it.

Please see : http://208.109.22.111/ticketchest/nutest.php
Using SOAP I am

Code: Select all

require_once('lib/nusoap.php');
// define parameter array
$param = array( 'APPCLIENT_ID' => '2220','EVENT_ID' => '159','STARTDATE' => '','INCDAYS' => '');

// define path to server application
$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)
{
    
  // Display the result
  echo '<h2>Result</h2>';
  var_dump($result);
  
  // Display the request and response
  echo '<h2>Request</h2>';
  echo '' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '';
  echo '<h2>Response</h2>';
  echo '' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '';
  
    // Display the debug messages
  echo '<h2>Debug</h2>';
  echo '<pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>';
Please see the out i don't think that its a correct output
any idea?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

According to the wsdl GetVenueList() takes sequence/list/array as parameter.
With php5's soap extension

Code: Select all

<?php
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx?wsdl';
$soapclient = new SoapClient($serverpath);

$param = array( 'APPCLIENT_ID' => 'xxxx','EVENT_ID' => '159','STARTDATE' => '','INCDAYS' => '');
$r = $soapclient->GetVenueList($param);
?>
is "working" as well as

Code: Select all

$r = $soapclient->__soapCall('GetVenueList', array($param));
<parameters>APPCLIENT_ID=xxxx&EVENT_ID=159&STARTDATE=&INCDAYS=</parameters><processTime type="milliseconds">433.8637</processTime></METHODINFO><MESSAGE>IP Address: xx.xx.xx.xx is not enabled for Client: Ticket Chest (Security Token: 2220). Please contact Customer Service at 877.800.3434 (ext. 4110) to register your new IP Address.</MESSAGE>
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

I don't have php5 and trying this code :

Code: Select all

require_once('lib/nusoap.php');
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx?wsdl';
$soapclient = new SoapClient($serverpath);

$param = array( 'APPCLIENT_ID' => '2220','EVENT_ID' => '159','STARTDATE' => '','INCDAYS' => '');
$r = $soapclient->GetVenueList($param); 
var_dump($result);
i think it should work

how to check the output? this is the question
i tried var_dump($result); but not getting anyoutput.

How i can confirm the output for this?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I really don't think nuSoap can export the soap methods like $soapclient->GetVenueList. Not possible with php4 and I doubt it does when php5 is detected.
itsmani1 wrote:I don't have php5
And I don't have php4 and nuSoap. All I wanted show is that
array(array('APPCLIENT_ID'=>xyz, ...)) is working while array('APPCLIENT_ID'=>xyz,...) is not.
And that's maybe true for nuSoap, too.

itsmani1 wrote:i tried var_dump($result); but not getting anyoutput.
The script probably doesn't reach that line of code.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

you are right that it wasn't reaching till dump_var();

Well I checked the documet given by EventInventory and they suggest to use nusoap.php for this.
as they are providing the service means it should work. and i have included it.


Now i tried this code and it giving me some output
you can see at : http://208.109.22.111/ticketchest/nutest.php

Code: Select all

require_once('lib/nusoap.php');
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx?wsdl';
$soapclient = new SoapClient($serverpath);
$namespace="http://www.eventinventory.com/webservices/";
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';

$param = array( 'APPCLIENT_ID' => '2220','EVENT_ID' => '159','STARTDATE' => '','INCDAYS' => '');
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction); 
echo "Result <BR />";
var_dump($result);
If you have tested it ever can you please show me the sample results
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

hm sorry, I thought this was obvious by now; you should try to adopt

Code: Select all

$r = $soapclient->__soapCall('GetVenueList', array($param));
i.e.

Code: Select all

$result = $soapclient->call('GetVenueList', array($param), $namespace, $soapAction);
does it work this way?
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

yes its working using this way.
the one last thing i wanted to knwo how i will check response? is ther any way to check the response?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

What does "check" exactly mean?
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

Well,

see http://208.109.22.111/ticketchest/nutest.php there are three or four main headings if you look into to result you will see security token problem, Request is ok but in Response you will again see this problem
Result :
You did not provide a Security Token (APPCLIENT_ID). Please contact Customer Service at 877.800.3434 (ext. 4110) to obtain a Security Token
Response:
You did not provide a Security Token (APPCLIENT_ID). Please contact Customer Service at 877.800.3434 (ext. 4110) to obtain a Security Token

currently i am giving "2220" as my security token, its given me by service provider.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

That's because
<parameters>APPCLIENT_ID=&EVENT_ID=&STARTDATE=&INCDAYS=</parameters>
it still doesn't recognize the parameters at all.
The server could send special soap notification but apparently it doesn't.
If you get a GetVenueListResponse then seemingly all went well. If you get a message something failed.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

can you please suggest me some solution
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

can you please show me your current code?
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

here is my current code

Code: Select all

<?PHP
require_once('lib/nusoap.php');
$param = array( 'APPCLIENT_ID' => '2220','EVENT_ID' => '159','STARTDATE' => '','INCDAYS' => '');
$serverpath ='http://services.Preview.EventInventory.com/webservices/TicketSearch.asmx';
$namespace="http://www.eventinventory.com/webservices/";
$soapclient = new soapclient($serverpath);
$soapAction='http://www.eventinventory.com/webservices/GetVenueList';
$result = $soapclient->call('GetVenueList',$param,$namespace,$soapAction);
if (isset($fault))
{
        print "Error: ". $fault;
}
else if ($result)
{

  echo '<h2>Result</h2>';
  var_dump($result);
  
  // Display the request and response
  echo '<h2>Request</h2>';
  echo '' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '';
  echo '<h2>Response</h2>';
  echo '' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '';
    // Display the debug messages
  echo '<h2>Debug</h2>';
  echo '<pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>';
  
}
else
{
	print "No result";
}
unset($soapclient);
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

itsmani1 wrote:yes its working using this way.
And then you changed it back to the "not working" version only to ask me how to fix it? That's weird to say the very least.
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

itsmani1 wrote:yes its working using this way.
means its not giving me an error, at the same time its not giving me correct output.
Post Reply