adedov / libiqxmlrpc

Libiqxmlrpc is an implementation of the XML-RPC standard in C++.
Other
14 stars 9 forks source link

Path variables to execute #2

Closed happyalexkg closed 8 years ago

happyalexkg commented 8 years ago

Hello I need to pass some arguments to .execute `#include

include <libiqxmlrpc/libiqxmlrpc.h>

include <libiqxmlrpc/http_client.h>

int main() { using namespace iqxmlrpc;

//Client client(iqnet::Inet_addr(3344)); Client client( iqnet::Inet_addr("176.126.167.203", 2633), "/RPC2" );

Param_list pl; pl.push_back(Struct()); pl[0].insert("var1","username:passsword"); pl[0].insert("var2",-1);

Response r = client.execute("one.user.info", pl); std::cout << r.value()["var1"].get_string() << std::endl; } `

but i;m getting error "terminate called after throwing an instance of 'iqxmlrpc::Exception' what(): Parameter that is supposed to be a string is not "

seems that RPC2 getting array. not a string :(

adedov commented 8 years ago

Hi!

Thank you for reporting!

Can you provide server code? I suppose that the problem can be not in /RPC2 but var2 to be int.

happyalexkg commented 8 years ago

Hello I have "ABYSS Web Server for XML-RPC For C/C++ version 1.40.0" as server for example: when i tried xmlrpc-c: I did: myClient.call(serverUrl, methodName, "si", &result, "username:password",-1);

As far as you can see - i'm can tell to procedure - type of value: s - string i - interger

for method one.user.info server expects: one value string and another is - int

It will be cool if it possible to tell your execute type of value :)

sorry for my english :)

adedov commented 8 years ago

Well, I think I see your issue. Those two examples you have provided are far from equivalent: 1) In iqxmlrpc version you call a method with one parameter - struct and put two fields in it: var1, var2 2) In xmlrpc-c version you call a method with two parameters - string and int.

If you want equivalent behaviour in iqxmlrpc, use following sample:

Param_list pl;
pl.push_back("username:password");
pl.push_back(-1);
Response r = client.execute("one.user.info", pl);
happyalexkg commented 8 years ago

Hm, ok i will try and will back to you :) thx

Thx thx one more question when request was successful server return me this: <USER><ID>0</ID><GID>0</GID><GROUPS><ID>0</ID></GROUPS><GNAME>oneadmin</GNAME><NAME>oneadmin</NAME><PASSWORD>asdasdasdsadasd</PASSWORD><AUTH_DRIVER>core</AUTH_DRIVER><ENABLED>1</ENABLED><LOGIN_TOKEN><TOKEN>asdasdasd</TOKEN><EXPIRATION_TIME>1465313107</EXPIRATION_TIME></LOGIN_TOKEN><TEMPLATE><SSH_PUBLIC_KEY><![CDATA[ssh-rsa key]></SSH_PUBLIC_KEY><TABLE_DEFAULT_PAGE_LENGTH><![CDATA[100]]></TABLE_DEFAULT_PAGE_LENGTH><TOKEN_PASSWORD><![CDATA[sdadasdas]]></TOKEN_PASSWORD></TEMPLATE><DATASTORE_QUOTA></DATASTORE_QUOTA><NETWORK_QUOTA></NETWORK_QUOTA><VM_QUOTA></VM_QUOTA><IMAGE_QUOTA></IMAGE_QUOTA><DEFAULT_USER_QUOTAS><DATASTORE_QUOTA></DATASTORE_QUOTA><NETWORK_QUOTA></NETWORK_QUOTA><VM_QUOTA></VM_QUOTA><IMAGE_QUOTA></IMAGE_QUOTA></DEFAULT_USER_QUOTAS></USER>

i tried std::cout << r.value().get_string() << std::endl; and getting iqxmlrpc::Value: incorrect type was requested.

can you please help ? thx

happyalexkg commented 8 years ago

forgot to menstion seems that server return array :)

adedov commented 8 years ago

May be following snippet would work: r.value().the_array()

Anyways, the dump from your response does not look like XML-RPC. Can you provide full HTTP response?

adedov commented 8 years ago

No reply from reporter.