Wsdl2ruby NoMethodError

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"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="https://zzz/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="https://zzz/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <s:schema elementFormDefault="qualified"
targetNamespace="https://zzz/">
      <s:import namespace="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>
  </types>
  <message name="GetAllStockSoapIn">
    <part name="parameters" element="s0:GetAllStock" />
  </message>
  <message name="GetAllStockSoapOut">
    <part name="parameters" element="s0:GetAllStockResponse" />
  </message>
  <message name="GetVendorInfoSoapIn">
    <part name="parameters" element="s0:GetVendorInfo" />
  </message>
  <message name="GetVendorInfoSoapOut">
    <part name="parameters" element="s0:GetVendorInfoResponse" />
  </message>
  <message name="GetVendorListSoapIn">
    <part name="parameters" element="s0:GetVendorList" />
  </message>
  <message name="GetVendorListSoapOut">
    <part name="parameters" element="s0:GetVendorListResponse" />
  </message>
  <message name="GetProductGroupsSoapIn">
    <part name="parameters" element="s0:GetProductGroups" />
  </message>
  <message name="GetProductGroupsSoapOut">
    <part name="parameters" element="s0:GetProductGroupsResponse" />
  </message>
  <message name="AddSoapIn">
    <part name="parameters" element="s0:Add" />
  </message>
  <message name="AddSoapOut">
    <part name="parameters" element="s0:AddResponse" />
  </message>
  <message name="GetAllStockHttpGetIn" />
  <message name="GetAllStockHttpGetOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="GetVendorInfoHttpGetIn">
    <part name="GamintojoKodas" type="s:string" />
  </message>
  <message name="GetVendorInfoHttpGetOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="GetVendorListHttpGetIn" />
  <message name="GetVendorListHttpGetOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="GetProductGroupsHttpGetIn" />
  <message name="GetProductGroupsHttpGetOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="AddHttpGetIn">
    <part name="a" type="s:string" />
    <part name="b" type="s:string" />
  </message>
  <message name="AddHttpGetOut">
    <part name="Body" element="s0:int" />
  </message>
  <message name="GetAllStockHttpPostIn" />
  <message name="GetAllStockHttpPostOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="GetVendorInfoHttpPostIn">
    <part name="GamintojoKodas" type="s:string" />
  </message>
  <message name="GetVendorInfoHttpPostOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="GetVendorListHttpPostIn" />
  <message name="GetVendorListHttpPostOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="GetProductGroupsHttpPostIn" />
  <message name="GetProductGroupsHttpPostOut">
    <part name="Body" element="s0:DataSet" />
  </message>
  <message name="AddHttpPostIn">
    <part name="a" type="s:string" />
    <part name="b" type="s:string" />
  </message>
  <message name="AddHttpPostOut">
    <part name="Body" element="s0:int" />
  </message>
  <portType name="ProductFunctionsSoap">
    <operation name="GetAllStock">
      <input message="s0:GetAllStockSoapIn" />
      <output message="s0:GetAllStockSoapOut" />
    </operation>
    <operation name="GetVendorInfo">
      <input message="s0:GetVendorInfoSoapIn" />
      <output message="s0:GetVendorInfoSoapOut" />
    </operation>
    <operation name="GetVendorList">
      <input message="s0:GetVendorListSoapIn" />
      <output message="s0:GetVendorListSoapOut" />
    </operation>
    <operation name="GetProductGroups">
      <input message="s0:GetProductGroupsSoapIn" />
      <output message="s0:GetProductGroupsSoapOut" />
    </operation>
    <operation name="Add">
      <input message="s0:AddSoapIn" />
      <output message="s0:AddSoapOut" />
    </operation>
  </portType>
  <portType name="ProductFunctionsHttpGet">
    <operation name="GetAllStock">
      <input message="s0:GetAllStockHttpGetIn" />
      <output message="s0:GetAllStockHttpGetOut" />
    </operation>
    <operation name="GetVendorInfo">
      <input message="s0:GetVendorInfoHttpGetIn" />
      <output message="s0:GetVendorInfoHttpGetOut" />
    </operation>
    <operation name="GetVendorList">
      <input message="s0:GetVendorListHttpGetIn" />
      <output message="s0:GetVendorListHttpGetOut" />
    </operation>
    <operation name="GetProductGroups">
      <input message="s0:GetProductGroupsHttpGetIn" />
      <output message="s0:GetProductGroupsHttpGetOut" />
    </operation>
    <operation name="Add">
      <input message="s0:AddHttpGetIn" />
      <output message="s0:AddHttpGetOut" />
    </operation>
  </portType>
  <portType name="ProductFunctionsHttpPost">
    <operation name="GetAllStock">
      <input message="s0:GetAllStockHttpPostIn" />
      <output message="s0:GetAllStockHttpPostOut" />
    </operation>
    <operation name="GetVendorInfo">
      <input message="s0:GetVendorInfoHttpPostIn" />
      <output message="s0:GetVendorInfoHttpPostOut" />
    </operation>
    <operation name="GetVendorList">
      <input message="s0:GetVendorListHttpPostIn" />
      <output message="s0:GetVendorListHttpPostOut" />
    </operation>
    <operation name="GetProductGroups">
      <input message="s0:GetProductGroupsHttpPostIn" />
      <output message="s0:GetProductGroupsHttpPostOut" />
    </operation>
    <operation name="Add">
      <input message="s0:AddHttpPostIn" />
      <output message="s0:AddHttpPostOut" />
    </operation>
  </portType>
  <binding name="ProductFunctionsSoap" type="s0:ProductFunctionsSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
    <operation name="GetAllStock">
      <soap:operation soapAction="https://zzz/GetAllStock"
