You need to sign in to do that
Don't have an account?
need help with soap api C++ / gsoap
i am trying to send a create request to salesforce
here's my code so far.
_ns1__create* create = new _ns1__create();
_ns1__createResponse* createResponse = new _ns1__createResponse();
create->__sizesObjects = 1;
ns2__sObject** objList = new ns2__sObject*[create->__sizesObjects];
ns2__sObject* obj = new ns2__sObject();
obj->type = "Account";
obj->__sizefieldsToNull = 1;
obj->fieldsToNull = new char*[1];
obj->fieldsToNull[0] = "Name";
if (conn->__ns1__create(create, createResponse) == SOAP_OK)
{
cout << "success";
}
else
{
cout << "fail";
}
This gave me a "success" output, but it did nothing. when I debugged it. it says on the createResponse object "Required fields are missing: [Name]"
but if change this line of code : obj->fieldsToNull[0] = "Name";
to : obj->fieldsToNull[0] = "Invalid Stuff";
then it outputed a "fail"
for those who developed this in C++. How do you guys send the create request. How do you build the sObject?
Any help / indicator would be greatly appreciated. I have been failing the past day, and I am desperate.
Thank you in advance:)
Nvm,
I found the answer myself.
here is an example of how you create sObject using C++ / gsoap
ns2__sObject* obj = new ns2__sObject();
obj->type = "Account";
obj->__size = 2;
obj->__any = new char*[2];
obj->__any[0] = "<Name>IT WORKS!!</Name>";
obj->__any[1] = "<Phone>4084084088</Phone>";
Hope this helps