protected void writeFaultElement( Document d, Element bodyElement, ActionInvocation actionInvocation) { Element faultElement = d.createElementNS(Constants.SOAP_NS_ENVELOPE, "s:Fault"); bodyElement.appendChild(faultElement); // This stuff is really completely arbitrary nonsense... let's hope they fired the guy who // decided this XMLUtil.appendNewElement(d, faultElement, "faultcode", "s:Client"); XMLUtil.appendNewElement(d, faultElement, "faultstring", "UPnPError"); Element detailElement = d.createElement("detail"); faultElement.appendChild(detailElement); Element upnpErrorElement = d.createElementNS(Constants.NS_UPNP_CONTROL_10, "UPnPError"); detailElement.appendChild(upnpErrorElement); int errorCode = actionInvocation.getFailure().getErrorCode(); String errorDescription = actionInvocation.getFailure().getMessage(); log.fine("Writing fault element: " + errorCode + " - " + errorDescription); XMLUtil.appendNewElement(d, upnpErrorElement, "errorCode", Integer.toString(errorCode)); XMLUtil.appendNewElement(d, upnpErrorElement, "errorDescription", errorDescription); }
protected void writeActionOutputArguments( Document d, Element actionResponseElement, ActionInvocation actionInvocation) { for (ActionArgument argument : actionInvocation.getAction().getOutputArguments()) { log.fine("Writing action output argument: " + argument.getName()); String value = actionInvocation.getOutput(argument) != null ? actionInvocation.getOutput(argument).toString() : ""; XMLUtil.appendNewElement(d, actionResponseElement, argument.getName(), value); } }