Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The XML document has not valid XML-RPC content" on Server creation #23

Open
stacyharper opened this issue Dec 16, 2016 · 0 comments
Open

Comments

@stacyharper
Copy link

Hi !

I'm facing a big issue... I was reading the documentation to create my own XML-RPC Server but I have the following Exception on method call:

The XML document has not valid XML-RPC content

This is my controller declaration :

<?php                                                                                                                                                                       
                                                                                                                                                                                                                   
use Symfony\Bundle\FrameworkBundle\Controller\Controller;                                                                                                                                                          
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;                                                                                                                                                        
use Symfony\Component\HttpFoundation\Request;                                                                                                                                                                      
use Seven\RpcBundle\XmlRpc\Server;                                                                                                                                                                                 
use Seven\RpcBundle\XmlRpc\Client;                                                                                                                                                                                 
                                                                                                                                                                                                                   
/**                                                                                                                                                                                                                
 * @Route("/xmlrpc")                                                                                                                                                                                               
 */                                                                                                                                                                                                                
class XmlRpcServerController extends Controller                                                                                                                                                                    
{                                                                                                                                                                                                                  
    /**                                                                                                                                                                                                            
     * @return array                                                                                                                                                                                               
     *                                                                                                                                                                                                             
     * @route("/handler", name="handle_xml_rpc_request")                                                                                                                                                           
     */                                                                                                                                                                                                            
    public function handleAction(Request $request)                                                                                                                                                                 
    {                                                                                                                                                                                                              
        // Create XML-RPC Server                                                                                                                                                                                   
        $server = new Server();                                                                                                                                                                                    
                                                                                                                                                                                                                   
        // Add handlers                                                                                                                                                                                            
        $server->addHandler('help', function() {                                                                                                                                                                   
            return "Your XMLRpc Server works (finally !)";                                                                                                                                                         
        });                                                                                                                                                                                                        
                                                                                                                                                                                                                   
        // Handler request and return response                                                                                                                                                                     
        return $server->handle($request);                                                                                                                                                                          
    }                                                                                                                                                                                                              
                                                                                                                                                                                                                   
    /**                                                                                                                                                                                                            
     * @return array                                                                                                                                                                                               
     *                                                                                                                                                                                                             
     * @route("/test", name="test_xml_rpc_request")                                                                                                                                                                
     */                                                                                                                                                                                                            
    public function testAction(request $request)                                                                                                                                                                   
    {                                                                                                                                                                                                              
        $client = new Client($this->generateUrl('handle_xml_rpc_request', array(), true));                                                                                                                         
                                                                                                                                                                                                                   
        echo $client->call('help');die;                                                                                                                                                                            
    }                                                                                                                                                                                                              
} 

Can you tell me where is my errors please ?

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant