Is there a way to save the soap request SoapClient sends when calling __soapCall to a file instead of sending it to the actual server?
I'm trying to save the soap requests to a queue and then send them over a period of time (the requests will be very different).
I'm using Zend_Soap.
Take a look at Zend_Soap_Client_Local, especially the _doRequest() method and build your own class with your own logic.
If you want so see how they used Zend_Soap_Client_Local, take a look in tests/Zend/Soap/ClientTest.php, method testGetFunctions().
Related
I want to send some info to a server using cookie for authentication:
http://exampleserver.com/get?parm1=val1&parm2=val2&parm3=val3
with
cookie1=asd123;cookie2=enc%19
I want only to send the request and do not wait for the response. I only need server to register the data, as depending on amount of the data sent, tge wait for the response from client side could become too high, and so I want it to be fast.
I know PHP is blocking, but is is possible to do this in some way?
I think that what you want to obtain is like an asynchronous call to the server, which in PHP can be done using "threading", the quotes are here because is not properly threading what is possible in PHP, but almost.
You can find here the answer to your question
PHP threading call to a php function asynchronously
I'm creating some specific application in PHP that receive data from clients and process it.
Sometimes the data sent by client can be significantly large or unknown length.
So I want to ask if it possible to make PHP start processing data before client finish uploading?
Here what I'm looking to:
From PHP docs it is possible to use PUT method and receive content via php://input
http://www.php.net/manual/en/features.file-upload.put-method.php
I'm planning on using PUT method with chunked transfer encoding.
but I just try sending PUT method to phpinfo.php (You know what inside.)
and intentionally not sent last chunk. (zero length chunk)
The PHP doesn't response unless I complete the request.
(That's not what I expect from PUT method it should has some kind of pros.
If it unable to start PHP early I rather use ordinary POST method.)
And according to this topic
Can I reply to a HTTP Request Before I've Finished Receiving it?
I don't think early response from PHP will break HTTP.
(Don't worry about the client I write it myself.)
Note: Breaking data into many request is not an option because in order to process the data there are some memory/objects that cant be shared among multiple PHP instances. (even with memory table in MySQL.)
I been learning php and ajax from w3schools but I have come across a simply question for which I cant find an answer to.
To request something from a php file I use a xmlhttpRequest object and specify the url (of that php file). Does this mean one php file for one request only? Let's say on a webpage there are a user log-in box and a comment box, I would need two php files to take the requests? I always thought the server side will have one main file that handle all the requests, each request from client will have a ID to specify what the request is and send back the necessary data to client. So what is the right?
I read a lot of material online, but everything is just basic example with just one request and one response.
You can use the same file for multiple requests. You can supply parameters along with the AJAX request, either by including them in the URL after ? (they'll be available in $_GET and $_REQUEST) or by using the POST method and sending them as form data (they'll be available in $_POST and $_REQUEST). You can use the Javascript FormData API to encode this properly; see the documentation here. Using the jQuery library can simplify all of this.
One of the parameters can then be a command or operation code, and the script can take different actions based on this.
I am using php soap to make calls to a web service but the operator of the service wants us to switch to non-wsdl mode so it doesn't need to be exposed. I get bad requests and looking at the request generated I notice one main difference between the requests going out.
<ns1:userpwd>password</ns1:userpwd>
vs.
<ns1:userpwd xsi:type="xsd:string">password</ns1:userpwd>
All the parameters have this additional xsi:type="xsd:string" Currently I am using
new SoapParam($password, "ns1:userPWD");
to generate the parameters. What do I need to do different to omit the xsi:type attribute from the xml for the call that eventually gets sent out?
Once again thinking the question through enough to write it up points to an answer:
new SoapVar("$password", XSD_ANYXML); produces the desired result in the request
I am using AMFPHP with great success to link my database with my Flex application. However I want to be able to test the remoting requests outside of flash, by typing something like:
http://localhost/amfphp/gateway.php?[WHAT DO I PUT HERE]
What do I put after the questionmark in order to have the browser (or a C++ http component) call the amfphp service, so that the http request needn't "initiate" from flash.
It sounds like you want to make an AMF call from PHP. You can't do this directly from a browser. The data would be returned in the binary AMF format, which of course PHP or a browser can't handle directly. I don't even think it can make the request.
You'll need a AMF client to make the call and decode the data - I suggest using SabreAMF.
Sabre AMF homepage
This is what simple client method call code looks like.
require 'SabreAMF/Client.php';
function make_request($param1,$param2){
$client = new SabreAMF_Client('http://your.server/amfphp/gateway.php');
return $client->sendRequest('your_amf_service.yourAMFmethod',array($param1, $param2));
}
you then invoke this like
$result=make_request('cow',300);
and it returns an array.
You'd probably want to set up a PHP class with all of your methods so you can call each one easily, of course.
AMFPHP has the service browser, which lets you simulate calls to your server-side service and see the responses. It basically does an internal CURL request back to the same service file and passes in the arguments you provided, and acts as if it was done directly from the client-side Flash app.
AMF being a binary format, things are probably not going to be that simple : you'll have to find out how your data is encoded...
As a first step, maybe you could, from your gateway.php script, just dump everything it receives to a file, when it's called from your flash component ?
This way, you could see how the received data looks like (and you'd know if it's passed in POST, or in GET).
Depending on what that data looks like, maybe you'll be able to "forge" a request to your server -- but I don't think it'll be as simple as just calling an URL from your browser...
Considering the AMFPHP gateway is just a mechanism to translate (from/to binary) and dispatch to a class/method with various incoming parameters and finally a return() of data - can you just unit-test directly against the method, thus skipping the entire AMF layer?