style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetVendorInfo">
      <soap:operation soapAction="https://zzz/GetVendorInfo"
style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetVendorList">
      <soap:operation soapAction="https://zzz/GetVendorList"
style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="GetProductGroups">
      <soap:operation soapAction="https://zzz/GetProductGroups"
style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
    <operation name="Add">
      <soap:operation soapAction="https://zzz/Add" style="document" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>
  <binding name="ProductFunctionsHttpGet"
type="s0:ProductFunctionsHttpGet">
    <http:binding verb="GET" />
    <operation name="GetAllStock">
      <http:operation location="/GetAllStock" />
      <input>
        <http:urlEncoded />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="GetVendorInfo">
      <http:operation location="/GetVendorInfo" />
      <input>
        <http:urlEncoded />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="GetVendorList">
      <http:operation location="/GetVendorList" />
      <input>
        <http:urlEncoded />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="GetProductGroups">
      <http:operation location="/GetProductGroups" />
      <input>
        <http:urlEncoded />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="Add">
      <http:operation location="/Add" />
      <input>
        <http:urlEncoded />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
  </binding>
  <binding name="ProductFunctionsHttpPost"
type="s0:ProductFunctionsHttpPost">
    <http:binding verb="POST" />
    <operation name="GetAllStock">
      <http:operation location="/GetAllStock" />
      <input>
        <mime:content type="application/x-www-form-urlencoded" />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="GetVendorInfo">
      <http:operation location="/GetVendorInfo" />
      <input>
        <mime:content type="application/x-www-form-urlencoded" />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="GetVendorList">
      <http:operation location="/GetVendorList" />
      <input>
        <mime:content type="application/x-www-form-urlencoded" />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="GetProductGroups">
      <http:operation location="/GetProductGroups" />
      <input>
        <mime:content type="application/x-www-form-urlencoded" />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
    <operation name="Add">
      <http:operation location="/Add" />
      <input>
        <mime:content type="application/x-www-form-urlencoded" />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
  </binding>
  <service name="ProductFunctions">
    <port name="ProductFunctionsSoap" binding="s0:ProductFunctionsSoap">
      <soap:address location="https://zzz/XML/product.asmx" />
    </port>
    <port name="ProductFunctionsHttpGet"
binding="s0:ProductFunctionsHttpGet">
      <http:address location="https://zzz/XML/product.asmx" />
    </port>
    <port name="ProductFunctionsHttpPost"
binding="s0:ProductFunctionsHttpPost">
      <http:address location="https://zzz/XML/product.asmx" />
    </port>
  </service>
</definitions>

···

--
Posted via http://www.ruby-forum.com/.

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?

···

--
Posted via http://www.ruby-forum.com/.

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