示例#1
0
/* input: an XMLRPC_VALUE representing a fault struct in xml-rpc style.
 * output: an XMLRPC_VALUE representing a fault struct in soap style,
 *  with xmlrpc codes mapped to soap codes, and all other values preserved.
 *  note that the returned value is a completely new value, and must be freed.
 *  the input value is untouched.
 */
static XMLRPC_VALUE gen_fault_xmlrpc(XMLRPC_VALUE node, xml_element* el_target) {
	XMLRPC_VALUE xDup = XMLRPC_DupValueNew(node);
	XMLRPC_VALUE xCode = XMLRPC_VectorGetValueWithID(xDup, TOKEN_XMLRPC_FAULTCODE);
	XMLRPC_VALUE xStr = XMLRPC_VectorGetValueWithID(xDup, TOKEN_XMLRPC_FAULTSTRING);

	XMLRPC_SetValueID(xCode, TOKEN_SOAP_FAULTCODE, 0);
	XMLRPC_SetValueID(xStr, TOKEN_SOAP_FAULTSTRING, 0);

	/* rough mapping of xmlrpc fault codes to soap codes */
	switch (XMLRPC_GetValueInt(xCode)) {
	case -32700:		  /* "parse error. not well formed", */
	case -32701:		  /* "parse error. unsupported encoding" */
	case -32702:		  /* "parse error. invalid character for encoding" */
	case -32600:		  /* "server error. invalid xml-rpc.  not conforming to spec." */
	case -32601:		  /* "server error. requested method not found" */
	case -32602:		  /* "server error. invalid method parameters" */
		XMLRPC_SetValueString(xCode, "SOAP-ENV:Client", 0);
		break;
	case -32603:		  /* "server error. internal xml-rpc error" */
	case -32500:		  /* "application error" */
	case -32400:		  /* "system error" */
	case -32300:		  /* "transport error */
		XMLRPC_SetValueString(xCode, "SOAP-ENV:Server", 0);
		break;
	}
	return xDup;
}
void LLXMLRPCValue::append(const char* id, LLXMLRPCValue& v)
{
	XMLRPC_SetValueID(v.mV, id, 0);
	XMLRPC_AddValueToVector(mV, v.mV);
}