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

Changeset 1950

Show
Ignore:
Timestamp:
09/11/07 17:53:47 (1 year ago)
Author:
nahi
Message:
  • added test for attribute only element array.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/test/wsdl/document/array/double.wsdl

    r1913 r1950  
    88  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> 
    99  <wsdl:types> 
    10     <s:schema elementFormDefault="qualified" 
    11       targetNamespace="http://tempuri.org/"> 
     10    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"> 
     11 
     12      <s:element name="ArrayOfRecord"> 
     13        <s:complexType> 
     14          <s:sequence> 
     15            <s:element maxOccurs="unbounded" name="record" type="tns:report-record"/> 
     16          </s:sequence> 
     17        </s:complexType> 
     18      </s:element> 
     19      <s:complexType name="report-record"> 
     20        <s:attribute name="a" type="s:string" /> 
     21        <s:attribute name="b" type="s:string" /> 
     22        <s:attribute name="c" type="s:string" /> 
     23      </s:complexType> 
     24 
    1225      <s:complexType name="ArrayOfDouble"> 
    1326        <s:sequence> 
     
    1629        </s:sequence> 
    1730      </s:complexType> 
     31 
    1832      <s:element name="echo"> 
    1933        <s:complexType> 
     
    3044        </s:complexType> 
    3145      </s:element> 
     46 
    3247      <s:element name="ArrayOfDouble" nillable="true" type="tns:ArrayOfDouble"/> 
    3348 
     
    3954        </s:complexType> 
    4055      </s:element> 
     56 
    4157      <s:element name="echo2Response"> 
    4258        <s:complexType> 
     
    4662        </s:complexType> 
    4763      </s:element> 
     64 
    4865      <s:element name="ArrayOfComplex"> 
    4966        <s:complexType> 
     
    5370        </s:complexType> 
    5471      </s:element> 
     72 
    5573      <s:element name="Complex"> 
    5674        <s:complexType> 
     
    7694    <wsdl:part name="parameters" element="tns:echo2Response"/> 
    7795  </wsdl:message> 
     96  <wsdl:message name="echo3In"> 
     97    <wsdl:part name="parameters" element="tns:ArrayOfRecord"/> 
     98  </wsdl:message> 
     99  <wsdl:message name="echo3Out"> 
     100    <wsdl:part name="parameters" element="tns:ArrayOfRecord"/> 
     101  </wsdl:message> 
    78102 
    79103  <wsdl:portType name="pricerSoap"> 
     
    87111      <wsdl:output message="tns:echo2Out"/> 
    88112    </wsdl:operation> 
     113 
     114    <wsdl:operation name="echo3"> 
     115      <wsdl:input message="tns:echo3In"/> 
     116      <wsdl:output message="tns:echo3Out"/> 
     117    </wsdl:operation> 
    89118  </wsdl:portType> 
    90119 
     
    92121    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
    93122      style="document"/> 
     123 
    94124    <wsdl:operation name="echo"> 
    95125      <soap:operation soapAction="http://tempuri.org/echo" style="document"/> 
     
    101131      </wsdl:output> 
    102132    </wsdl:operation> 
     133 
    103134    <wsdl:operation name="echo2"> 
    104135      <soap:operation soapAction="http://tempuri.org/echo2" style="document"/> 
     136      <wsdl:input> 
     137        <soap:body use="literal"/> 
     138      </wsdl:input> 
     139      <wsdl:output> 
     140        <soap:body use="literal"/> 
     141      </wsdl:output> 
     142    </wsdl:operation> 
     143 
     144    <wsdl:operation name="echo3"> 
     145      <soap:operation soapAction="http://tempuri.org/echo3" style="document"/> 
    105146      <wsdl:input> 
    106147        <soap:body use="literal"/> 
  • trunk/test/wsdl/document/array/test_array.rb

    r1912 r1950  
    2929        XSD::QName.new(Namespace, 'echo2Response') 
    3030      ) 
     31      add_document_method( 
     32        self, 
     33        Namespace + 'echo3', 
     34        'echo3', 
     35        XSD::QName.new(Namespace, 'ArrayOfRecord'), 
     36        XSD::QName.new(Namespace, 'ArrayOfRecord') 
     37      ) 
    3138      self.literal_mapping_registry = DoubleMappingRegistry::LiteralRegistry 
    3239    end 
     
    3744   
    3845    def echo2(arg) 
     46      arg 
     47    end 
     48 
     49    def echo3(arg) 
    3950      arg 
    4051    end 
     
    142153    assert_equal(nil, @client.echo(Echo.new).ary) 
    143154  end 
     155 
     156  def test_attribute_array 
     157    @client = ::WSDL::Document::PricerSoap.new("http://localhost:#{Port}/") 
     158    @client.wiredump_dev = STDOUT if $DEBUG 
     159    # 
     160    r1 = ReportRecord.new 
     161    r1.xmlattr_a = "r1_xmlattr_a" 
     162    r1.xmlattr_b = "r1_xmlattr_b" 
     163    r1.xmlattr_c = "r1_xmlattr_c" 
     164    r2 = ReportRecord.new 
     165    r2.xmlattr_a = "r2_xmlattr_a" 
     166    r2.xmlattr_b = "r2_xmlattr_b" 
     167    r2.xmlattr_c = "r2_xmlattr_c" 
     168    arg = ArrayOfRecord[r1, r2] 
     169    ret = @client.echo3(arg) 
     170    assert_equal(arg.class , ret.class) 
     171    assert_equal(arg.size , ret.size) 
     172    assert_equal(2, ret.size) 
     173    assert_equal(arg[0].class, ret[0].class) 
     174    assert_equal(arg[0].xmlattr_a, ret[0].xmlattr_a) 
     175    assert_equal(arg[0].xmlattr_b, ret[0].xmlattr_b) 
     176    assert_equal(arg[0].xmlattr_c, ret[0].xmlattr_c) 
     177    assert_equal(arg[1].class, ret[1].class) 
     178    assert_equal(arg[1].xmlattr_a, ret[1].xmlattr_a) 
     179    assert_equal(arg[1].xmlattr_b, ret[1].xmlattr_b) 
     180    assert_equal(arg[1].xmlattr_c, ret[1].xmlattr_c) 
     181    # 
     182    arg = ArrayOfRecord[r1] 
     183    ret = @client.echo3(arg) 
     184    assert_equal(arg.class , ret.class) 
     185    assert_equal(arg.size , ret.size) 
     186    assert_equal(1, ret.size) 
     187    assert_equal(arg[0].class, ret[0].class) 
     188    assert_equal(arg[0].xmlattr_a, ret[0].xmlattr_a) 
     189    assert_equal(arg[0].xmlattr_b, ret[0].xmlattr_b) 
     190    assert_equal(arg[0].xmlattr_c, ret[0].xmlattr_c) 
     191    # 
     192    arg = ArrayOfRecord[] 
     193    ret = @client.echo3(arg) 
     194    assert_equal(arg.class , ret.class) 
     195    assert_equal(arg.size , ret.size) 
     196    assert_equal(0, ret.size) 
     197  end 
    144198end 
    145199