Throwing exception in wsdl2ruby SOAP :: FaultError detail attribute

I used wsdl2ruby to create a client for a web service. When a service method raises one of the exceptions defined in the WSDL, I would like to access the attributes of the exception object. From what I can tell, the exception object has been reconfigured to SOAP :: Mapping :: Object referenced by the detail attribute of the SOAP :: FaultError object that was available for the RESCUE block.

Although SOAP :: Mapping :: Object responds to the marshal_load method, this method takes a single dumpobj parameter, which makes me think that I should provide this object as a method parameter, rather than use that object as a method receiver.

Can anyone point me to an example of the correct way to demonstrate an exception object?

+1


a source to share


1 answer


it looks like unmarshalling is already done if you examine SOAP :: Mapping :: Object ...



rescue SOAP::FaultError => ee
  ## InvalidLogin, InvalidLocale, NoPermission, RuntimeFault
  ## ee.detail.__xmlele[0][0] is an XSD::QName object, with accessors name and namespace
  ## ee.detail.__xmlele[0][1] is a VMware::VIM25::xxx fault object
  vim_fault = ee.detail.__xmlele[0][1]
  case vim_fault.class
  when VMware::VIM25::InvalidLogin
  when VMware::VIM25::InvalidLocale
  when VMware::VIM25::NoPermission
  when VMware::VIM25::RuntimeFault

      

+1


a source







All Articles