Re: [PHP] Re: [PHP-WEBMASTER] Web Service Problem

2010-06-15 Thread Michael Shadle
Wso2 is also pretty awesome.

I wish soap would just die and be replaced with rest and json.

On Jun 15, 2010, at 6:15 AM, Richard Quadling rquadl...@gmail.com wrote:

 On 15 June 2010 12:44, John john.zaka...@graphicano.com wrote:
 
 
 
 Really i need help coz i am trying to solve this problem from 4 weeks and i 
 can not so please help me
 
 I want to use a web service ( created in ASP.NEt ) in my web site using php 
 coz i will use the result in other php pages.
 the web service link is: 
 http://196.218.16.133/onlinereservation/service.asmx?WSDL
 
 function name: HotelData  under HotelsSearch
 
 Is there a tool for PHP or any other way to pass string for HotelDataand 
 get an XML file containing the result?
 
 
 
 I tried to learn SOAP  in the manual  and I can not till now return data 
 from this web service
 
 
 
 My Code is:
 
 
 
 ?
 
 header(Content-Type: text/plain);
 
 $client = new 
 SOAPClient('http://196.218.16.133/OnlineReservationTravelline/service.asmx?WSDL');
 
 
 
 try {
 
   $params-HotelData = 
 'HotelsParametersCityID388/CityIDUserNameadmin/UserNameUserPasswordadmin/UserPasswordDateFrom6/12/2010/DateFromDateTo6/13/2010/DateToNumberOfRooms2/NumberOfRoomsRoomRoomSerial1/RoomSerialAdults1/AdultsChildChildSerial1/ChildSerialChildAge5/ChildAge/Child/RoomRoomRoomSerial2/RoomSerialAdults2/AdultsChildChildSerial1/ChildSerialChildAge8/ChildAge/ChildChildChildSerial2/ChildSerialChildAge5/ChildAge/Child/RoomCurrencyID162/CurrencyID/HotelsParameters';
 
 
 
   $result = $client-HotelsSearch($params);
 
   //echo $result;
 
 } catch (SOAPFault $exception) {
 
 
 
   print $exception;
 
   print htmlspecialchars($client-__getLastRequest());
 
 }
 
 
 
 var_dump($result);
 
 
 
 ?
 
 
 
 Note: the string is ' 
 HotelsParametersCityID388/CityIDUserNameadmin/UserNameUserPasswordadmin/UserPasswordDateFrom6/12/2010/DateFromDateTo6/13/2010/DateToNumberOfRooms2/NumberOfRoomsRoomRoomSerial1/RoomSerialAdults1/AdultsChildChildSerial1/ChildSerialChildAge5/ChildAge/Child/RoomRoomRoomSerial2/RoomSerialAdults2/AdultsChildChildSerial1/ChildSerialChildAge8/ChildAge/ChildChildChildSerial2/ChildSerialChildAge5/ChildAge/Child/RoomCurrencyID162/CurrencyID/HotelsParameters’
 
 
 
 
 
 John Zakaria Sabry
 Senior Web Developer
 
 
 
 3 El Nasr Street, EL Nozha EL Gedida,
  Heliopolis, Cairo, Egypt
 
 Phone: +202 262 00 755 - +2 012 551 5551
 
 Fax: +202 262 00 755
 
 Mobile: +2 018 131 91 89
 
 john.zaka...@graphicano.com
 
 www.graphicano.com
 
 
 
 http://pastebin.com/cuXnT9Fb
 
 That contains some PHP classes which are based upon the WSDL file. The
 conversion is with the sourceforge wsdl2php project (with some mods).
 
 In YOUR code ...
 
 ?php
 // Include the classes which wrap the SOAP service for you.
 require_once 'service.php';
 
 try
{
// Create a new Service (unforuntate name - maybe ReservationSystem
 or something - Service is VERY generic).
$Service = new Service();
 
// Let's do a tour search.
$TourSearchRequest = new TourSearch();
 
// Populate the TourSearchRequest.
$TourSearchRequest-date = '2010/01/01';
 
// Run the search.
$TourSearchResponse = $Service-TourSearch($TourSearchRequest);
 
// Dump the response (expecting it to be of class TourSearchResponse.
var_dump($TourSearchResponse);
}
 
 catch(Exception $ex)
{
// Dump the exception, taking note of faultstring and faultcode as
 these are SOAP Server generated errors.
var_dump($ex);
}
 ?
 
 But this is generating a SOAP exception on the server, so the client
 code won't help here.
 
 [faultstring]=string(96) Server was unable to process request.
 --- Object reference not set to an instance of an object.
 [faultcode]=string(11) soap:Server
 [detail]=string(0) 
 
 How are you building the WSDL file? By hand? If so, I would recommend
 learning about using DocBlocks and a tool to auto generate the WSDL
 file.
 
 I use a modified version of Zend's SOAP, WSDL and AutoDiscovery tools
 to build my WSDL files from my source code.
 
 I then use a modified sourceforge's wsdl2php project to convert the
 wsdl file to normal PHP classes which do all the wrapping of the SOAP
 comms for me and let's me use normal PHP coding as if all the services
 were local and not on a remote server.
 
 Richard.
 
 
 
 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: [PHP-WEBMASTER] Web Service Problem

