//////////////////////////////////////////////// // FaultResponse //////////////////////////////////////////////// public void setFaultResponse(int errCode, String errDescr) { setStatusCode(HTTPStatus.INTERNAL_SERVER_ERROR); Node bodyNode = getBodyNode(); Node faultNode = createFaultResponseNode(errCode, errDescr); bodyNode.addNode(faultNode); Node envNode = getEnvelopeNode(); setContent(envNode); }
//////////////////////////////////////////////// // createFaultResponseNode //////////////////////////////////////////////// private Node createFaultResponseNode(int errCode, String errDescr) { // <s:Fault> Node faultNode = new Node(SOAP.XMLNS + SOAP.DELIM + SOAP.FAULT); // <faultcode>s:Client</faultcode> Node faultCodeNode = new Node(SOAP.FAULT_CODE); faultCodeNode.setValue(SOAP.XMLNS + SOAP.DELIM + FAULT_CODE); faultNode.addNode(faultCodeNode); // <faultstring>UPnPError</faultstring> Node faultStringNode = new Node(SOAP.FAULT_STRING); faultStringNode.setValue(FAULT_STRING); faultNode.addNode(faultStringNode); // <detail> Node detailNode = new Node(SOAP.DETAIL); faultNode.addNode(detailNode); // <UPnPError xmlns="urn:schemas-upnp-org:control-1-0"> Node upnpErrorNode = new Node(FAULT_STRING); upnpErrorNode.setAttribute("xmlns", Control.XMLNS); detailNode.addNode(upnpErrorNode); // <errorCode>error code</errorCode> Node errorCodeNode = new Node(SOAP.ERROR_CODE); errorCodeNode.setValue(errCode); upnpErrorNode.addNode(errorCodeNode); // <errorDescription>error string</errorDescription> Node errorDesctiprionNode = new Node(SOAP.ERROR_DESCRIPTION); errorDesctiprionNode.setValue(errDescr); upnpErrorNode.addNode(errorDesctiprionNode); return faultNode; }