private String getResourceId ( String response , String resourceResponseAction , String resourceIdXpath , String resourceIdExceptionMessage ) throws ParserConfigurationException , SAXException , XPathExpressionException , IOException { if ( WSManUtils . isSpecificResponseAction ( response , resourceResponseAction ) ) { String shellId = XMLUtils . parseXml ( response , resourceIdXpath ) ; if ( StringUtils . isNotBlank ( shellId ) ) { return shellId ; } else { throw new RuntimeException ( resourceIdExceptionMessage ) ; } } else if ( WSManUtils . isFaultResponse ( response ) ) { throw new RuntimeException ( WSManUtils . getResponseFault ( response ) ) ; } else { throw new RuntimeException ( UNEXPECTED_SERVICE_RESPONSE + response ) ; } }
This method retrieves the resource id from the create resource request response and throws the appropriate exceptions in case of failure .