from soap4r-ml
Hello,
On 3 Zář, 15:39, "NAKAMURA, Hiroshi" <nakah...@sarion.co.jp> wrote:
> >
> > Leoš Bitto wrote:
>> > > Well, I have just upgraded to soap4r 1.5.7.90.20070831 and it seems
>> > > that this issue is still not solved completely - I still get the
>> > > warning "cannot find mapped class: Entry". Here is the relevant part
>> > > of the schema:
> >
> > Thank you very much for trying RC. Anonymous class support was
> > incomplete about Array. I reopened #355 and have fixed now.
> >
> > Would you please try it?
Sure, thanks for the fix. At the first sight it looks promising - this
is generated now:
class ExtraInfo < ::Array
class Entry
attr_accessor :key
attr_accessor :value
def initialize(key = nil, value = nil)
@key = key
@value = value
end
end
end
So I have tried to use it this way:
entry=ExtraInfo::Entry.new(SOAP::SOAPString.new('key1'),SOAP::SOAPString.new('value1'))
and bummer:
in `initialize': wrong number of arguments (2 for 0) (ArgumentError)
Am I mad or what? It should have two arguments! Or not? After some
investigation not, because in a different XML schema (with a different
XML namespace) there is an element cleverly named ExtraInfo, too.
Unfortunatelly wsdl2ruby does not handle this situation correctly now
and just redefines (reopens) the above mentioned class. This is the
part of the other XML schema:
<xs:element name="ExtraInfo">
<xs:annotation>
<xs:documentation> A particular solution specific information.</
xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Entry">
<xs:annotation>
<xs:documentation>An actual value of the extra info item.</
xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="Key" type="xs:string"
use="required">
<xs:annotation>
<xs:documentation>An identification of the extra
info item.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="unique_key">
<xs:annotation>
<xs:documentation>Unique constraint. The attribute Key must be
unique.</xs:documentation>
</xs:annotation>
<xs:selector xpath="msg:Entry"/>
<xs:field xpath="@Key"/>
</xs:unique>
</xs:element>
and this is how wsdl2ruby reopens the above mentioned class:
class ExtraInfo < ::Array
# xmlattr_Key - SOAP::SOAPString
class Entry
AttrKey = XSD::QName.new(nil, "Key")
def __xmlattr
@__xmlattr ||= {}
end
def xmlattr_Key
__xmlattr[AttrKey]
end
def xmlattr_Key=(value)
__xmlattr[AttrKey] = value
end
def initialize
@__xmlattr = {}
end
end
end
No arguments for initialize() here, so the ArgumentError makes sense
now. Another fix to properly distinguish elements from complexTypes
needed? And maybe the same names in different XML namespaces should be
considered, too...
Leoš Bitto