On Tue, 8 Mar 2005 08:55:00 -0500, Tim Henrion
<timh-7c/JGCs/Fzl54TAoqtyWWQ@public.gmane.org>
wrote:> When testing some failure cases, I noticed that SOAP
> Faults returned by ActionWebService aren''t schema valid
> to the SOAP 1.1 schema, specifically:
>
> > <faultcode
xsi:type="xsd:string">Server</faultcode>
>
> SOAP 1.1 section 4.4 says that env:Fault/faultcode
> "MUST be a qualified name" and gives some recommended
> values (i.e xsd:QName). I''d like to fix these issues
> but I''m new to Rails, although I''ve been fiddling with
> Ruby for quite some time. I''m not sure whether this is
> an issue with ActionWebService or SOAP4R. If someone
> could point me in the general direction of where Rails
> generates SOAP faults, I''d appreciate it.
Hi Tim,
ActionWebService doesn''t do anything particularly special when it
generates the SOAP faults, unless I''m missing something.
Thanks for spotting this, but I''m not sure whether this is going to be
easy to do. Also not sure whether SOAP4R in 1.8.2 final supports SOAP
1.1, although the newest versions do.
Regardless, this is the file doing the marshaling (converting from
Ruby objects to SOAP objects), see the #marshal method.
lib/action_web_service/vendor/ws/marshaling/soap_marshaling.rb
This is the code that converts Ruby exceptions:
soap_obj = SOAP::SOAPFault.new(
SOAP::SOAPString.new(''Server''),
SOAP::SOAPString.new(param.value.to_s),
SOAP::SOAPString.new(self.class.name),
SOAP::Mapping.obj2soap(detail))
Your problem could probably be fixed by pulling
SOAP::SOAPString.new("Server") in the out into a variable, and
assigning an XSD::QName instance to the element, that should cause
SOAP4R to qualify it.
Do you think you could test that for me? I.e.
fault_code = SOAP::SOAPString.new("Server")
fault_code.elename.name = "myName"
And then use fault_code in the SOAPFault constructor.
Regards
Leon