I'm using Zend XML-RPC Client library to send XML requests to another non-PHP XML RPC server.(it's a java JBoss install, but I don't have control to change it/patch it/hack it). One request I'm making has a <nil/> element, which is a XML-RPC extension. The XML-RPC server I'm talking to doesn't support that because the request fails with Failed to parse XML-RPC request: Unknown type: nil.
Is there any way to tell Zend to not send the <nil/> value and send something else instead? Others have asked this before: http://framework.zend.com/issues/browse/ZF-1919
I don't think so, however:
The array of parameters for the remote method can contain native PHP types,
Zend_XmlRpc_Value objects, or a mix of each.
You actually have full control over the type of parameters passed to the remote method. Converting null values to empty strings before sending the request should be trivial, isn't it?
Related
I am trying to use the XMLWriter class in PHP to generate XML. I am working in CodeIgniter. When I try to output XML, I get this error (HTTP wrapper does not support writeable connections). What does it mean and what do I need to do to fix it? I am using this class here: http://www.phpbuilder.com/board/showthread.php?t=10356853.
What's your output call look like? That error usually means you're trying to save to an http url, e.g. like:
$myobj->save('http://example.com/path/file.xml');
which generally will fail. This requires an HTTP upload, but provides none of the specifics necessary to perform one. Should it be a PUT? A POST? What's the fieldname the receiving server is expecting? etc...
I'm looking at connecting an existing PHP codebase to a remote CORBA service. All actual data is passed via XML so I don't think I need an IDL to PHP mapping for remote invocation. I just need to connect to the CORBA service, transmit to it the XML string, and read the XML response.
After some research on this I found the CORBA4PHP PHP extension which I'm about to try although am having some reservations (last updated in 2009). I also found numerous implementations in Java and Python.
To avoid dealing with a new PHP extension I'm wondering if there exists a CORBA HTTP proxy of sorts in any language that would take care of communicating with the CORBA service. I would HTTP POST to the proxy (or some socket communication), it would relay it to the CORBA service, and relay back to me its response.
Does such a proxy exist?
I don't know of such a service, but perhaps others might know of one. That said, given how simple your IDL is, I would just go ahead and try the CORBA4PHP extension and use that if it works.
If it doesn't work (I've no idea about its quality), it would be really simple to build such a proxy yourself:
Download a free ORB (let's say you get one for Java, say JacORB)
Compile your IDL and build a client to the CORBA service
Add a front-end API to your Java application which your PHP code will use to call it and pass in the string parameter containing your XML (POST sounds reasonable, and there are plenty of ways to implement such a thing in Java)
I was landed a project to debug a PHP SOAP server (SoapServer) written by an unknown party. It is being used by a c# SOAP client, which I don't have access to the source code to (in other words, I cannot use __getLastResponse to see what it gets). I am trying to capture XML output of the server's responses. Traffic sniffing (wireshark, etc) doesn't work because of the SSL layer being used to encrypt XML messages. Any help in figuring out how to see the XML messages sent out by the server would be greatly appreciated.
There's an excellent example for extending the SoapServer class and grabbing the Soap XML request and responses here: http://blog.mayflower.de/archives/179-Extending-class-SoapServer-PHP5-for-debugging.html
Does the SoapServer look like this one, or like this one? If it's the former, you're up a tree and every ladder within a year's distance has been violently destroyed by wolverines. Rather, it's a binary blob of compiled code from which there is no escape.
If it's the latter, you may have some hope -- the service method's third parameter can be set to true to get the response data rather than blindly sending it out.
There's also a rumor that the ancient "nuSOAP" library has a server mode, but that project seems to have imploded in upon itself, and took the documentation with it.
Long-term, you may be better served by using a web service layer that isn't pathologically backwards, though that might not be an option for you.
I'm currently trying to build a web-base management interface for a cluster of linux servers running a special service. The idea being that the management website can RPC the clusters to gather information, perform configuration tasks, etc.
I've got an XMLRPC Python Server script up and running, and I've written a basic XMLRPC Client in PHP. It all works, but I'm having some serious issues trying to get consistent responses from method calls - Sometimes I get an XML array to n'th depth based on the verbosity of the output of the command I run, sometimes its a XML struct, and sometimes its just a plain old value. Then I've got errors to deal with - It seems the XMLRPC standard has a Fault struct with 'faultCode' and 'faultString' values it responds with, which is great because thats tidy and I can pull that data out via the named key in the XML. But you only get that struct if error is from the shell itself (For example if the called command had a bad argument), whereas an error coming from the command has to be just a normal XML response.
How can I possibly write a robust web-service around what appears to be such varied replies from the XMLRPC server? What I'd really like to do is have the exact same XML struct reply back every time with the same Keys (returnCode (0=success, >1=error), returnValue/s).
Thanks for any advice.
Maybe start with an existing XML/RPC client and let the client do the protocol legwork. There is Zend\XmlRpc in Zend Framework but also standalone clients like fxmlrpc.
I want to have a PHP script send a XML formatted string to another PHP script that resides on a different server in a different part of town.
Is there any nice, clean way of doing this?
(PHP5 and all the latest software available)
check out cURL for posting data between pages.
If it were me, I would just POST the xml data to the other script. You could use a socket from PHP, or use CURL. I think that's the cleanest solution, although SOAP is also viable if you don't mind the overhead of the SOAP request, as well as using a library.
I strongly suggest rolling your own RESTful API and avoiding the complexity of SOAP altogether. All you need is the curl extension to handle the HTTP request/response, and simple_xml to build/process the XML. If your data is in a reasonable format, it should be easy for you to push it into an XML string and submit it as a POST to the other server. That server will respond to the request by reading the XML string from the POST var back into an object, and voila! It shouldn't take you all day to whip this out.
XML-RPC or SOAP or just a RESTful API
You can use cURL (complex API), the http extension (cleaner), or if you need to do more complex stuff you can even use the Scriptable Browser from simpletest.