Jump to content
The Uniform Server Community

XML-RPC and SSL


SteveJ
 Share

Recommended Posts

Hello,

 

I am trying to run a web service into SSL to simulate how a store might connect to a bank for a credit card transaction. I can get the web service to operate from port 80 localhost to port 80 localhost, and from SSL localhost (port 443) to port 80 localhost, but when I try to send data into SSL, I get no data back. I am using a PHP web service and 'utils.php' as a library.

 

My intention is to get a working connection, and then fill it in with the necessary queries to make the credit card piece work. Think of this as a proof of concept or a 'Hello World' at the moment.

 

the client app

 

<?php

include("utils.php");

$host = "localhost";
$uri = "/server.php";

$result = xu_rpc_http_concise(
array(
'method' => "uptime",
'host' => $host,
'uri' => $uri,
'port' => 443
)
);
print "The uptime on " . $host . " is " . $result;
?>

 

The server app:

 

<?php

function uptime_func($method_name, $params, $app_data) {
return time()." insecure";
}

$xmlrpc_server = xmlrpc_server_create();

xmlrpc_server_register_method($xmlrpc_server, "uptime", "uptime_func");
header('Content-Type: text/xml');

$request_xml = $HTTP_RAW_POST_DATA;

$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml, '');

print $response;

xmlrpc_server_destroy($xmlrpc_server);
?>

 

 

 

Thanks!

 

-Steve

Link to comment
Share on other sites

An update to my question:

 

This comes from an unknown source (which may be wrong), but this seems reasonable.

 

"HTTPS is a protocol that encapsulates HTTP. That is, when you type in anHTTPS URL in a browser, it first tries to establish an SSL-session with the server's mod_ssl engine. Once that's up, the browser and server then use HTTP in the normal way, but each frame is encrypted and decrypted at the interfaces. So at the start of a session, the server listening on port 443 is an HTTPS server and cannot receive plain HTTP requests. So you need a second VH to listen to HTTP traffic and redirect it to HTTPS."

 

His solution is that my SSL must listen to both 80 and 443. Like so:

 

Listen 443 https

Listen 80 http

 

However, Apache won't run when I do this.

 

Thanks!

 

-Steve

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...