shotgunsoftware / cplusplus-api

C++ implementation of the Shotgun API
Other
10 stars 4 forks source link

HTTP error #403 with simplest test #1

Open spinos opened 10 years ago

spinos commented 10 years ago

Hi All, I am trying to run a simplest test of C++ API like this:

SG::Dict auth;
auth.add("script_name", "ClientApi").add("script_key", "<undisclosed>");
SG::Dict findMap;
findMap.add("filters", SG::Dict("logical_operator", "and")
                           .add("conditions", SG::List()));
findMap.add("return_only", "retired");
SG::Dict paging("current_page", 1);
paging.add("entities_per_page", 1);
findMap.add("paging", paging);

xmlrpc_c::paramList params;
params.add(toXmlrpcValue(auth));
params.add(toXmlrpcValue(findMap));

std::clog<<"param size "<<params.size()<<"\n";
for(int i = 0; i < params.size(); i++)
    std::clog<<" param["<<i<<"] = '"<<params.getStruct(i)<<"'\n";

cout<<"rpc test\n";
xmlrpc_c::clientXmlTransport_wininet transport;
xmlrpc_c::client_xml client = xmlrpc_c::client_xml(&transport);
xmlrpc_c::carriageParm_wininet0 myCarriageParm("http://<undisclosed>");
xmlrpc_c::rpcPtr myRpcP("read", params);
cout<<"rpc call\n";
try {   
myRpcP->call(&client, &myCarriageParm);
  } catch (exception const& e) {
      cerr << "Client threw error: " << e.what() << endl;
} catch (...) {
cerr << "Client threw unexpected error." << endl;
}    

RPC->call() always encounter error

Client threw error: Unable to transport XML to server and get XML response back. HTTP error #403 occurred.

I am sure there is a Shotgun site up-and-running, and there is no issue access server via Python API. So what could go wrong?

zhang

spinos commented 10 years ago

Site URL should be http://whatever/api3