Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1671

Show
Ignore:
Timestamp:
11/15/05 22:38:38 (3 years ago)
Author:
nahi
Message:

HTTPServer accepts :WSDLDocumentDirectory option which points WSDL serving directory. You can browse the directory at /wsdl of the server. closes #161.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/rpc/httpserver.rb

    r1670 r1671  
    11# SOAP4R - WEBrick HTTP Server 
    2 # Copyright (C) 2003, 2004 by NAKAMURA, Hiroshi <nahi@ruby-lang.org>. 
     2# Copyright (C) 2003, 2004, 2005 by NAKAMURA, Hiroshi <nahi@ruby-lang.org>. 
    33 
    44# This program is copyrighted free software by NAKAMURA, Hiroshi.  You can 
     
    3333    on_init 
    3434    @server = WEBrick::HTTPServer.new(@webrick_config) 
     35    @server.mount('/soaprouter', @soaplet) 
     36    if wsdldir = config[:WSDLDocumentDirectory] 
     37      @server.mount('/wsdl', WEBrick::HTTPServlet::FileHandler, wsdldir) 
     38    end 
     39    # for backward compatibility 
    3540    @server.mount('/', @soaplet) 
    3641  end 
  • trunk/sample/wsdl/helloworld/server/hw_s.rb

    r1640 r1671  
    1 require 'soap/rpc/standaloneServer' 
    2 class QueryServer < SOAP::RPC::StandaloneServer 
     1require 'soap/rpc/httpserver' 
     2class QueryServer < SOAP::RPC::HTTPServer 
    33  def on_init 
    44    #@log.level = Logger::Severity::DEBUG 
     
    77 
    88  def hello_world(from) 
    9        sOut="Hellow world from #{from}" 
    10        sOut 
     9    sOut="Hellow world from #{from}" 
     10    sOut 
    1111  end 
    1212end 
    1313 
    1414if $0 == __FILE__ 
    15   # You need to use ../changesTohttpserver/*.rb to supply WSDL files in the 
    16   # specified directory.  It may be merged in the future (with some changes) 
    17   # server = QueryServer.new('hws', 'http://localhost:2000/wsdl/hws.wsdl', '0.0.0.0', 2000, "c:/soap4r-20050420/sample/soap/helloworld") 
    18  
    19   server = QueryServer.new('hws', 'http://localhost:2000/wsdl/hws.wsdl', '0.0.0.0', 2000) 
     15  server = QueryServer.new( 
     16    :BindAddress => '0.0.0.0', 
     17    :Port => 2000, 
     18    :SOAPDefaultNamespace => 'http://localhost:2000/wsdl/hws.wsdl', 
     19    :WSDLDocumentDirectory => '.' 
     20  ) 
    2021  trap(:INT) do  
    2122    server.shutdown 
  • trunk/sample/wsdl/helloworld/server/hws.wsdl

    r1640 r1671  
    1010xmlns="http://schemas.xmlsoap.org/wsdl/"  
    1111targetNamespace="http://localhost:2000/wsdl/hws.wsdl"> 
    12 <message name="getInvoices"> 
    13    <part name="from" type="xsd:date"/> 
    14    <part name="to" type="xsd:date"/> 
     12<message name="getTermRequest"> 
     13   <part name="from" type="xsd:string"/> 
    1514</message> 
    1615 
    17 <message name="getInvoiceResponse"> 
    18    <part name="queryInvoiceResponse" type="xsd:string"/> 
     16<message name="hello_worldResponse"> 
     17   <part name="from" type="xsd:string"/> 
    1918</message> 
    2019 
    21 <portType name="queryPort"> 
    22   <operation name="queryInvoice"> 
    23       <input message="getInvoices"/> 
    24       <output message="getInvoiceResponse"/> 
     20<portType name="hwsPort"> 
     21  <operation name="hello_world"> 
     22      <input message="getTermRequest"/> 
     23      <output message="hello_worldResponse"/> 
    2524  </operation> 
    2625</portType> 
    27 <binding name="queryBinding" type="tns:queryPort"> 
     26<binding name="hwsBinding" type="tns:hwsPort"> 
    2827   <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
    29    <operation name="queryInvoice"> 
    30        <soap:operation soapaction="http://localhost:2000/wsdl/hws.wsdl#queryInvoice" style="rpc"/> 
     28   <operation name="hello_world"> 
     29       <soap:operation soapAction="http://localhost:2000/wsdl/hws.wsdl#hello_world" style="rpc"/> 
    3130      <input> 
    3231         <soap:body use="encoded" namespace="http://localhost:2000/wsdl/hws.wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
     
    3837 </binding> 
    3938 <service name="hws"> 
    40     <documentation>The service returns subscriptions paid by invoice in the period from(date) 
    41     to to(date)</documentation> 
    42     <port name="queryPort" binding="tns:queryBinding"> 
     39    <documentation>The service simply says hello world from something supplied</documentation> 
     40  
     41    <port name="hwsPort" binding="tns:hwsBinding"> 
    4342       <soap:address location="http://localhost:2000/"/> 
    4443    </port> 
    4544</service> 
     45 
    4646</definitions>