Discussion:
XML-RPC
(too old to reply)
WaZZu
2008-06-19 09:49:53 UTC
Permalink
Hello,

I'm trying to create a C++ class from nsIXmlRpcClient under win32,
using MSVC and getting following compilation error:
[...]\xml-rpc\nsIXmlRpcClient.h(158): error C2528: 'uuid' : pointer to
reference is illegal
and
line 158: NS_IMETHOD CreateType(PRUint32 type, nsIID & *uuid, void *
*result) = 0;

I was wondering if anybody has experienced this problem before, or is
it just my compiler can't handle this code.
Any help is appreciated.
Thanks.

-wz.
WaZZu
2008-06-19 14:29:05 UTC
Permalink
OK, I've tried to call Mozilla XML-RPC scriptable from C++ source.
When I do AsynCall, my return result is
NS_E_SET_DISK_UID_FAILED(0x80570021).

Could somebody point me out, if I'm doing anything wrong?
Thanks.

Here is the source code I used:

////////////////////////////////////////////////////////////////////////////
// XML-RPC Client Listener implementation
////////////////////////////////////////////////////////////////////////////
class CXMLRPCListener : public nsIXmlRpcClientListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIXMLRPCCLIENTLISTENER
CXMLRPCListener(){}
};

NS_IMPL_ISUPPORTS1(CXMLRPCListener, nsIXmlRpcClientListener)

NS_IMETHODIMP CXMLRPCListener::OnResult(nsIXmlRpcClient *client,
nsISupports *ctxt, nsISupports *result)
{
nsresult rv;
nsCOMPtr<nsISupportsPrimitive> resSup(do_QueryInterface(result));
nsCOMPtr<nsISupportsCString> p(do_QueryInterface(resSup));
nsCAutoString data;
p->GetData(data);


return NS_OK;
}

NS_IMETHODIMP CXMLRPCListener::OnError(nsIXmlRpcClient *client,
nsISupports *ctxt, nsresult status, const PRUnichar *errorMsg)
{
return NS_OK;
}

NS_IMETHODIMP CXMLRPCListener::OnFault(nsIXmlRpcClient *client,
nsISupports *ctxt, nsIXmlRpcFault *fault)
{
return NS_OK;
}

//////////////////////////////////////////////////////////////////////
// Actual XML-RPC Client call in C++
/////////////////////////////////////////////////////////////////////
nsresult rvRpc;
nsCOMPtr<nsIXmlRpcClient> xmlRpc = do_CreateInstance("@mozilla.org/xml-
rpc/client;1", &rvRpc);
xmlRpc->Init("http://betty.userland.com/RPC2");
nsCOMPtr<nsISupportsPRInt32> element = do_CreateInstance("@mozilla.org/
supports-PRInt32;1", &rvRpc);

element->SetData(47);
nsCOMPtr<nsISupportsArray> ary;
NS_NewISupportsArray(getter_AddRefs(ary));
ary->AppendElement(element);

CXMLRPCListener *listener = new CXMLRPCListener;
rvRpc = xmlRpc->AsyncCall(listener, nsnull, "examples.getStateName",
getter_AddRefs(ary), 1);

//////////////////////////////////////////////////////////////

Loading...