src/ServiceBus/ServiceBusRestProxy.php
public function createSubscription($topicPath, SubscriptionInfo $subscriptionInfo)
    {
        $httpCallContext = new HttpCallContext();
        $httpCallContext->setMethod(Resources::HTTP_PUT);
        $subscriptionPath = sprintf(
            Resources::SUBSCRIPTION_PATH,
            $topicPath,
            $subscriptionInfo->getTitle()
        );
        $httpCallContext->setPath($subscriptionPath);
        $httpCallContext->addHeader(
            Resources::CONTENT_TYPE,
            Resources::ATOM_ENTRY_CONTENT_TYPE
        );
        $httpCallContext->addStatusCode(Resources::STATUS_CREATED);

        $subscriptionDescriptionXml = XmlSerializer::objectSerialize(
            $subscriptionInfo->getSubscriptionDescription(),
            'SubscriptionDescription'
        );

        $entry = new Entry();
        $content = new Content($subscriptionDescriptionXml);
        $content->setType(Resources::XML_CONTENT_TYPE);
        $entry->setContent($content);

        $entry->setAttribute(
            Resources::XMLNS,
            Resources::SERVICE_BUS_NAMESPACE
        );

        $xmlWriter = new \XMLWriter();
        $xmlWriter->openMemory();
        $entry->writeXml($xmlWriter);
        $httpCallContext->setBody($xmlWriter->outputMemory());

        $response = $this->sendHttpContext($httpCallContext);
        $subscriptionInfo = new SubscriptionInfo();
        $subscriptionInfo->parseXml($response->getBody());

        return $subscriptionInfo;
    }
public function createSubscription($topicPath, SubscriptionInfo $subscriptionInfo)
    {
        $httpCallContext = new HttpCallContext();
        $httpCallContext->setMethod(Resources::HTTP_PUT);
        $subscriptionPath = sprintf(
            Resources::SUBSCRIPTION_PATH,
            $topicPath,
            $subscriptionInfo->getTitle()
        );
        $httpCallContext->setPath($subscriptionPath);
        $httpCallContext->addHeader(
            Resources::CONTENT_TYPE,
            Resources::ATOM_ENTRY_CONTENT_TYPE
        );
        $httpCallContext->addStatusCode(Resources::STATUS_CREATED);

        $subscriptionDescriptionXml = XmlSerializer::objectSerialize(
            $subscriptionInfo->getSubscriptionDescription(),
            'SubscriptionDescription'
        );

        $entry = new Entry();
        $content = new Content($subscriptionDescriptionXml);
        $content->setType(Resources::XML_CONTENT_TYPE);
        $entry->setContent($content);

        $entry->setAttribute(
            Resources::XMLNS,
            Resources::SERVICE_BUS_NAMESPACE
        );

        $xmlWriter = new \XMLWriter();
        $xmlWriter->openMemory();
        $entry->writeXml($xmlWriter);
        $httpCallContext->setBody($xmlWriter->outputMemory());

        $response = $this->sendHttpContext($httpCallContext);
        $subscriptionInfo = new SubscriptionInfo();
        $subscriptionInfo->parseXml($response->getBody());

        return $subscriptionInfo;
    }
public function createSubscription ( $ topicPath , SubscriptionInfo $ subscriptionInfo ) { $ httpCallContext = new HttpCallContext ( ) ; $ httpCallContext -> setMethod ( Resources :: HTTP_PUT ) ; $ subscriptionPath = sprintf ( Resources :: SUBSCRIPTION_PATH , $ topicPath , $ subscriptionInfo -> getTitle ( ) ) ; $ httpCallContext -> setPath ( $ subscriptionPath ) ; $ httpCallContext -> addHeader ( Resources :: CONTENT_TYPE , Resources :: ATOM_ENTRY_CONTENT_TYPE ) ; $ httpCallContext -> addStatusCode ( Resources :: STATUS_CREATED ) ; $ subscriptionDescriptionXml = XmlSerializer :: objectSerialize ( $ subscriptionInfo -> getSubscriptionDescription ( ) , 'SubscriptionDescription' ) ; $ entry = new Entry ( ) ; $ content = new Content ( $ subscriptionDescriptionXml ) ; $ content -> setType ( Resources :: XML_CONTENT_TYPE ) ; $ entry -> setContent ( $ content ) ; $ entry -> setAttribute ( Resources :: XMLNS , Resources :: SERVICE_BUS_NAMESPACE ) ; $ xmlWriter = new \ XMLWriter ( ) ; $ xmlWriter -> openMemory ( ) ; $ entry -> writeXml ( $ xmlWriter ) ; $ httpCallContext -> setBody ( $ xmlWriter -> outputMemory ( ) ) ; $ response = $ this -> sendHttpContext ( $ httpCallContext ) ; $ subscriptionInfo = new SubscriptionInfo ( ) ; $ subscriptionInfo -> parseXml ( $ response -> getBody ( ) ) ; return $ subscriptionInfo ; }
Creates a subscription with specified topic path and
subscription info.

@link http://msdn.microsoft.com/en-us/library/windowsazure/hh780748

@param string           $topicPath        The path of
the topic
@param SubscriptionInfo $subscriptionInfo The information
of the subscription

@return SubscriptionInfo
Creates a subscription with specified topic path and subscription info .