Skip to content

[3.3.0] Invalid namespace while parsing WS-N wsdl #56

@keltia

Description

@keltia

I'm trying to send a request for a WebService Notification service (WS-N).

Using the following WSDL (which import various OASIS-based WSDL/XSD) — https://gist.github.com/keltia/8e6cb6da0521c0290cd8, an invalid namespace is used to generate the request.

Error: 500 (soap:Client) Unexpected element {http://docs.oasis-open.org/wsn/brw-2}Subscribe found.   Expected {http://docs.oasis-open.org/wsn/b-2}Subscribe.

The code is very basic:

# Main module
module Surv
  class Client
    attr_accessor :topics
    attr_reader :client, :config

    def initialize(config)
      @topics = Hash.new
      @out = config.feed_one

      #$stderr.puts("Entry point is #{config.proto}://#{config.site}:#{config.port}/#{config.entry}.")

      client = Savon.client(wsdl: config.wsdl,
                            strip_namespaces: false,
                            log_level: :info,
                            convert_request_keys_to: :camelcase,
                            #pretty_print_xml: true,
      )

      #$stderr.puts("Entry point: #{client.wsdl.endpoint}")
      $stderr.puts("Init done.")
      $stderr.puts("Available methods: #{client.operations}")
      @client = client
      @config = config
    end

    def subscribe(topic, callback)
      my_topic = "#{@config.base}/#{callback}"
      message = {
          ConsumerReference: {
            Address: my_topic,
          },
          Filter: {
              TopicExpression: topic,
          },
      }

      $stderr.puts(message)
      $stderr.puts("  Subscribing #{my_topic} for #{topic}")

      @topics[callback] = Topic.new(callback)
      @topics[callback].bytes = 0
      @topics[callback].pkts = 0

      begin
        resp = client.call(:subscribe, message: message)
      rescue Savon::Error => error
        $stderr.puts("Error: #{error.http.code} #{error}")
      end
    end
  end
end

the request generated is:

<?xml version="1.0" encoding="UTF-8"?>
  <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:wsdl="http://docs.oasis-open.org/wsn/brw-2"
           xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <wsdl:Subscribe>
      <consumerReference>
        <address>http://localhost/feed_jsongz</address>
      </consumerReference>
      <filter>
        <topicExpression>AsterixJSONGzipped</topicExpression>
      </filter>
    </wsdl:Subscribe>
  </env:Body>
</env:Envelope>

wsdl should be using b-2 and not brw-2. SoapUI get it right see the following screenshot:
https://www.dropbox.com/s/ntyxz44se481eu1/Screenshot%202015-03-10%2015.05.31.png?dl=0

Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions