Jump to content

ajlisowski

Members
  • Posts

    114
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ajlisowski's Achievements

Member

Member (2/5)

0

Reputation

  1. I am having an issue when trying to access my own PHP Soap Service with PHP. Technically I am using Zend_Soap for both, but I do not think this is a zend specific problem, but perhaps it is. Basically, the result I get from the client is null. However if I look at the last response, it contains the expected, correct XML. So the client is failing to convert the xml to a php object (in my test case, a simple string) for use. my wsdl looks like this definitions name="SOAP_Model_soaphandler" targetNamespace="http://website.com/appldev/applications/public/SOAP/index/soap"> <types> <xsd:schema targetNamespace="http://website.com/appldev/applications/public/SOAP/index/soap"/> </types> <portType name="SOAP_Model_soaphandlerPort"> <operation name="test"> <documentation>Returns list of all products in database</documentation> <input message="tns:testIn"/> <output message="tns:testOut"/> </operation> <operation name="test2"> <documentation>Adds new product to database</documentation> <input message="tns:test2In"/> <output message="tns:test2Out"/> </operation> </portType> <binding name="SOAP_Model_soaphandlerBinding" type="tns:SOAP_Model_soaphandlerPort"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="test"> <soap:operation soapAction="http://website.com/appldev/applications/public/SOAP/index/soap#test"/> <input> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/> </input> <output> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/> </output> </operation> <operation name="test2"> <soap:operation soapAction="http://website.com/appldev/applications/public/SOAP/index/soap#test2"/> <input> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/> </input> <output> <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://website.com/appldev/applications/public/SOAP/index/soap"/> </output> </operation> </binding> <service name="SOAP_Model_soaphandlerService"> <port name="SOAP_Model_soaphandlerPort" binding="tns:SOAP_Model_soaphandlerBinding"> <soap:address location="http://website.com/appldev/applications/public/SOAP/index/soap"/> </port> </service> <message name="testIn"/> <message name="testOut"> <part name="return" type="xsd:int"/> </message> <message name="test2In"> <part name="id" type="xsd:int"/> </message> <message name="test2Out"> <part name="return" type="soap-enc:Array"/> </message> </definitions>[/code my response looks like this [code] <env:envelope xmlns:enc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://website.com/appldev/applications/public/SOAP/index/soap" xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"> <ns1:testresponse env:encodingstyle="http://www.w3.org/2003/05/soap-encoding"> <rpc:result>return</rpc:result> <return xsi:type="xsd:int">7</return> </ns1:testresponse> </env:body> </env:envelope> but $result=$client->test(); var_dump($result); outputs NULL. Any ideas?
  2. Ok, so it turns out that even though I was setting the wsdl to not be cached in the client, i wasnt for the server. So the server was using an old WSDL generated from a class without the php comment declarations. I am now successfully getting a proper response back from the server, however when I print out the result, it is empty. $client->getLastRequest() has properly formatted xml, but I cant seem the access the response. var_dump gives a null result. I should be able to figure this part out without too much trouble though.
  3. I am having a number of issues attempting to set up and utilize SOAP in zend. First, when I create my WSDL on my wsdl it returns: However if I add die(""); to the end of my wsdlAction() I properly get the xml WSDL to display. I am not sure why I need to add that, as I have disabled layouts and scripts in the preDisptach for the controller. So, adding die("") I got my WSDL up and running which is awesome. But now contacting it via a client is not working. I am getting a soap fault of code HTTP and string Internal Server Error. Further investigation into the stack trace shows the error occuring in /library/Zend/Soap/Client.php on line 989. This appears to be the code call_user_func(array($client,'SoapClient::__doRequest'),$request,$location,$action,$version) I do not know how to debug any further. I am not sure what is causing it. I am relatively sure my WSDL issue is not related. My WSDL is fine with the die("") so the client is reading it fine. The issue is in performing the request. Any ideas what is happening here?
  4. So, I am able to get the availability via PIVOT on the Time field twice. Once to get any repeating or scheduled unavailability and once to get any cancels. Having both Cancels and whether or not something is scheduled, I know whether or not a user is available for that time. Assignments is another story. I could get the total number of assignments for that time using the same pivot plan. However, I need more info than that. I need to get actual appointment information scheduled for that hour, not just how many. Since Pivot requires an aggregate function to return values I can not return a concatination of data back. I'm guessing ill have to talk to my DBA and get a function created to do a group_concat.
  5. Hi, I have written a system that displays the users availabilityfor the day. Basically there is a user table, an assignment table and an availabilitytable. The system I have works fine for a smaller data set, but I have run into problems when loading more users at once. Basically I am having trouble grabbing their schedule for the day in one query. Users table, for the purposes of this question is user UserID, Name assignment is AssignmentID, UserID, AppointmentID appointment is AppointmentID, AppointmentDate, AppointmentTime availability is AvailabilityID, UserID, Date, Time, Repeating, Cancel Repeating is a bool that repeats on all days that match the same day of the week for that time. Cancel is a bool that says to not execute the repeating availability for that day/time. So if someone has a repeating event scheduled for every monday at 1pm, but they also have a cancel event scheduled for today at 1pm, they will be free today at 1pm. Anyway, I want a query that returns the user information, including a string showing their schedule for every hour of the day. so UserID, Name,8,9,10,11,12,13,14,15,16,17,18,19 where each field 8-19 is a string containing either the user being unavailable for that hour, or a list of the assignments they have for that hour. The only way I can think to do this off the top of my head is to make a join on the availability table and assignment table for every hour. But that seems inefficient and I would assume there is a much better way. Right now I load the user availability and assignments for each user in a seperate queries. But obviously if there's 100+ users Im showing at once, thats 200+ queries for each user. Id much prefer to load in all that info in one query. Any ideas?
  6. Basically I want to write a query that checks to see if data exists in multiple ranges. So lets say I have a numeric field "data". I want to write a query to see if a row exists with data >2 AND data between 2 and 1 AND data less then 1. I want to see if a row exists in all 3 of these ranges. I could do 3 separate queries, or I could do 1 query with two UNIONs but is that any better? Is there any reason to union them over doing 1 query? Is there another option that I am missing?
  7. Wow...yeah thats a lot simpler then what I did. Hah. I feel foolish for not thinking of that, thanks a bunch.
  8. Maybe I asked the question wrong... basically I have a table of opportunities, these can either be sold, lost or open. Opportunity Status Salesman ID 1 Open 120 2 Sold 120 3 Lost 120 I would want a query that would get me the following row as a return Total Opportunities Closed Opportunities Lost Opportunities 3 2 1 So I would need to group by salesman ID and then count the total number of opportunities, the total number of opportunities which are either sold or lost, then the total number of opportunities which are lost. Right now I am doing so with the following query SELECT s.`id`, count(DISTINCT open.`id`)+ count(DISTINCT sold.`id`)+ count(DISTINCT lost.`id`) AS `total` count(DISTINCT sold.`id`)+ count(DISTINCT lost.`id`) AS `closed` count(DISTINCT lost.`id`) AS `lost` FROM `salesman` AS `s` JOIN `opportunities` AS `open` ON (open.`salesman_id`=s.`id` AND (open.`status`!='sold' AND open.`status`!='lost')) JOIN `opportunities` AS `sold` ON (sold.`salesman_id`=s.`id` AND sold.`status`='sold' ) JOIN `opportunities` AS `lost` ON (lost.`salesman_id`=s.`id` AND lost.`status`='lost') GROUP BY s.`id` It works but it seems like a roundabout way of accomplishing what I want. But I can not think of any other way, cause I want to pretty much have a where statement within my count, and the only way i can think of doing that is with a join.
  9. Ah, Im guessing I would have to do a count(distinct blah) and then use joins to get both the sold and the total. Is this the correct method or am I making things way too difficult?
  10. So I need to have a query that grabs some sales figures by salesman. It would need to report back the total opportunities and also how many of those were sold. If I just wanted to get the amount sold I could do the followng SELECT `lret_retailsalesman_id_c`, count(`id`) FROM `lret_retailopportunity` WHERE `status`='sold' But how would I do a query that returns both the amount sold and the total amount in one line?
  11. Yes, if you store the object in the session it should act exactly as how it did before hand. Others have mentioned autoloading but its important to note that if you store an object in a session it either needs to be autoloaded or the class of the object needs to already have been defined by the time session_start() is called. Personally I never store objects in a session. For a user I would just store the ID of the user and have some piece of code run that would recreate the object based on that ID whenever it is needed (or even automatically on every page, but that's the benifit of having a single point of access). OO in php is a bit hard to grasp coming from C++ and the like specifically because of the fact the objects are not carried throughout the session. By this I just meant a function that will take the ID of the object and grab data from the DB and set the various variables within the class.
  12. You would create a session with whatever data you need to recreate the object and then do so, php itself does not store the object. You CAN serialize an object and store it in a session and then deserialize it, but I do not recommend doing so. Usually if it is a lot of information you would store it in a database and then store the primary key in a session and create a function in the class which will reset its objects based on the DB info.
  13. I am in the midst of developing a web application and despite having a decent amount of experience in web development, I never really stopped and gave a ton of thought to memory when it comes to my php scripts. However, with this project I am using zend framework and it is a decent memory hog. So I have some questions... I am monitoring my memory use for a typical call to my site and it appears as though its somewhere around 20MB. This seems like a ton and I am actively looking for ways to decrease it. One thing I noticed is that when I call zend's date class for the first time, my memory usage shoots up 3MB. However it is pretty much untouched for other instances of this class. So if I do echo(memory_get_usage()); echo('<br />'); $this->last_login=Zend_Date::now(); echo(memory_get_usage()); echo('<br />'); $this->last_active=Zend_Date::now(); echo(memory_get_usage()); echo('<br />'); The result is So the jump is with that first call. My question is, if two users are accessing the site at the same time, will they both experience that 3MB memory use? Or will the server have that class in memory so it only uses 3MB once? Basically, if a call to the site uses 20MB of memory, will it be 20MB * the number of users. Or will the server have a lot of the information loaded into memory to subsequent calls so multiple users would use up far less memory then the initial? I would assume the latter is the case based on the fact that reusing zend_date doesn't incur a 3MB hit every time. But without being admin of my server and hvaing tons of folks to test at once, its hard to tell.
  14. Unless habbo has an API to provide external users this information, it is not going to be easily achieved. You would have to create a script which scraped the habbo page and parsed the results for specific information you want. This would also break whenever they made signifigant (or possibly even small) changes to the site you are scraping. Even then, scraping it would be immoral at best and possibly illegal. I googled looking for any API provided by habbo and it does not seem to exist, so scraping would be your only option IMO. And even then, Im not sure you would need javascript. you could scrape completely in PHP and display the results. You COULD use javascript and ajax to display things dynamically to the user, but it isnt remotely necessary based on what youve described.
  15. Actually, the service does accept jsonp! I just had to add jsonp=return function to the end of the call and it works fine! Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.