Search code examples
c++linuxgsoap

gsoap linux c++ / struct failure delivery


char or int, return value is passed well.

But struct is passed to fail.

server:

soapcpp2 -2 -SLix ...

client:

wsdl2h -f -s -o ... ...
soapcpp2 -i -C ...

and

struct{
  char * value;
}USER_ITEM

server:

int Service::GetValue(struct USER_ITEM * item)
{
  item->value = new char[100];
  item->value = "example";
}

client:

....
ns2__useritemresponse user;
proxy.Getvalue(user)
user.user_item->value  // user.user_item address is null;
....

The windows are good. But not on Linux c++.

Are in the same format as above.

Do I need a separate set of options?

Please help if you suspect parts.

Sorry, I did not speak English well.

Thanks for reading.


Solution

  • You cannot copy a char pointer by using the assignment operator, this is not an std::string:

    item->value = new char[100];
    strcpy(item->value, "example");