2010-06-15 Thread Richard Quadling
On 15 June 2010 17:07, Michael Shadle mike...@gmail.com wrote:
 Wso2 is also pretty awesome.

 I wish soap would just die and be replaced with rest and json.

 On Jun 15, 2010, at 6:15 AM, Richard Quadling rquadl...@gmail.com wrote:

 On 15 June 2010 12:44, John john.zaka...@graphicano.com wrote:



 Really i need help coz i am trying to solve this problem from 4 weeks and i 
 can not so please help me

 I want to use a web service ( created in ASP.NEt ) in my web site using php 
 coz i will use the result in other php pages.
 the web service link is: 
 http://196.218.16.133/onlinereservation/service.asmx?WSDL

 function name: HotelData  under HotelsSearch

 Is there a tool for PHP or any other way to pass string for HotelData    
 and get an XML file containing the result?



 I tried to learn SOAP  in the manual  and I can not till now return data 
 from this web service



 My Code is:



 ?

 header(Content-Type: text/plain);

 $client = new 
 SOAPClient('http://196.218.16.133/OnlineReservationTravelline/service.asmx?WSDL');



 try {

           $params-HotelData = 
 'HotelsParametersCityID388/CityIDUserNameadmin/UserNameUserPasswordadmin/UserPasswordDateFrom6/12/2010/DateFromDateTo6/13/2010/DateToNumberOfRooms2/NumberOfRoomsRoomRoomSerial1/RoomSerialAdults1/AdultsChildChildSerial1/ChildSerialChildAge5/ChildAge/Child/RoomRoomRoomSerial2/RoomSerialAdults2/AdultsChildChildSerial1/ChildSerialChildAge8/ChildAge/ChildChildChildSerial2/ChildSerialChildAge5/ChildAge/Child/RoomCurrencyID162/CurrencyID/HotelsParameters';



           $result = $client-HotelsSearch($params);

           //echo $result;

 } catch (SOAPFault $exception) {



           print $exception;

           print htmlspecialchars($client-__getLastRequest());

 }



 var_dump($result);



 ?



 Note: the string is ' 
 HotelsParametersCityID388/CityIDUserNameadmin/UserNameUserPasswordadmin/UserPasswordDateFrom6/12/2010/DateFromDateTo6/13/2010/DateToNumberOfRooms2/NumberOfRoomsRoomRoomSerial1/RoomSerialAdults1/AdultsChildChildSerial1/ChildSerialChildAge5/ChildAge/Child/RoomRoomRoomSerial2/RoomSerialAdults2/AdultsChildChildSerial1/ChildSerialChildAge8/ChildAge/ChildChildChildSerial2/ChildSerialChildAge5/ChildAge/Child/RoomCurrencyID162/CurrencyID/HotelsParameters’





 John Zakaria Sabry
 Senior Web Developer



 3 El Nasr Street, EL Nozha EL Gedida,
  Heliopolis, Cairo, Egypt

 Phone: +202 262 00 755 - +2 012 551 5551

 Fax: +202 262 00 755

 Mobile: +2 018 131 91 89

 john.zaka...@graphicano.com

 www.graphicano.com



 http://pastebin.com/cuXnT9Fb

 That contains some PHP classes which are based upon the WSDL file. The
 conversion is with the sourceforge wsdl2php project (with some mods).

 In YOUR code ...

 ?php
 // Include the classes which wrap the SOAP service for you.
 require_once 'service.php';

 try
    {
    // Create a new Service (unforuntate name - maybe ReservationSystem
 or something - Service is VERY generic).
    $Service = new Service();

    // Let's do a tour search.
    $TourSearchRequest = new TourSearch();

    // Populate the TourSearchRequest.
    $TourSearchRequest-date = '2010/01/01';

    // Run the search.
    $TourSearchResponse = $Service-TourSearch($TourSearchRequest);

    // Dump the response (expecting it to be of class TourSearchResponse.
    var_dump($TourSearchResponse);
    }

 catch(Exception $ex)
    {
    // Dump the exception, taking note of faultstring and faultcode as
 these are SOAP Server generated errors.
    var_dump($ex);
    }
 ?

 But this is generating a SOAP exception on the server, so the client
 code won't help here.

 [faultstring]=string(96) Server was unable to process request.
 --- Object reference not set to an instance of an object.
 [faultcode]=string(11) soap:Server
 [detail]=string(0) 

 How are you building the WSDL file? By hand? If so, I would recommend
 learning about using DocBlocks and a tool to auto generate the WSDL
 file.

 I use a modified version of Zend's SOAP, WSDL and AutoDiscovery tools
 to build my WSDL files from my source code.

 I then use a modified sourceforge's wsdl2php project to convert the
 wsdl file to normal PHP classes which do all the wrapping of the SOAP
 comms for me and let's me use normal PHP coding as if all the services
 were local and not on a remote server.

 Richard.



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



REST is a concept, not a protocol (as I understand it), so you cannot
just create a service and supply a contract file. You have to document
the service in some other way and then the users have to write all the
code.

If there was a REST+DocBlock = 

Re: [PHP] Re: [PHP-WEBMASTER] Web Service Problem

2010-06-15 Thread Michael Shadle
On Tue, Jun 15, 2010 at 10:14 AM, Richard Quadling rquadl...@gmail.com wrote:

 REST is a concept, not a protocol (as I understand it), so you cannot
 just create a service and supply a contract file. You have to document
 the service in some other way and then the users have to write all the
 code.

I know it's a concept, but using that concept as the language or
data transport and the data format being JSON. I could try to map
these to OSI model or TCP/IP model levels but I can't be bothered. I
just find SOAP to be too bloated and an annoyance to work with.

I mean, technically, a SOAP request is RESTful too since it can use
POST or GET... but I don't like to consider it RESTful :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php