def open_session(uri, topics, listener_url = nil, xpath_expression = nil, xpath_namespaces = [])
      validate_presence_of uri, 'Channel URI'
      validate_presence_of topics, 'Topics'
      validate_presence_of xpath_expression, 'XPath Expression' if xpath_namespaces.present?

      topics = [topics].flatten

      # Use Builder to generate XML body as we may have multiple Topic elements
      xml = Builder::XmlMarkup.new
      xml.isbm :ChannelURI, uri
      topics.each do |topic|
        xml.isbm :Topic, topic
      end
      xml.isbm :ListenerURL, listener_url unless listener_url.nil?
      xml.isbm :XPathExpression, xpath_expression unless xpath_expression.nil?
      xpath_namespaces.each do |prefix, name|
        xml.isbm :XPathNamespace do
          xml.isbm :NamespacePrefix, prefix
          xml.isbm :NamespaceName, name
        end
      end

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

      response.to_hash[:open_provider_request_session_response][:session_id].to_s
    end
def open_session(uri, topics, listener_url = nil, xpath_expression = nil, xpath_namespaces = [])
      validate_presence_of uri, 'Channel URI'
      validate_presence_of topics, 'Topics'
      validate_presence_of xpath_expression, 'XPath Expression' if xpath_namespaces.present?

      topics = [topics].flatten

      # Use Builder to generate XML body as we may have multiple Topic elements
      xml = Builder::XmlMarkup.new
      xml.isbm :ChannelURI, uri
      topics.each do |topic|
        xml.isbm :Topic, topic
      end
      xml.isbm :ListenerURL, listener_url unless listener_url.nil?
      xml.isbm :XPathExpression, xpath_expression unless xpath_expression.nil?
      xpath_namespaces.each do |prefix, name|
        xml.isbm :XPathNamespace do
          xml.isbm :NamespacePrefix, prefix
          xml.isbm :NamespaceName, name
        end
      end

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

      response.to_hash[:open_provider_request_session_response][:session_id].to_s
    end
Creates a new ISBM ProviderRequest client.

 @param endpoint [String] the SOAP endpoint URI
 @option options [Array<String>] :wsse_auth username and password, i.e. [username, password]
 @option options [Object] :logger (Rails.logger or $stdout) location where log should be output
 @option options [Boolean] :log (true) specify whether requests are logged
 @option options [Boolean] :pretty_print_xml (false) specify whether request and response XML are formatted
 Opens a provider request session for a channel for reading requests and
 posting responses.

 @param uri [String] the channel URI
 @param topics [Array<String>, String] a collection of topics or single topic
 @param listener_url [String] the URL for notification callbacks
 @param xpath_expression [String] the XPath filter expression
 @param xpath_namespaces [Array<Hash>] the prefixes and namespaces used by the XPath expression. The hash key
   represents the namespace prefix while the value represents the namespace name. For example,
   ["xs" => "http://www.w3.org/2001/XMLSchema", "isbm" => "http://www.openoandm.org/xml/ISBM/"]
 @return [String] the session id
 @raise [ArgumentError] if uri or topics are blank