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

Changeset 1584

Show
Ignore:
Timestamp:
07/21/05 22:38:35 (3 years ago)
Author:
nahi
Message:

rpc/literal support. closes #118.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/encodingstyle/literalHandler.rb

    r1581 r1584  
    6666      end 
    6767    when SOAPElement 
     68      # passes 2 times for simplifying namespace definition 
     69      data.each do |key, value| 
     70        if value.elename.namespace 
     71          SOAPGenerator.assign_ns(attrs, ns, value.elename.namespace) 
     72        end 
     73      end 
    6874      generator.encode_tag(name, attrs) 
    6975      generator.encode_rawstring(data.text) if data.text 
  • trunk/lib/soap/mapping/mapping.rb

    r1581 r1584  
    306306    elements = [] 
    307307    as_array = [] 
     308    schema_ns = klass.class_eval('@@schema_ns') 
    308309    klass.class_eval('@@schema_element').each do |varname, definition| 
    309310      class_name, name = definition 
     
    312313        as_array << (name ? name.name : varname) 
    313314      end 
    314       elements << [name || XSD::QName.new(nil, varname), class_name] 
     315      elements << [name || XSD::QName.new(schema_ns, varname), class_name] 
    315316    end 
    316317    [elements, as_array] 
  • trunk/lib/soap/mapping/wsdlliteralregistry.rb

    r1581 r1584  
    5555  # node should be a SOAPElement 
    5656  def soap2obj(node, obj_class = nil) 
    57     unless obj_class.nil? 
    58       raise MappingError.new("must not reach here") 
    59     end 
     57    # obj_class is given when rpc/literal service.  but ignored for now. 
    6058    begin 
    6159      return any2obj(node) 
  • trunk/lib/soap/rpc/router.rb

    r1551 r1584  
    241241    end 
    242242    if soapaction 
    243       raise RPCRoutingError.new("operation: #{soapaction} not supported") 
     243      raise RPCRoutingError.new( 
     244        "operation: #{soapaction} #{qname} not supported") 
    244245    else 
    245246      raise RPCRoutingError.new("operation: #{qname} not supported") 
  • trunk/lib/wsdl/soap/classDefCreator.rb

    r1581 r1584  
    161161        params << "#{varname} = nil" 
    162162      end 
    163       eleqname = (varname == name) ? nil : element.name 
     163      # nil means @@schema_ns + varname 
     164      eleqname = 
     165        (varname == name && element.name.namespace == qname.namespace) ? 
     166        nil : element.name 
    164167      schema_element << [varname, eleqname, type] 
    165168    end 
  • trunk/lib/wsdl/xmlSchema/element.rb

    r1580 r1584  
    108108    case attr 
    109109    when NameAttrName 
    110       @name = XSD::QName.new(targetnamespace, value.source) 
     110      namespace = directelement? ? targetnamespace : nil 
     111      @name = XSD::QName.new(namespace, value.source) 
    111112    when FormAttrName 
    112113      @form = value.source 
     
    118119      if parent.is_a?(All) 
    119120        if value.source != '1' 
    120           raise Parser::AttrConstraintError.new("cannot parse #{value} for #{attr}") 
     121          raise Parser::AttrConstraintError.new( 
     122            "cannot parse #{value} for #{attr}") 
    121123        end 
    122124      end 
     
    125127      if parent.is_a?(All) 
    126128        unless ['0', '1'].include?(value.source) 
    127           raise Parser::AttrConstraintError.new("cannot parse #{value} for #{attr}") 
     129          raise Parser::AttrConstraintError.new( 
     130            "cannot parse #{value} for #{attr}") 
    128131        end 
    129132      end 
     
    135138    end 
    136139  end 
     140 
     141private 
     142 
     143  def directelement? 
     144    parent.is_a?(Schema) 
     145  end 
    137146end 
    138147 
  • trunk/test/soap/test_httpconfigloader.rb

    r1579 r1584  
    2121# depth: 1 causes an error (intentional) 
    2222protocol.http.ssl_config.verify_depth = 1 
    23 protocol.http.ssl_config.client_cert = #{File.join(DIR, 'client.cert')} 
    24 protocol.http.ssl_config.client_key = #{File.join(DIR, 'client.key')} 
    25 protocol.http.ssl_config.ca_file = #{File.join(DIR, 'ca.cert')} 
    26 protocol.http.ssl_config.ca_file = #{File.join(DIR, 'subca.cert')} 
    2723protocol.http.ssl_config.ciphers = ALL 
    2824__EOP__ 
     
    3026    begin 
    3127      @client.loadproperty(testpropertyname) 
    32       @client.options["protocol.http.ssl_config.verify_callback"] = method(:verify_callback).to_proc 
    33       @verify_callback_called = false 
    34       begin 
    35         @client.hello_world("ssl client") 
    36         assert(false) 
    37       rescue OpenSSL::SSL::SSLError => ssle 
    38         assert_equal("certificate verify failed", ssle.message) 
    39         assert(@verify_callback_called) 
    40       end 
    41       # 
    42       @client.options["protocol.http.ssl_config.verify_depth"] = "" 
    43       @verify_callback_called = false 
    44       assert_equal("Hello World, from ssl client", @client.hello_world("ssl client")) 
    45       assert(@verify_callback_called) 
     28      assert_equal('ALL', @client.options['protocol.http.ssl_config.ciphers']) 
    4629    ensure 
    4730      File.unlink(testpropertyname) 
  • trunk/test/wsdl/any/expectedEcho.rb

    r1520 r1584  
    55  @@schema_type = "foo.bar" 
    66  @@schema_ns = "urn:example.com:echo-type" 
    7   @@schema_element = [["any", nil]] 
     7  @@schema_element = [["any", [nil, XSD::QName.new(nil, "any")]]] 
    88 
    99  attr_accessor :any 
  • trunk/test/wsdl/document/echo.rb

    r1522 r1584  
    66  @@schema_ns = "urn:docrpc" 
    77  @@schema_attribute = {XSD::QName.new(nil, "attr_string") => "SOAP::SOAPString", XSD::QName.new(nil, "attr-int") => "SOAP::SOAPInt"} 
    8   @@schema_element = [["struct1", "Echo_struct"], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] 
     8  @@schema_element = [["struct1", ["Echo_struct", XSD::QName.new(nil, "struct1")]], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] 
    99 
    1010  attr_accessor :struct1 
     
    3939  @@schema_ns = "urn:docrpc" 
    4040  @@schema_attribute = {XSD::QName.new(nil, "attr_string") => "SOAP::SOAPString", XSD::QName.new(nil, "attr-int") => "SOAP::SOAPInt"} 
    41   @@schema_element = [["struct1", "Echo_struct"], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] 
     41  @@schema_element = [["struct1", ["Echo_struct", XSD::QName.new(nil, "struct1")]], ["struct_2", ["Echo_struct", XSD::QName.new(nil, "struct-2")]]] 
    4242 
    4343  attr_accessor :struct1 
     
    7272  @@schema_ns = "urn:docrpc" 
    7373  @@schema_attribute = {XSD::QName.new("urn:docrpc", "m_attr") => "SOAP::SOAPString"} 
    74   @@schema_element = [["m_string", "SOAP::SOAPString"], ["m_datetime", "SOAP::SOAPDateTime"]] 
     74  @@schema_element = [["m_string", ["SOAP::SOAPString", XSD::QName.new(nil, "m_string")]], ["m_datetime", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "m_datetime")]]] 
    7575 
    7676  attr_accessor :m_string 
  • trunk/test/wsdl/marshal/person_org.rb

    r1520 r1584  
    55  @@schema_type = "Person" 
    66  @@schema_ns = "http://www.jin.gr.jp/~nahi/xmlns/sample/Person" 
    7   @@schema_element = [["familyname", "SOAP::SOAPString"], ["givenname", "SOAP::SOAPString"], ["var1", "SOAP::SOAPInt"], ["var2", "SOAP::SOAPDouble"], ["var3", "SOAP::SOAPString"]] 
     7  @@schema_element = [["familyname", ["SOAP::SOAPString", XSD::QName.new(nil, "familyname")]], ["givenname", ["SOAP::SOAPString", XSD::QName.new(nil, "givenname")]], ["var1", ["SOAP::SOAPInt", XSD::QName.new(nil, "var1")]], ["var2", ["SOAP::SOAPDouble", XSD::QName.new(nil, "var2")]], ["var3", ["SOAP::SOAPString", XSD::QName.new(nil, "var3")]]] 
    88 
    99  attr_accessor :familyname 
  • trunk/test/wsdl/qualified/lp.wsdl

    r1580 r1584  
    1616    <part name="parameters" element="tns:login" /> 
    1717  </message> 
    18   <message name="login_in2"> 
    19     <part name="parameters" element="tns:login2" /> 
    20   </message> 
    2118  <message name="login_out"> 
    2219    <part name="parameters" element="tns:loginResponse" /> 
     
    2623    <operation name="login"> 
    2724      <input message="tns:login_in" /> 
    28       <output message="tns:login_out" /> 
    29     </operation> 
    30     <operation name="login2"> 
    31       <input message="tns:login_in2" /> 
    3225      <output message="tns:login_out" /> 
    3326    </operation> 
     
    4538      </output> 
    4639    </operation> 
    47     <operation name="login2"> 
    48       <soap:operation soapAction="urn:lp:login2" style="document" /> 
    49       <input> 
    50         <soap:body use="literal" /> 
    51       </input> 
    52       <output> 
    53         <soap:body use="literal" /> 
    54       </output> 
    55     </operation> 
    5640  </binding> 
    5741 
  • trunk/test/wsdl/qualified/lp.xsd

    r1580 r1584  
    99  </xs:complexType> 
    1010 
    11   <xs:element name="login" type="lp:login" form="qualified"/> <!-- qualified --> 
    12   <xs:element name="login2" type="lp:login"/> <!-- unqualified --> 
     11  <xs:element name="login" type="lp:login"/> 
    1312 
    1413  <xs:complexType name="loginResponse"> 
  • trunk/test/wsdl/qualified/test_qualified.rb

    r1580 r1584  
    1818        'login', 
    1919        XSD::QName.new(Namespace, 'login'), 
    20         XSD::QName.new(Namespace, 'loginResponse') 
    21       ) 
    22       add_document_method( 
    23         self, 
    24         Namespace + ':login', 
    25         'login', 
    26         XSD::QName.new(Namespace, 'login2'), 
    2720        XSD::QName.new(Namespace, 'loginResponse') 
    2821      ) 
     
    9992  <env:Body> 
    10093    <n1:login xmlns:n1="urn:lp"> 
    101       <n1:username>NaHi</n1:username> 
    102       <n1:password>passwd</n1:password> 
    103       <n1:timezone>JST</n1:timezone> 
    104     </n1:login> 
    105   </env:Body> 
    106 </env:Envelope>] 
    107  
    108   LOGIN_REQUEST_QUALIFIED_DEFAULT = 
    109 %q[<?xml version="1.0" encoding="utf-8" ?> 
    110 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    111     xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
    112     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    113   <env:Body> 
    114     <login xmlns="urn:lp"> 
    11594      <username>NaHi</username> 
    11695      <password>passwd</password> 
    11796      <timezone>JST</timezone> 
    118     </login> 
    119   </env:Body> 
    120 </env:Envelope>] 
    121  
    122     LOGIN_REQUEST_UNQUALIFIED = 
    123 %q[<?xml version="1.0" encoding="utf-8" ?> 
    124 <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    125     xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
    126     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    127   <env:Body> 
    128     <n1:login2 xmlns:n1="urn:lp"> 
    129       <username>NaHi</username> 
    130       <password>passwd</password> 
    131       <timezone>JST</timezone> 
    132     </n1:login2> 
     97    </n1:login> 
    13398  </env:Body> 
    13499</env:Envelope>] 
     
    149114      :username => 'NaHi') 
    150115    assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)) 
    151  
    152     @client.wiredump_dev = str = '' 
    153     @client.login2(:timezone => 'JST', :password => 'passwd', 
    154       :username => 'NaHi') 
    155     assert_equal(LOGIN_REQUEST_UNQUALIFIED, parse_requestxml(str)) 
    156116  end 
    157117 
     
    169129    @client.wiredump_dev = str = '' 
    170130    @client.login(Login.new('NaHi', 'passwd', 'JST')) 
    171     assert_equal(LOGIN_REQUEST_QUALIFIED_DEFAULT, parse_requestxml(str)) 
    172  
    173     @client.wiredump_dev = str = '' 
    174     @client.login2(Login.new('NaHi', 'passwd', 'JST')) 
    175     assert_equal(LOGIN_REQUEST_UNQUALIFIED, parse_requestxml(str)) 
     131    assert_equal(LOGIN_REQUEST_QUALIFIED, parse_requestxml(str)) 
    176132  end 
    177133 
  • trunk/test/wsdl/ref/expectedProduct.rb

    r1522 r1584  
    1313  @@schema_ns = "urn:product" 
    1414  @@schema_attribute = {XSD::QName.new("urn:product", "version") => "SOAP::SOAPString", XSD::QName.new("urn:product", "yesno") => "SOAP::SOAPString"} 
    15   @@schema_element = [["bag", "Product[]"], ["rating", ["SOAP::SOAPString[]", XSD::QName.new("urn:product", "Rating")]], ["product_Bag", [nil, XSD::QName.new("urn:product", "Product-Bag")]], ["comment_1", nil], ["comment_2", ["Comment[]", XSD::QName.new(nil, "comment-2")]]] 
     15  @@schema_element = [["bag", ["Product[]", XSD::QName.new(nil, "bag")]], ["rating", ["SOAP::SOAPString[]", XSD::QName.new("urn:product", "Rating")]], ["product_Bag", [nil, XSD::QName.new("urn:product", "Product-Bag")]], ["comment_1", [nil, XSD::QName.new(nil, "comment_1")]], ["comment_2", ["Comment[]", XSD::QName.new(nil, "comment-2")]]] 
    1616 
    1717  attr_accessor :bag 
     
    6868  @@schema_type = "Product" 
    6969  @@schema_ns = "urn:product" 
    70   @@schema_element = [["name", "SOAP::SOAPString"], ["rating", ["SOAP::SOAPString", XSD::QName.new("urn:product", "Rating")]]] 
     70  @@schema_element = [["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], ["rating", ["SOAP::SOAPString", XSD::QName.new("urn:product", "Rating")]]] 
    7171 
    7272  attr_accessor :name 
  • trunk/test/wsdl/rpc/test-rpc-lit.wsdl

    r1581 r1584  
    1919                        </complexType> 
    2020 
     21                        <complexType name="ArrayOfstringInline"> 
     22                                <sequence> 
     23                                        <element name="stringItem" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> 
     24                                </sequence> 
     25                        </complexType> 
     26 
    2127                        <complexType name="ArrayOfint"> 
    2228                                <sequence> 
     
    122128        </message> 
    123129 
     130        <message name="echoStringArrayInlineRequest"> 
     131                <part name="inputStringArray" type="types:ArrayOfstringInline"/> 
     132        </message> 
     133        <message name="echoStringArrayInlineResponse"> 
     134                <part name="return" type="types:ArrayOfstringInline"/> 
     135        </message> 
     136 
    124137        <!-- echoIntegerArray rpc operation --> 
    125138        <message name="echoIntegerArrayRequest"> 
     
    191204                </operation> 
    192205 
     206                <operation name="echoStringArrayInline" parameterOrder="inputStringArray"> 
     207                        <input message="tns:echoStringArrayInlineRequest"/> 
     208                        <output message="tns:echoStringArrayInlineResponse"/> 
     209                </operation> 
     210 
    193211                <!-- echoIntegerArray rpc operation --> 
    194212                <operation name="echoIntegerArray" parameterOrder="inputIntegerArray"> 
     
    291309                </operation> 
    292310 
     311                <operation name="echoStringArrayInline"> 
     312                        <soap11:operation soapAction="http://soapinterop.org/"/> 
     313                        <input> 
     314                                <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" /> 
     315                        </input> 
     316                        <output> 
     317                                <soap11:body use="literal" namespace="http://soapbuilders.org/rpc-lit-test" /> 
     318                        </output> 
     319                </operation> 
     320 
    293321                <!-- echoIntegerArray rpc operation --> 
    294322                <operation name="echoIntegerArray"> 
  • trunk/test/wsdl/rpc/test_rpc_lit.rb

    r1581 r1584  
    2828        } 
    2929      ) 
     30      add_rpc_operation(self,  
     31        XSD::QName.new(Namespace, 'echoStringArrayInline'), 
     32        nil, 
     33        'echoStringArrayInline', [ 
     34          ['in', 'inputStringArray', nil], 
     35          ['retval', 'return', nil] 
     36        ], 
     37        { 
     38          :request_style => :rpc, 
     39          :request_use => :literal, 
     40          :response_style => :rpc, 
     41          :response_use => :literal 
     42        } 
     43      ) 
     44      add_rpc_operation(self,  
     45        XSD::QName.new(Namespace, 'echoNestedStruct'), 
     46        nil, 
     47        'echoNestedStruct', [ 
     48          ['in', 'inputNestedStruct', nil], 
     49          ['retval', 'return', nil] 
     50        ], 
     51        { 
     52          :request_style => :rpc, 
     53          :request_use => :literal, 
     54          :response_style => :rpc, 
     55          :response_use => :literal 
     56        } 
     57      ) 
     58      add_rpc_operation(self,  
     59        XSD::QName.new(Namespace, 'echoStructArray'), 
     60        nil, 
     61        'echoStructArray', [ 
     62          ['in', 'inputStructArray', nil], 
     63          ['retval', 'return', nil] 
     64        ], 
     65        { 
     66          :request_style => :rpc, 
     67          :request_use => :literal, 
     68          :response_style => :rpc, 
     69          :response_use => :literal 
     70        } 
     71      ) 
    3072    end 
    3173   
     
    3375      # strings.stringItem => Array 
    3476      ArrayOfstring[*strings.stringItem] 
     77    end 
     78 
     79    def echoStringArrayInline(strings) 
     80      ArrayOfstringInline[*strings.stringItem] 
     81    end 
     82 
     83    def echoNestedStruct(struct) 
     84      struct 
     85    end 
     86 
     87    def echoStructArray(ary) 
     88      ary 
    3589    end 
    3690  end 
     
    98152  end 
    99153 
    100   def test_wsdl 
     154  def test_wsdl_echoStringArray 
    101155    wsdl = pathname('test-rpc-lit.wsdl') 
    102156    @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver 
     
    108162  end 
    109163 
    110   def test_stub 
     164  ECHO_STRING_ARRAY_REQUEST = 
     165%q[<?xml version="1.0" encoding="utf-8" ?> 
     166<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     167    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     168    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     169  <env:Body> 
     170    <n1:echoStringArray xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     171      <inputStringArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 
     172        <n2:stringItem>a</n2:stringItem> 
     173        <n2:stringItem>b</n2:stringItem> 
     174        <n2:stringItem>c</n2:stringItem> 
     175      </inputStringArray> 
     176    </n1:echoStringArray> 
     177  </env:Body> 
     178</env:Envelope>] 
     179 
     180  ECHO_STRING_ARRAY_RESPONSE = 
     181%q[<?xml version="1.0" encoding="utf-8" ?> 
     182<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     183    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     184  <env:Body> 
     185    <n1:echoStringArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     186      <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 
     187        <n2:stringItem>a</n2:stringItem> 
     188        <n2:stringItem>b</n2:stringItem> 
     189        <n2:stringItem>c</n2:stringItem> 
     190      </return> 
     191    </n1:echoStringArrayResponse> 
     192  </env:Body> 
     193</env:Envelope>] 
     194 
     195  def test_stub_echoStringArray 
    111196    drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 
    112     drv.wiredump_dev = STDOUT if $DEBUG 
     197    drv.wiredump_dev = str = '' 
     198    # response contains only 1 part. 
    113199    result = drv.echoStringArray(ArrayOfstring["a", "b", "c"])[0] 
    114200    assert_equal(["a", "b", "c"], result.stringItem) 
     201    assert_equal(ECHO_STRING_ARRAY_REQUEST, parse_requestxml(str)) 
     202    assert_equal(ECHO_STRING_ARRAY_RESPONSE, parse_responsexml(str)) 
     203  end 
     204 
     205  ECHO_STRING_ARRAY_INLINE_REQUEST = 
     206%q[<?xml version="1.0" encoding="utf-8" ?> 
     207<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     208    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     209    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     210  <env:Body> 
     211    <n1:echoStringArrayInline xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     212      <inputStringArray> 
     213        <stringItem>a</stringItem> 
     214        <stringItem>b</stringItem> 
     215        <stringItem>c</stringItem> 
     216      </inputStringArray> 
     217    </n1:echoStringArrayInline> 
     218  </env:Body> 
     219</env:Envelope>] 
     220 
     221  ECHO_STRING_ARRAY_INLINE_RESPONSE = 
     222%q[<?xml version="1.0" encoding="utf-8" ?> 
     223<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     224    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     225  <env:Body> 
     226    <n1:echoStringArrayInlineResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     227      <return> 
     228        <stringItem>a</stringItem> 
     229        <stringItem>b</stringItem> 
     230        <stringItem>c</stringItem> 
     231      </return> 
     232    </n1:echoStringArrayInlineResponse> 
     233  </env:Body> 
     234</env:Envelope>] 
     235 
     236  def test_stub_echoStringArrayInline 
     237    drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 
     238    drv.wiredump_dev = str = '' 
     239    # response contains only 1 part. 
     240    result = drv.echoStringArrayInline(ArrayOfstringInline["a", "b", "c"])[0] 
     241    assert_equal(["a", "b", "c"], result.stringItem) 
     242    assert_equal(ECHO_STRING_ARRAY_INLINE_REQUEST, parse_requestxml(str)) 
     243    assert_equal(ECHO_STRING_ARRAY_INLINE_RESPONSE, parse_responsexml(str)) 
     244  end 
     245 
     246  ECHO_NESTED_STRUCT_REQUEST = 
     247%q[<?xml version="1.0" encoding="utf-8" ?> 
     248<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     249    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     250    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     251  <env:Body> 
     252    <n1:echoNestedStruct xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     253      <inputStruct xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 
     254        <varString>str</varString> 
     255        <varInt>1</varInt> 
     256        <varFloat>+1</varFloat> 
     257        <n2:structItem> 
     258          <varString>str</varString> 
     259          <varInt>1</varInt> 
     260          <varFloat>+1</varFloat> 
     261        </n2:structItem> 
     262      </inputStruct> 
     263    </n1:echoNestedStruct> 
     264  </env:Body> 
     265</env:Envelope>] 
     266 
     267  ECHO_NESTED_STRUCT_RESPONSE = 
     268%q[<?xml version="1.0" encoding="utf-8" ?> 
     269<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     270    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     271  <env:Body> 
     272    <n1:echoNestedStructResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     273      <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 
     274        <varString>str</varString> 
     275        <varInt>1</varInt> 
     276        <varFloat>+1</varFloat> 
     277        <n2:structItem> 
     278          <varString>str</varString> 
     279          <varInt>1</varInt> 
     280          <varFloat>+1</varFloat> 
     281        </n2:structItem> 
     282      </return> 
     283    </n1:echoNestedStructResponse> 
     284  </env:Body> 
     285</env:Envelope>] 
     286 
     287  def test_wsdl_echoNestedStruct 
     288    wsdl = pathname('test-rpc-lit.wsdl') 
     289    @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver 
     290    @client.endpoint_url = "http://localhost:#{Port}/" 
     291    @client.wiredump_dev = str = '' 
     292    # response contains only 1 part. 
     293    result = @client.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0] 
     294    assert_equal('str', result.varString) 
     295    assert_equal('1', result.varInt) 
     296    assert_equal('+1', result.varFloat) 
     297    assert_equal('str', result.structItem.varString) 
     298    assert_equal('1', result.structItem.varInt) 
     299    assert_equal('+1', result.structItem.varFloat) 
     300    assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str)) 
     301    assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str)) 
     302  end 
     303 
     304  def test_stub_echoNestedStruct 
     305    drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 
     306    drv.wiredump_dev = str = '' 
     307    # response contains only 1 part. 
     308    result = drv.echoNestedStruct(SOAPStructStruct.new("str", 1, 1.0, SOAPStruct.new("str", 1, 1.0)))[0] 
     309    assert_equal('str', result.varString) 
     310    assert_equal('1', result.varInt) 
     311    assert_equal('+1', result.varFloat) 
     312    assert_equal('str', result.structItem.varString) 
     313    assert_equal('1', result.structItem.varInt) 
     314    assert_equal('+1', result.structItem.varFloat) 
     315    assert_equal(ECHO_NESTED_STRUCT_REQUEST, parse_requestxml(str)) 
     316    assert_equal(ECHO_NESTED_STRUCT_RESPONSE, parse_responsexml(str)) 
     317  end 
     318 
     319  ECHO_STRUCT_ARRAY_REQUEST = 
     320%q[<?xml version="1.0" encoding="utf-8" ?> 
     321<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
     322    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     323    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     324  <env:Body> 
     325    <n1:echoStructArray xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     326      <inputStructArray xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 
     327        <n2:structItem> 
     328          <varString>str</varString> 
     329          <varInt>2</varInt> 
     330          <varFloat>+2.1</varFloat> 
     331        </n2:structItem> 
     332        <n2:structItem> 
     333          <varString>str</varString> 
     334          <varInt>2</varInt> 
     335          <varFloat>+2.1</varFloat> 
     336        </n2:structItem> 
     337      </inputStructArray> 
     338    </n1:echoStructArray> 
     339  </env:Body> 
     340</env:Envelope>] 
     341 
     342  ECHO_STRUCT_ARRAY_RESPONSE = 
     343%q[<?xml version="1.0" encoding="utf-8" ?> 
     344<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
     345    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     346  <env:Body> 
     347    <n1:echoStructArrayResponse xmlns:n1="http://soapbuilders.org/rpc-lit-test"> 
     348      <return xmlns:n2="http://soapbuilders.org/rpc-lit-test/types"> 
     349        <n2:structItem> 
     350          <varString>str</varString> 
     351          <varInt>2</varInt> 
     352          <varFloat>+2.1</varFloat> 
     353        </n2:structItem> 
     354        <n2:structItem> 
     355          <varString>str</varString> 
     356          <varInt>2</varInt> 
     357          <varFloat>+2.1</varFloat> 
     358        </n2:structItem> 
     359      </return> 
     360    </n1:echoStructArrayResponse> 
     361  </env:Body> 
     362</env:Envelope>] 
     363 
     364  def test_wsdl_echoStructArray 
     365    wsdl = pathname('test-rpc-lit.wsdl') 
     366    @client = ::SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver 
     367    @client.endpoint_url = "http://localhost:#{Port}/" 
     368    @client.wiredump_dev = str = '' 
     369    # response contains only 1 part. 
     370    e = SOAPStruct.new("str", 2, 2.1) 
     371    result = @client.echoStructArray(ArrayOfSOAPStruct[e, e]) 
     372    assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str)) 
     373    assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str)) 
     374  end 
     375 
     376  def test_stub_echoStructArray 
     377    drv = SoapTestPortTypeRpc.new("http://localhost:#{Port}/") 
     378    drv.wiredump_dev = str = '' 
     379    # response contains only 1 part. 
     380    e = SOAPStruct.new("str", 2, 2.1) 
     381    result = drv.echoStructArray(ArrayOfSOAPStruct[e, e]) 
     382    assert_equal(ECHO_STRUCT_ARRAY_REQUEST, parse_requestxml(str)) 
     383    assert_equal(ECHO_STRUCT_ARRAY_RESPONSE, parse_responsexml(str)) 
     384  end 
     385 
     386  def parse_requestxml(str) 
     387    str.split(/\r?\n\r?\n/)[3] 
     388  end 
     389 
     390  def parse_responsexml(str) 
     391    str.split(/\r?\n\r?\n/)[6] 
    115392  end 
    116393end 
  • trunk/test/wsdl/simpletype/rpc/expectedEchoVersion.rb

    r1520 r1584  
    55  @@schema_type = "version_struct" 
    66  @@schema_ns = "urn:example.com:simpletype-rpc-type" 
    7   @@schema_element = [["version", "SOAP::SOAPString"], ["msg", "SOAP::SOAPString"]] 
     7  @@schema_element = [["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]]] 
    88 
    99  attr_accessor :version 
  • trunk/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb

    r1520 r1584  
    55  @@schema_type = "version_struct" 
    66  @@schema_ns = "urn:example.com:simpletype-rpc-type" 
    7   @@schema_element = [["version", "SOAP::SOAPString"], ["msg", "SOAP::SOAPString"]] 
     7  @@schema_element = [["version", ["SOAP::SOAPString", XSD::QName.new(nil, "version")]], ["msg", ["SOAP::SOAPString", XSD::QName.new(nil, "msg")]]] 
    88 
    99  attr_accessor :version 
  • trunk/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb

    r1581 r1584  
    55  @@schema_type = "question" 
    66  @@schema_ns = "urn:mysample" 
    7   @@schema_element = [["something", "SOAP::SOAPString"]] 
     7  @@schema_element = [["something", ["SOAP::SOAPString", XSD::QName.new(nil, "something")]]] 
    88 
    99  attr_accessor :something 
     
    1818  @@schema_type = "section" 
    1919  @@schema_ns = "urn:mysample" 
    20   @@schema_element = [["sectionID", "SOAP::SOAPInt"], ["name", "SOAP::SOAPString"], ["description", "SOAP::SOAPString"], ["index", "SOAP::SOAPInt"], ["firstQuestion", "Question"]] 
     20  @@schema_element = [["sectionID", ["SOAP::SOAPInt", XSD::QName.new(nil, "sectionID")]], ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]], ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]], ["index", ["SOAP::SOAPInt", XSD::QName.new(nil, "index")]], ["firstQuestion", ["Question", XSD::QName.new(nil, "firstQuestion")]]] 
    2121 
    2222  attr_accessor :sectionID