# Wsdl2ruby NoMethodError

**URL:** <https://www.ruby-forum.com/t/wsdl2ruby-nomethoderror/98840>\
**Category:** Ruby\
**Created:** [January 30, 2006, 2:25pm UTC](https://www.ruby-forum.com/t/wsdl2ruby-nomethoderror/98840 "2006-01-30T14:25:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [January 30, 2006, 2:25pm UTC](https://www.ruby-forum.com/t/wsdl2ruby-nomethoderror/98840/1 "2006-01-30T14:25:20Z")

</div>

Hi, i’m trying to generate objects for my wsdl and wsdl2ruby comes with  
error:

F, [2006-01-30T15:16:20.082000 #3520] FATAL – app: Detected an  
exception. Stopping … undefined method `namespace’ for nil:NilClass  
(NoMethodError)

any solution for this?

comand line:  
ruby wsdl2ruby.rb --wsdl mywsdl.wsdl --type client --force

wsdl is below:

\<?xml version="1.0" encoding="utf-8"?\>

\<s:schema elementFormDefault=“qualified”  
targetNamespace=“[https://zzz/](https://zzz/)”\>  
\<s:import namespace=“[http://www.w3.org/2001/XMLSchema](http://www.w3.org/2001/XMLSchema)” /\>  
\<s:element name=“GetAllStock”\>  
\<s:complexType /\>  
\</s:element\>  
\<s:element name=“GetAllStockResponse”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element minOccurs=“0” maxOccurs=“1”  
name=“GetAllStockResult”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element ref=“s:schema” /\>  
\<s:any /\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“GetVendorInfo”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element minOccurs=“0” maxOccurs=“1” name=“GamintojoKodas”  
type=“s:string” /\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“GetVendorInfoResponse”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element minOccurs=“0” maxOccurs=“1”  
name=“GetVendorInfoResult”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element ref=“s:schema” /\>  
\<s:any /\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“GetVendorList”\>  
\<s:complexType /\>  
\</s:element\>  
\<s:element name=“GetVendorListResponse”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element minOccurs=“0” maxOccurs=“1”  
name=“GetVendorListResult”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element ref=“s:schema” /\>  
\<s:any /\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“GetProductGroups”\>  
\<s:complexType /\>  
\</s:element\>  
\<s:element name=“GetProductGroupsResponse”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element minOccurs=“0” maxOccurs=“1”  
name=“GetProductGroupsResult”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element ref=“s:schema” /\>  
\<s:any /\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“Add”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element minOccurs=“1” maxOccurs=“1” name=“a” type=“s:int”  
/\>  
\<s:element minOccurs=“1” maxOccurs=“1” name=“b” type=“s:int”  
/\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“AddResponse”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element minOccurs=“1” maxOccurs=“1” name=“AddResult”  
type=“s:int” /\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“DataSet” nillable=“true”\>  
\<s:complexType\>  
\<s:sequence\>  
\<s:element ref=“s:schema” /\>  
\<s:any /\>  
\</s:sequence\>  
\</s:complexType\>  
\</s:element\>  
\<s:element name=“int” type=“s:int” /\>  
\</s:schema\>  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
\<soap:binding transport=“[http://schemas.xmlsoap.org/soap/http](http://schemas.xmlsoap.org/soap/http)”  
style=“document” /\>  
  
\<soap:operation soapAction=“[https://zzz/GetAllStock](https://zzz/GetAllStock)”  
style=“document” /\>  
  
\<soap:body use=“literal” /\>  
  
  
\<soap:body use=“literal” /\>  
  
  
  
\<soap:operation soapAction=“[https://zzz/GetVendorInfo](https://zzz/GetVendorInfo)”  
style=“document” /\>  
  
\<soap:body use=“literal” /\>  
  
  
\<soap:body use=“literal” /\>  
  
  
  
\<soap:operation soapAction=“[https://zzz/GetVendorList](https://zzz/GetVendorList)”  
style=“document” /\>  
  
\<soap:body use=“literal” /\>  
  
  
\<soap:body use=“literal” /\>  
  
  
  
\<soap:operation soapAction=“[https://zzz/GetProductGroups](https://zzz/GetProductGroups)”  
style=“document” /\>  
  
\<soap:body use=“literal” /\>  
  
  
\<soap:body use=“literal” /\>  
  
  
  
\<soap:operation soapAction=“[https://zzz/Add](https://zzz/Add)” style=“document” /\>  
  
\<soap:body use=“literal” /\>  
  
  
\<soap:body use=“literal” /\>  
  
  
  
  
\<http:binding verb=“GET” /\>  
  
\<http:operation location=“/GetAllStock” /\>  
  
\<http:urlEncoded /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/GetVendorInfo” /\>  
  
\<http:urlEncoded /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/GetVendorList” /\>  
  
\<http:urlEncoded /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/GetProductGroups” /\>  
  
\<http:urlEncoded /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/Add” /\>  
  
\<http:urlEncoded /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
  
\<http:binding verb=“POST” /\>  
  
\<http:operation location=“/GetAllStock” /\>  
  
\<mime:content type=“application/x-www-form-urlencoded” /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/GetVendorInfo” /\>  
  
\<mime:content type=“application/x-www-form-urlencoded” /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/GetVendorList” /\>  
  
\<mime:content type=“application/x-www-form-urlencoded” /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/GetProductGroups” /\>  
  
\<mime:content type=“application/x-www-form-urlencoded” /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
\<http:operation location=“/Add” /\>  
  
\<mime:content type=“application/x-www-form-urlencoded” /\>  
  
  
\<mime:mimeXml part=“Body” /\>  
  
  
  
  
  
\<soap:address location=“[https://zzz/XML/product.asmx](https://zzz/XML/product.asmx)” /\>  
  
  
\<http:address location=“[https://zzz/XML/product.asmx](https://zzz/XML/product.asmx)” /\>  
  
  
\<http:address location=“[https://zzz/XML/product.asmx](https://zzz/XML/product.asmx)” /\>

---

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [January 30, 2006, 2:56pm UTC](https://www.ruby-forum.com/t/wsdl2ruby-nomethoderror/98840/2 "2006-01-30T14:56:08Z")

</div>

I’ve got it working by my self by removing --force option,

btw could anybody point me, where are all options and their meaning of  
wsdl2ruby described?

---

<div class="post-metadata">

**Author:** ![Giedrius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@Giedrius](https://www.ruby-forum.com/u/Giedrius)\
**Post date:** [March 5, 2006, 2:30pm UTC](https://www.ruby-forum.com/t/wsdl2ruby-nomethoderror/98840/3 "2006-03-05T14:30:56Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Sorry for late reply.

Giedrius wrote:

> Hi, i’m trying to generate objects for my wsdl and wsdl2ruby comes with  
> error:
> 
> F, [2006-01-30T15:16:20.082000 #3520] FATAL – app: Detected an  
> exception. Stopping … undefined method `namespace’ for nil:NilClass  
> (NoMethodError)
> 
> any solution for this?

It’s the bug of soap4r. I fixed it at the subversion repository though  
I’m afraid of seeing how wsdl2ruby.rb can handle .NET DataSet. Would  
you please try this patch?

Regards,  
// NaHi

# Index: wsdl/soap/classDefCreator.rb

- — wsdl/soap/classDefCreator.rb (revision 1680)  
+++ wsdl/soap/classDefCreator.rb (working copy)  
@@ -311,7 +311,7 @@  
init\_params \<\< “#{varname} = nil”  
end  
# nil means @@schema\_ns + varname
- 
  - 

```
   eleqname = element.name || element.ref.name

```

- 

```
   eleqname = element.name || element.ref
   if eleqname && varname == name && eleqname.namespace ==

```

base\_namespace  
eleqname = nil  
end

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.1 (Cygwin)

iD8DBQFECueQf6b33ts2dPkRAjTsAJ9a4d63nnq+1NhTK4fEw2tdRpsYtQCfQyRm  
oUmRNpl+NcRpEf4/AD5i36I=  
=2Ick  
-----END PGP SIGNATURE-----
