void wsman_set_fault( WsmanMessage *msg, WsmanFaultCodeType fault_code, WsmanFaultDetailType fault_detail_code, const char *details) { if (!wsman_fault_occured(msg)) { msg->status.fault_code = fault_code; msg->status.fault_detail_code = fault_detail_code; if (details) msg->status.fault_msg = strdup(details); } return; }
static void dispatcher_create_fault(SoapH soap, WsmanMessage * msg, WsXmlDocH in_doc) { char *buf = NULL; int len; if (!soap) return; if (wsman_fault_occured(msg)) { wsman_generate_fault_buffer(in_doc, msg->charset, msg->status.fault_code, msg->status.fault_detail_code, msg->status.fault_msg, &buf, &len); u_buf_set(msg->response, buf, len); u_free(buf); msg->http_code = wsman_find_httpcode_for_fault_code( msg->status. fault_code); } return; }
void dispatch_inbound_call(SoapH soap, WsmanMessage * msg, void *opaqueData) { op_t *op = NULL; WsXmlDocH in_doc = wsman_build_inbound_envelope( msg); SoapDispatchH dispatch = NULL; debug("Inbound call..."); if (wsman_fault_occured(msg)) { error("document is null"); goto DONE; } dispatch = get_dispatch_entry(soap, in_doc); if (dispatch == NULL) { wsman_set_fault(msg, WSA_DESTINATION_UNREACHABLE, WSMAN_DETAIL_INVALID_RESOURCEURI, NULL); debug("dispatch == NULL"); goto DONE; } op = create_op_entry(soap, dispatch, msg); if (op == NULL) { wsman_set_fault(msg, WSA_DESTINATION_UNREACHABLE, WSMAN_DETAIL_INVALID_RESOURCEURI, NULL); destroy_dispatch_entry(dispatch); debug("dispatch == NULL"); goto DONE; } op->in_doc = in_doc; process_inbound_operation(op, msg, opaqueData); DONE: dispatcher_create_fault(soap, msg, in_doc); destroy_op_entry(op); ws_xml_destroy_doc(in_doc); debug("Inbound call completed"); return; }