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

Ticket #337 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

wsdl2ruby produces code that overrides system classes

Reported by: user Assigned to: nahi
Priority: high Milestone: 1.5.6
Component: xsd4r Version: 1.5
Keywords: Cc:

Description

I am trying to access web services for the Netsuite accounting system using soap4r. I ran into bug #302 and already submitted a patch to correct it; now I find that the ruby code generated using wsdl2ruby also modifies the class "File" because there is a complextype called File in the Netsuite wsdl.

Here is a patch that corrects this -- it just prepends C_ to constants that already exist when code is generated. I'm not totally sure this is the best possible approach, but it works for me.

diff -r -N -u soap4r-orig/lib/xsd/codegen/gensupport.rb soap4r-modified/lib/xsd/codegen/gensupport.rb
--- soap4r-orig/lib/xsd/codegen/gensupport.rb   2007-05-11 11:36:34.000000000 -0500
+++ soap4r-modified/lib/xsd/codegen/gensupport.rb       2007-05-11 11:34:49.000000000 -0500
@@ -69,7 +69,8 @@
     safename = name.scan(/[a-zA-Z0-9_]+/).collect { |ele|
       GenSupport.capitalize(ele)
     }.join
-    if /^[A-Z]/ !~ safename or keyword?(safename)
+    if /^[A-Z]/ !~ safename or keyword?(safename) or 
+        Module.constants.include?(safename)
       safename = "C_#{safename}"
     end
     safename

Change History

05/12/07 06:37:44 changed by nahi

  • component changed from soap4r to xsd4r.
  • milestone changed from undefined to 1.5.6.

05/13/07 22:38:06 changed by nahi

  • priority changed from normal to high.

05/13/07 23:47:29 changed by nahi

  • priority changed from high to normal.
  • milestone changed from 1.5.6 to undefined.

For now, please use --module_path to aviod name crash.

05/19/07 23:47:55 changed by nahi

  • priority changed from normal to high.
  • milestone changed from undefined to 1.5.6.

05/20/07 17:57:21 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

(In [1791]) * let safeconstname check default Module.constants. closes #337.