And you're returning a lot later:

```
elsif fault
   vprint_error("#{rhost}:#{rport} - Error code: #{faultcode}")

```

It has no sense, if you detected and error and you need to abort, return here, don't continue trying to process data and doing things on an unexpected response.