Recommend this page to a friend! |
Download .zip |
Info | View files (16) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2009-05-17 (7 years ago) | Not enough user ratings | Total: 450 | All time: 5,865 This week: 970 |
Version | License | PHP version | Categories | |||
qtransfer 0.1.1 | GNU General Publi... | 5.0 | XML, HTTP, PHP 5 |
Description | Author | |
This package can be used to send HTTP requests and process XML responses. |
--------- QTransfer --------- QTransfer is a collection of classes which can be used for exchanging data in xml format between servers language independently. You can use it i.e. for ASP or SAAS software application based on php. The request scheme (xsd) can be delivered to a customer who gets an API like interface for producing valid xml based requests. The sample setup demonstrates how to - setup xsd schemes, - prepare request xml data streams which request specific application data - validate incoming responses Sample Setup Request XML: $request = new Transfer_XmlRequest("Test","Module","index"); $request->setSchema("request"); $request->render(); // renders the domdocument to string if($request->isValid()) { $requestXML = $request->getXml(); // pure XML } else { echo "invalid request"; exit; } Q: What does this piece of code? A: It builds a xml and checks its integrity. This xml is laterly send to a server which processes the incoming xml structure. sample xml output: <?xml version="1.0" encoding="UTF-8"?> <transfer> <head> <context>Test</context> <module>Module</module> <action>index</action> <checksum>--40 chars long checksum string here--</checksum> <format>xml</format> <version>0.1.1</version> </head> <body> </body> </transfer> Q: Why do I have to validate the request? A: Suppose you want to deliver some data to a customer from your server. The customer only has to know how to send a xml stream to a specific adress and that he will receive a xmlml response. He must not know anything about server language etc.. He only has to know how to setup his request for being able to receive xml data. The validation of the xml, which is send by the customer, is helps to avoid failures. If a xml validation fails then he knows that something went wrong. The major advantage of such a validation is? A customer's server and the serving host must not be speak the same language. So it is language independent. You can write PHP and your customer writes JSP, does not matter. Sample customer request sends the xml to the hosted service front-controller etc.: $c = Transfer_Curl::getInstance() ->doPostXML("http://www.query4u.de/test/index.php",$requestXML); The variable $c gets the response xml. Now, the response can be validated against a reponse schema which is parametrized like the request. $response = new Transfer_XmlResponse("Test","Module","index"); $response->setSchema("response"); $response->setOutput($c); $response->render(); if($response->isValid()) { header("content-type: text/xml"); echo $response->getXml(); } else { echo "invalid response"; } Now you have the requested results in xml format which can be easily processed by any system. |
Files | / | samples |
File | Role | Description |
---|---|---|
config.inc.php | Conf. | sample configuration |
index.php | Example | sample |
index2.php | Example | sample: same as above but shorter |
Files | / | classes | / | Transfer |
File | Role | Description |
---|---|---|
Curl.php | Class | Curl Object |
CurlResponse.php | Class | CurlResponse Object |
XmlRequest.php | Class | DomXml Request Builder |
Checksum.php | Class | Checksum Builder |
index.php | Aux. | autoloader |
Xml.php | Class | DomXml Working Class |
XmlResponse.php | Class | DomXml Response Builder |
Files | / | schemes | / | ver0.1.1 |
File | Role | Description |
---|---|---|
request.xml | Data | request xml template |
request.xsd | Data | request schema |
response.xml | Data | response xml template |
response.xsd | Data | response schema |
qtransfer-2009-05-17.zip 20KB | |
qtransfer-2009-05-17.tar.gz 15KB | |
Install with Composer |
Needed packages | ||
Class | Download | Why it is needed | Dependency |
---|---|---|---|
Checksum | .zip .tar.gz | build the checksum for the request and response xml | Recommended |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
LIQUID STUDIO IDE to build XSD schemas |
RESPONSE The sample response |