Sha256: 9f7744356965ecf7a04483c9f76811e8809de029d003b5541f0b99b0dcd798c7

Contents?: true

Size: 1.91 KB

Versions: 20

Compression:

Stored size: 1.91 KB

Contents

#!/usr/bin/env ruby
# encoding: ASCII-8BIT

require 'soap/rpc/standaloneServer'

class Server < SOAP::RPC::StandaloneServer
  class RpcServant
    def rpc_serv(obj1, obj2)
      [obj1, obj2]
    end
  end

  class DocumentServant
    def doc_serv(hash)
      hash
    end

    def doc_serv2(hash)
      { 'newroot' => hash }
    end
  end

  class GenericServant

    # method name style: requeststyle_requestuse_responsestyle_responseuse

    def rpc_enc_rpc_enc(obj1, obj2)
      [obj1, obj2]
    end

    alias rpc_enc_rpc_lit rpc_enc_rpc_enc

    def rpc_enc_doc_enc(obj1, obj2)
      obj1
    end

    alias rpc_enc_doc_lit rpc_enc_doc_enc

    def doc_enc_rpc_enc(obj)
      [obj, obj]
    end

    alias doc_enc_rpc_lit doc_enc_rpc_enc

    def doc_enc_doc_enc(obj)
      obj
    end

    alias doc_enc_doc_lit doc_enc_doc_enc
  end

  def initialize(*arg)
    super
    rpcservant = RpcServant.new
    docservant = DocumentServant.new
    add_rpc_servant(rpcservant)
    add_document_method(docservant, 'urn:doc_serv#doc_serv', 'doc_serv',
      [XSD::QName.new('urn:styleuse', 'req')],
      [XSD::QName.new('urn:styleuse', 'res')])
    add_document_method(docservant, 'urn:doc_serv#doc_serv2', 'doc_serv2',
      [XSD::QName.new('urn:styleuse', 'req')],
      [XSD::QName.new('urn:styleuse', 'res')])

    #servant = Servant.new
    # ToDo: too plain: should add bare test case
    #qname ||= XSD::QName.new(@default_namespace, name)
    #add_operation(qname, nil, servant, "rpc_enc_rpc_enc", param_def,
    #  opt(:rpc, :rpc, :encoded, :encoded))
  end

  def opt(request_style, request_use, response_style, response_use)
    {
      :request_style => request_style,
      :request_use => request_use,
      :response_style => response_style,
      :response_use => response_use
    }
  end
end

if $0 == __FILE__
  server = Server.new('Server', 'urn:styleuse', '0.0.0.0', 7000)
  trap(:INT) do
    server.shutdown
  end
  server.start
end

Version data entries

20 entries across 15 versions & 9 rubygems

Version Path
malagant-soap4r-1.5.8.20141127181857 test/soap/styleuse/server.rb
rtiss_soap4r-1.6.1 test/soap/styleuse/server.rb
rtiss_soap4r-1.6.0 test/soap/styleuse/server.rb
eSpace_soap4r-1.5.8 test/soap/styleuse/server.rb
soap4r-ruby19-1.5.9 test/soap/styleuse/server.rb
tomdz-soap4r-1.5.8.20120202093209 test/soap/styleuse/server.rb
soap5r-2.0.3 test/soap/styleuse/server.rb
soap5r-2.0.3 sample/howto/styleuse/server.rb
soap5r-2.0.2 test/soap/styleuse/server.rb
soap5r-2.0.2 sample/howto/styleuse/server.rb
soap5r-2.0.1 test/soap/styleuse/server.rb
soap5r-2.0.1 sample/howto/styleuse/server.rb
soap5r-2.0.0 test/soap/styleuse/server.rb
soap5r-2.0.0 sample/howto/styleuse/server.rb
soap5r-2.0.0.20120130130121 test/soap/styleuse/server.rb
soap5r-2.0.0.20120130130121 sample/howto/styleuse/server.rb
soap4r-sgonyea-1.5.9 test/soap/styleuse/server.rb
sunteya-soap4r-1.5.8.0 test/soap/styleuse/server.rb
tomdz-soap4r-1.5.8.20111103171510 test/soap/styleuse/server.rb
rubyjedi-soap4r-1.5.8.20100619003610 test/soap/styleuse/server.rb