Which PHP RPC (XML or JSON) library have you successfully used?
I have done some research but haven't been able to find one library that stands out from the others.
I've found the following:
XML-RPC for PHP
XML_RPC (PEAR)
JSON-RPC PHP
And a few others that either don't look very active or mature.
I've used XML_RPC (PEAR) successfully. I'm not personally a fan of the xml-rpc "way" but the library was simple to use and we have a few dozen clients using it daily and pulling a fair amount of data over the wire and we've never had any problems.
We aren't pushing the envelope with this at all, in any way, but i'm very happy with the library since I don't even think about it anymore. The library isn't elegant or anything but neither is php or rpc, right?
I've written a simple XML-RPC library for PHP 5, called Ripcord. You can download it at http://ripcord.googlecode.com/. It is as easy to use as I could make it, even for the more advanced features like system.multicall. Give it a try.
we've done a very RPC robust library, following with the RPC specs 100%. You can switch between JSON-RPC-2.0 and JSONP on the fly and it supports also batch requests, signed request and service method introspection basing on Dojo's RPC proposals.
XApp-RPC core package https://github.com/XApp-Studio/xapp-Rpc
Example usage : xappcommander.com
we've done this because all what was around didn't meet our license/quality requirements. Have fun.
Related
I am wondering the features that are fully supported within PHP Soap, I have tried researching this, but there is very little documentation to support PHP Soap.
Also how is Soap used during the exchange of data through client machine to web service then server.
I know this is fairly vague, but as I am constantly being asked this myself I thought it was better to find more about it.
PHP has some build in SOAP classes for both client and server. Docs is on here.
But you have to be sure that your PHP build is compilled with SOAP support.
"The features that are fully supported within PHP" are pretty much non-existent.
Built in SOAP client is ok only for basic services. It doesn't support any WS extensions, so you have to add support manually, e.g. including headers for WS-Security.
Also, there are some problems with namespace handling and creating requests.
If you'll be using it and are having trouble with missing parameters or badly formatted requests, you'll probably want to modify requests - this can be done by extending SoapClient class and overriding doRequest function.
I'm working on a web interface to pull information from storage arrays. I'd like to use SMI-S There are Java CIM clients I can use (SBLIM CIM Client), but I'd really like there to be a way for PHP to pull information via CIM. Can anybody point me in the right direction? Is there a way I can, say, send a request over http (port 5988) and just parse out an xml response?
If anybody can suggest a better way that'd be great as well. Thank you.
I don't know of a CIM client written directly in PHP, but normally you can integrate packages written in Perl or Python into your server side PHP.
You could also integrate a command line CIM client into PHP, e.g. cimcli from OpenPegasus, but parsing the output of a command line client may not really be convenient.
I would recommend against writing your own CIM-XML parser - there are many details to observe in the specs (DSP0200, DSP0201), this would definitely be a major undertaking.
For Python, there is the PyWBEM CIM client which works very well, even though there is not much activity on the project. Also, there is the PowerCIM CIM client for Python, which is newer but I did not use it yet. PowerCIM provides the CIM classes as Python classes, while PyWBEM provides generic Python classes such as CIMInstance or CIMClass. Just two different styles to deal with, for integration into a next higher layer such as PHP it seems to me you'd be better off with the generic style provided by PyWBEM.
There is a Perl interface on top of the OpenWEM client, but I don't have experience with that.
Andy
SMI-S calls to get array details may use GetInstances() or EnumerateInstances(), which are basically predefined methods. These methods come with library such as OpenPegasus. If you are successful in including the required libraries, then you can create the client variable, connect to the CIM server and invoke the required method.
If you are specifically using OpenPegasus, you may need to know how to use C++ in PHP as the former is implemented in C++. Refer http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/
I need some advice on which library is the best choice when it comes to creating SOAP servers (and eventually SOAP clients) in PHP.
I know there is built-in functions for this, but is that really the best way to go about it?
Also, if you could attach some arguments as to why a certain library/method is the better, i'd be much delighted.
The only requirement i currently have (apart from the obvious client/server part) is that it can generate WSDL.
Does the WSDL version really matter at all? 1.1 or 2.0 what's the real difference/benefit of using 2.0?
I would recommend looking at the Zend_Soap class of Zend Framework.
Its fairly complete and robust and has been available in the framework long enough to have most if not all of its rough spots smoothed out. Plus its part of a framework that is being actively maintained so it will continue to support new standards and any bugs that are found will be fixed.
I use PHP's built-in SoapServer class to serve requests because it's implemented in C so it's faster than any other class implemented in PHP (Zend, nusoap).
The limitation here is that SoapServer can't generate WSDL (as of May'11) so i am using Zend SOAP Autodiscovery to generate it.
I use nuSoap: http://sourceforge.net/projects/nusoap/
My question is needed for some basic understanding of webservices and more specificly
in conjunction with php
I would like to know, if it is necessary to have a wsdl file for the creation of a webservice or is that just something that is usefull to third party's that want to access the webservice?
Also, it's generated automaticly in .net environments, but for php it's a bit more difficult.
What are my options?
The thing I am after is to create a jm2ee application on my mobile that sends data to the webservice from time to time.
I read somewhere that you have to supply the arguments when there is no wsdl file.
What is meant by that? and/or what are the implications of that?
Thanks in advance, Richard
I would like to know, if it is
neccasary to have a wsdl file for the
creation off a webservice
No, it is not necessary (at least, not in PHP) : it helps others know how to access your webservice (which methods, objects, ... should be used), but a WS can be called even if it doesn't export a WSDL
For PHP, yes, it is a bit difficult to get a WSDL (many classes don't generated them :-( ) ; still, you can generatd it with another tool (there are tools in Eclipse to write WSDL files, for example).
There was PEAR::Soap that was able to generate WSDL from PHP code (but you had to write down many lines of code to get it right) -- considering there is a class included in PHP 5 to work with SOAP, I wouldn't recommend using this one, anyway.
For more informations, you can have a look at :
SoapServer ; especially, if you look at the documentation of SoapServer::__construct, you will notice it can work both in WSDL and non-WSDL mode
Zend_Soap
If you are creating both the client and the web service, then there is no particular need to futz with SOAP, WSDL, or any of that jazz.
Just use the basics of the web: the client can use GET to fetch information, and POST to send it. You can format the data any way you like, but JSON and XML are common, well-defined approaches.
If you'd like inspiration for your API design, check out some popular examples:
Twitter API
Flickr API
all the Google APIs
all the Yahoo APIs
That's enough to get you started, but if you're curious about the design philosophy, you can read up on Representational State Transfer or REST.
WSDL file documents in a machine readable (XML) format what the methods (and args for methods) offered by a web service. You do not need a WSDL file if you know what the methods and args are - though WSDL is very good to have as a means of making the web service public interface more 'contractified', if you will.
To the best of my knowledge the PHP library does not have functions to automagically generate a WSDL file for you.
Web service support is built into php5, your best starting place is the documentation.
Some sources will use the term "webservice" as synonymous with SOAP. That is a misnomer. SOAP is a particular protocol - It is one way to create a web service. There are other technologies available. In general SOAP is the preferred standard with in Java and .net, but it is a bad fit outside of this sphere. If you have the option, I would strongly suggest that you consider either xml-rpc (Which is simpler and has better direct support on php) or a http-based service (Also called REST based).
Being as stubborn as it gets, I'm building my own PHP-based CMS and framework (named RAmen/FSM just for the kicks) that has been deployed multiple times for my customers. Now, I'm going to develop a support ticket application for it that I will deploy on a 'central' server for convenience of maintenance.
Now, I've looked into SOAP services and was happy until I got to WSDL generation in PHP and in itself. So, what would you suggest for me to 'securely' (as in, no https) manage this with SOAP-like simplicity on the client side ($support->newTicket), without the WSDL headaches on the server side? Or should I –gasp– stop being so stubborn and just go with a PHP library (in which case, please do recommend!)
Thank you, fellow pastafarians/spagnostic coders!
PHP has a native SOAP extension, that automates client as well as server. It is a little buggy in some places, but still better than nusoap (IMHO).
That said, I would never chose SOAP if I had any bearing on the decision. Use xml-rpc or a rest-based approach.
I have a similar question, whether to use REST or SOAP. I am using REST but that is beacuse i want a simple API like function not so much the rigid functionality associated with REST.
That being said here is a nice little library to get you started on SOAP
http://sourceforge.net/projects/nusoap/
By the sounds of it SOAP is actually what you want. you will fin it a bit easier to implement as you get the domain models from the WSDL.