# SOAP, enumeration + token, and error in base2soap

**URL:** <https://www.ruby-forum.com/t/soap-enumeration-token-and-error-in-base2soap/128115>\
**Category:** Ruby\
**Created:** [February 5, 2008, 6:15am UTC](https://www.ruby-forum.com/t/soap-enumeration-token-and-error-in-base2soap/128115 "2008-02-05T06:15:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asmo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ea666f/32.png) [@asmo](https://www.ruby-forum.com/u/asmo)\
**Post date:** [February 5, 2008, 6:15am UTC](https://www.ruby-forum.com/t/soap-enumeration-token-and-error-in-base2soap/128115/1 "2008-02-05T06:15:45Z")

</div>

Hi  
I have soap server that has WSDL with request containing

\<xsd:element name=“mode” type=“ons:ModeT” /\>

where ModeT is defined as

```
        <xsd:simpleType name="ModeT">
            <xsd:restriction base="xsd:token">
                <xsd:enumeration value="abc"/>
                <xsd:enumeration value="xyz"/>
            </xsd:restriction>
        </xsd:simpleType>

```

I created client using  
SOAP::WSDLDriverFactory.new(\*).create\_rpc\_driver  
and it fails with

/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:151:in  
`base2soap': undefined method`\<=’ for nil:NilClass (NoMethodError)  
from  
/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:127:in  
`simpleobj2soap' from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:118:in`obj2typesoap’  
from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in  
`obj2soap' from /usr/lib/ruby/1.8/soap/mapping/mapping.rb:127:in`\_obj2soap’  
from  
/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:210:in  
`elements2soap' from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in`each’  
from  
/usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:206:in  
`elements2soap' from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:167:in`struct2soap’  
… 18 levels…

changing xsd:token to xsd:string in client fixes problem (but It won’t  
be  
easy to force such change in oryginal WSDL).

Is it just a bug in soap4r, is there anything I could fix on my side?

greetings

---

<div class="post-metadata">

**Author:** ![asmo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ea666f/32.png) [@asmo](https://www.ruby-forum.com/u/asmo)\
**Post date:** [February 5, 2008, 4:33pm UTC](https://www.ruby-forum.com/t/soap-enumeration-token-and-error-in-base2soap/128115/2 "2008-02-05T16:33:34Z")

</div>

On Feb 5, 12:10 am, Marcin G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> <xsd:enumeration value="xyz"/>
> from /usr/lib/ruby/1.8/soap/mapping/wsdlencodedregistry.rb:44:in `obj2soap'
> 
> ```
> 
> Is it just a bug in soap4r, is there anything I could fix on my side?  
> What version of soap4r are you using? The one that comes with Ruby is  
> buggy. Try grabbing the latest (1.5.8) if you haven’t done so already.

---

<div class="post-metadata">

**Author:** ![asmo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ea666f/32.png) [@asmo](https://www.ruby-forum.com/u/asmo)\
**Post date:** [February 5, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/soap-enumeration-token-and-error-in-base2soap/128115/3 "2008-02-05T17:55:50Z")

</div>

Mark T. wrote:

> What version of soap4r are you using? The one that comes with Ruby is  
> buggy. Try grabbing the latest (1.5.8) if you haven’t done so already.

ok, right, 1.5.8 works well, thanks
