src/ServiceBus/ServiceBusRestProxy.php
public function createTopic(TopicInfo $topicInfo)
    {
        Validate::notNullOrEmpty($topicInfo, 'topicInfo');
        $httpCallContext = new HttpCallContext();
        $httpCallContext->setMethod(Resources::HTTP_PUT);
        $httpCallContext->setPath($topicInfo->getTitle());
        $httpCallContext->addHeader(
            Resources::CONTENT_TYPE,
            Resources::ATOM_ENTRY_CONTENT_TYPE
        );
        $httpCallContext->addStatusCode(Resources::STATUS_CREATED);

        $topicDescriptionXml = XmlSerializer::objectSerialize(
            $topicInfo->getTopicDescription(),
            'TopicDescription'
        );

        $entry = new Entry();
        $content = new Content($topicDescriptionXml);
        $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);
        $topicInfo = new TopicInfo();
        $topicInfo->parseXml($response->getBody());

        return $topicInfo;
    }
public function createTopic(TopicInfo $topicInfo)
    {
        Validate::notNullOrEmpty($topicInfo, 'topicInfo');
        $httpCallContext = new HttpCallContext();
        $httpCallContext->setMethod(Resources::HTTP_PUT);
        $httpCallContext->setPath($topicInfo->getTitle());
        $httpCallContext->addHeader(
            Resources::CONTENT_TYPE,
            Resources::ATOM_ENTRY_CONTENT_TYPE
        );
        $httpCallContext->addStatusCode(Resources::STATUS_CREATED);

        $topicDescriptionXml = XmlSerializer::objectSerialize(
            $topicInfo->getTopicDescription(),
            'TopicDescription'
        );

        $entry = new Entry();
        $content = new Content($topicDescriptionXml);
        $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);
        $topicInfo = new TopicInfo();
        $topicInfo->parseXml($response->getBody());

        return $topicInfo;
    }
public function createTopic ( TopicInfo $ topicInfo ) { Validate :: notNullOrEmpty ( $ topicInfo , 'topicInfo' ) ; $ httpCallContext = new HttpCallContext ( ) ; $ httpCallContext -> setMethod ( Resources :: HTTP_PUT ) ; $ httpCallContext -> setPath ( $ topicInfo -> getTitle ( ) ) ; $ httpCallContext -> addHeader ( Resources :: CONTENT_TYPE , Resources :: ATOM_ENTRY_CONTENT_TYPE ) ; $ httpCallContext -> addStatusCode ( Resources :: STATUS_CREATED ) ; $ topicDescriptionXml = XmlSerializer :: objectSerialize ( $ topicInfo -> getTopicDescription ( ) , 'TopicDescription' ) ; $ entry = new Entry ( ) ; $ content = new Content ( $ topicDescriptionXml ) ; $ 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 ) ; $ topicInfo = new TopicInfo ( ) ; $ topicInfo -> parseXml ( $ response -> getBody ( ) ) ; return $ topicInfo ; }
Creates a topic with specified topic info.

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

@param TopicInfo $topicInfo The information of the topic

@return TopicInfo
Creates a topic with specified topic info .