From: Dan Fitzpatrick Date: 2006-03-15T07:33:50+09:00 Subject: [SOAP] Setting the namespace of an object I posted this to the soap mailing list but have not received any input. Hopefully someone here knows the answer. I am wondering how to change the namespace (xmlns) on the SetResponse element from "http://www.ruby-lang.org/xmlns/ruby/type/custom" to a different namespace using soap4r. The following code produces the soap message below. require 'soap/mapping' require 'soap/processor' class SetResult attr_accessor :timestamp attr_accessor :errorCode attr_accessor :message attr_accessor :id attr_accessor :version end class SetResponse attr_accessor :SetResult end response_object = SetResponse.new result = SetResult.new result.id = 1 result.version = 2 result.errorCode = 0 result.message = 'Update Successful' result.timestamp = Time.new.strftime('%Y-%m-%dT%H:%M:%S') response_object.SetResult = result soap_header = SOAP::SOAPHeader.new elename = SOAP::Mapping.name2elename('SetResponse') mapping_registry = SOAP::Mapping::Registry.new(:allow_original_mapping => false) soap_obj = SOAP::Mapping.obj2soap(response_object, mapping_registry) body = SOAP::SOAPBody.new body.add(elename, soap_obj) soap = SOAP::SOAPEnvelope.new(soap_header, body) puts SOAP::Processor.marshal(soap, {}, nil) Returns: 2006-03-09T02:25:56 1 2 Update Successful 0 I need to change: