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