Class | SOAP::RPC::Proxy
In: | soap/rpc/proxy.rb
Parent: | Object

### Methods

add_document_method add_document_operation add_method add_rpc_method add_rpc_operation call check_fault endpoint_url endpoint_url= inspect invoke new reset_stream route set_wiredump_file_base test_loopback_response

### Included Modules

SOAP

### Classes and Modules

Class SOAP::RPC::Proxy::Operation

### Attributes

allow_unqualified_element | [RW] |
default_encodingstyle | [RW] |
generate_explicit_type | [RW] |
headerhandler | [R] |
literal_mapping_registry | [RW] |
mandatorycharset | [RW] |
mapping_registry | [RW] |
operation | [R] |
soapaction | [RW] |
streamhandler | [R] |

### Public Class methods

new(endpoint_url, soapaction, options)

[Source]

    # File soap/rpc/proxy.rb, line 40
      def initialize(endpoint_url, soapaction, options)
        @endpoint_url = endpoint_url
        @soapaction = soapaction
        @options = options
        @streamhandler = HTTPStreamHandler.new(
          @options["protocol.http"] ||= ::SOAP::Property.new)
        @operation = {}
        @mandatorycharset = nil
        @allow_unqualified_element = true
        @default_encodingstyle = nil
        @generate_explicit_type = true
        @headerhandler = Header::HandlerSet.new
        @mapping_registry = nil
        @literal_mapping_registry = ::SOAP::Mapping::WSDLLiteralRegistry.new
      end

### Public Instance methods

add_document_method(soapaction, name, param_def, opt = {})

Alias for add_document_operation

add_document_operation(soapaction, name, param_def, opt = {})

[Source]

    # File soap/rpc/proxy.rb, line 90
      def add_document_operation(soapaction, name, param_def, opt = {})
        opt[:request_style] ||= :document
        opt[:response_style] ||= :document
        opt[:request_use] ||= :literal
        opt[:response_use] ||= :literal
        # default values of these values are unqualified in XML Schema.
        # set true for backward compatibility.
        unless opt.key?(:elementformdefault)
          opt[:elementformdefault] = true
        end
        unless opt.key?(:attributeformdefault)
          opt[:attributeformdefault] = true
        end
        @operation[name] = Operation.new(soapaction, param_def, opt)
      end

add_method(qname, soapaction, name, param_def, opt = {})

Alias for add_rpc_operation

add_rpc_method(qname, soapaction, name, param_def, opt = {})

Alias for add_rpc_operation

add_rpc_operation(qname, soapaction, name, param_def, opt = {})

[Source]

    # File soap/rpc/proxy.rb, line 81
      def add_rpc_operation(qname, soapaction, name, param_def, opt = {})
        opt[:request_qname] = qname
        opt[:request_style] ||= :rpc
        opt[:response_style] ||= :rpc
        opt[:request_use] ||= :encoded
        opt[:response_use] ||= :encoded
        @operation[name] = Operation.new(soapaction, param_def, opt)
      end

call(name, *params)

[Source]

    # File soap/rpc/proxy.rb, line 116
      def call(name, *params)
        unless op_info = @operation[name]
          raise MethodDefinitionError, "method: #{name} not defined"
        end
        mapping_opt = create_mapping_opt
        req_header = create_request_header
        req_body = SOAPBody.new(
          op_info.request_body(params, @mapping_registry,
            @literal_mapping_registry, mapping_opt)
        )
        reqopt = create_encoding_opt(
          :soapaction => op_info.soapaction || @soapaction,
          :envelopenamespace => @options["soap.envelope.requestnamespace"],
          :default_encodingstyle =>
            @default_encodingstyle || op_info.request_default_encodingstyle,
          :elementformdefault => op_info.elementformdefault,
          :attributeformdefault => op_info.attributeformdefault
        )
        resopt = create_encoding_opt(
          :envelopenamespace => @options["soap.envelope.responsenamespace"],
          :default_encodingstyle =>
            @default_encodingstyle || op_info.response_default_encodingstyle,
          :elementformdefault => op_info.elementformdefault,
          :attributeformdefault => op_info.attributeformdefault
        )
        env = route(req_header, req_body, reqopt, resopt)
        raise EmptyResponseError unless env
        receive_headers(env.header)
        begin
          check_fault(env.body)
        rescue ::SOAP::FaultError => e
          op_info.raise_fault(e, @mapping_registry, @literal_mapping_registry)
        end
        op_info.response_obj(env.body, @mapping_registry,
          @literal_mapping_registry, mapping_opt)
      end

check_fault(body)

[Source]

    # File soap/rpc/proxy.rb, line 178
      def check_fault(body)
        if body.fault
          raise SOAP::FaultError.new(body.fault)
        end
      end

endpoint_url()

[Source]

    # File soap/rpc/proxy.rb, line 60
      def endpoint_url
        @endpoint_url
      end

endpoint_url=(endpoint_url)

[Source]

    # File soap/rpc/proxy.rb, line 64
      def endpoint_url=(endpoint_url)
        @endpoint_url = endpoint_url
        reset_stream
      end

inspect()

[Source]

    # File soap/rpc/proxy.rb, line 56
      def inspect
        "#<#{self.class}:#{@endpoint_url}>"
      end

invoke(req_header, req_body, opt = nil)

[Source]

    # File soap/rpc/proxy.rb, line 111
      def invoke(req_header, req_body, opt = nil)
        opt ||= create_encoding_opt
        route(req_header, req_body, opt, opt)
      end

reset_stream()

[Source]

    # File soap/rpc/proxy.rb, line 69
      def reset_stream
        @streamhandler.reset(@endpoint_url)
      end

route(req_header, req_body, reqopt, resopt)

[Source]

    # File soap/rpc/proxy.rb, line 153
      def route(req_header, req_body, reqopt, resopt)
        req_env = ::SOAP::SOAPEnvelope.new(req_header, req_body)
        unless reqopt[:envelopenamespace].nil?
          set_envelopenamespace(req_env, reqopt[:envelopenamespace])
        end
        reqopt[:external_content] = nil
        conn_data = marshal(req_env, reqopt)
        if ext = reqopt[:external_content]
          mime = MIMEMessage.new
          ext.each do |k, v|
            mime.add_attachment(v.data)
          end
          mime.add_part(conn_data.send_string + "\r\n")
          mime.close
          conn_data.send_string = mime.content_str
          conn_data.send_contenttype = mime.headers['content-type'].str
        end
        conn_data = @streamhandler.send(@endpoint_url, conn_data,
          reqopt[:soapaction])
        if conn_data.receive_string.empty?
          return nil
        end
        unmarshal(conn_data, resopt)
      end

set_wiredump_file_base(wiredump_file_base)

[Source]

    # File soap/rpc/proxy.rb, line 73
      def set_wiredump_file_base(wiredump_file_base)
        @streamhandler.wiredump_file_base = wiredump_file_base
      end

test_loopback_response()

[Source]

    # File soap/rpc/proxy.rb, line 77
      def test_loopback_response
        @streamhandler.test_loopback_response
      end

[Validate]