I'm trying to setup a basic connection towards Azure's Service Bus using PHP and can't get it to work. I get the error:
1: HTTP_Request2 needs an absolute HTTP(S) request URL, 'sb://mynamespace.servicebus.windows.net/myqueue/messages' given
This is the code I'm now trying to run:
<?php
require_once '../vendor/autoload.php';
use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\ServiceException;
use WindowsAzure\ServiceBus\Models\BrokeredMessage;
// Create Service Bus REST proxy.
$connectionString = "Endpoint=sb://mynamespace.servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=[MyVal]";
$serviceBusRestProxy = ServicesBuilder::getInstance()->createServiceBusService($connectionString);
try {
// Create message.
$message = new BrokeredMessage();
$message->setBody("my message");
// Send message.
$serviceBusRestProxy->sendQueueMessage("myqueue", $message); // this is the line that causes the error
}
catch(Exception $e){
// Handle exception based on error codes and messages.
// Error codes and messages are here:
// http://msdn.microsoft.com/library/windowsazure/hh780775
$code = $e->getCode();
$error_message = $e->getMessage();
echo $code.": ".$error_message."<br />";
}
?>
I don't understand where this is going wrong. Anyone have any idea what I can do to prevent this error?