def post_publication(session_id, content, topics, expiry = nil)
      validate_presence_of session_id, 'Session Id'
      validate_presence_of content, 'Content'
      validate_presence_of topics, 'Topics'
      validate_xml content

      topics = [topics].flatten

      # Use Builder to generate XML body as we need to concatenate XML message content
      xml = Builder::XmlMarkup.new
      xml.isbm :SessionID, session_id
      xml.isbm :MessageContent do
        xml << content
      end
      topics.each do |topic|
        xml.isbm :Topic, topic
      end
      duration = expiry.to_s
      xml.isbm :Expiry, duration unless duration.nil?

      response = @client.call(:post_publication, message: xml.target!)

      response.to_hash[:post_publication_response][:message_id].to_s
    end
def post_publication(session_id, content, topics, expiry = nil)
      validate_presence_of session_id, 'Session Id'
      validate_presence_of content, 'Content'
      validate_presence_of topics, 'Topics'
      validate_xml content

      topics = [topics].flatten

      # Use Builder to generate XML body as we need to concatenate XML message content
      xml = Builder::XmlMarkup.new
      xml.isbm :SessionID, session_id
      xml.isbm :MessageContent do
        xml << content
      end
      topics.each do |topic|
        xml.isbm :Topic, topic
      end
      duration = expiry.to_s
      xml.isbm :Expiry, duration unless duration.nil?

      response = @client.call(:post_publication, message: xml.target!)

      response.to_hash[:post_publication_response][:message_id].to_s
    end
Posts a publication message.

 @param session_id [String] the session id
 @param content [String] a valid XML string as message contents
 @param topics [Array<String>, String] a collection of topics or single topic
 @param expiry [Duration] when the message should expire
 @return [String] the message id
 @raise [ArgumentError] if session_id, content or topics are blank, or
   content is not valid XML