On 15 June 2010 17:07, Michael Shadle <mike503@xxxxxxxxx> 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 <rquadling@xxxxxxxxx> wrote: > >> On 15 June 2010 12:44, John <john.zakaria@xxxxxxxxxxxxxx> 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 = '<HotelsParameters><CityID>388</CityID><UserName>admin</UserName><UserPassword>admin</UserPassword><DateFrom>6/12/2010</DateFrom><DateTo>6/13/2010</DateTo><NumberOfRooms>2</NumberOfRooms><Room><RoomSerial>1</RoomSerial><Adults>1</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>5</ChildAge></Child></Room><Room><RoomSerial>2</RoomSerial><Adults>2</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>8</ChildAge></Child><Child><ChildSerial>2</ChildSerial><ChildAge>5</ChildAge></Child></Room><CurrencyID>162</CurrencyID></HotelsParameters>'; >>> >>> >>> >>> $result = $client->HotelsSearch($params); >>> >>> //echo $result; >>> >>> } catch (SOAPFault $exception) { >>> >>> >>> >>> print $exception; >>> >>> print htmlspecialchars($client->__getLastRequest()); >>> >>> } >>> >>> >>> >>> var_dump($result); >>> >>> >>> >>> ?> >>> >>> >>> >>> Note: the string is ' <HotelsParameters><CityID>388</CityID><UserName>admin</UserName><UserPassword>admin</UserPassword><DateFrom>6/12/2010</DateFrom><DateTo>6/13/2010</DateTo><NumberOfRooms>2</NumberOfRooms><Room><RoomSerial>1</RoomSerial><Adults>1</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>5</ChildAge></Child></Room><Room><RoomSerial>2</RoomSerial><Adults>2</Adults><Child><ChildSerial>1</ChildSerial><ChildAge>8</ChildAge></Child><Child><ChildSerial>2</ChildSerial><ChildAge>5</ChildAge></Child></Room><CurrencyID>162</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.zakaria@xxxxxxxxxxxxxx >>> >>> 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=ZEND002498&r=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 => wsdl_like_file then I could take the wsdl_like_file and produce my classes to access your service. I wouldn't need to care about the protocol. In fact, using the Zend framework as I've suggested, I've not written a single line of XML parsing, or header extraction or anything. Just talked to some local classes as if there was no distance between the client and the server. Client_class extends base_soap_client_class <=> base_soap_server_class extended by Server_Class SOAP has it's faults, but it is a standard of sorts and that certainly helps third parties know they are writing to a standard. But SOAP has more overhead admittedly and in some cases it may not be ideal. -- ----- 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=ZEND002498&r=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