gSOAP 动态数组作为输入参数

gSOAP dynamic array as input parameter

我使用 gSOAP 工具包生成 soap 服务和客户端,它应该发送一个 int 数组,该数组按照 gSOAP 文档中的建议放入结构中:

//myservice.h

struct abc {
    int __size;
    int *__myptr;
};

int ns__SetConfiguration(struct abc as, int* result);

以下是我生成代码的方式:

soapcpp2 -i -SC myservice.h

然后我从客户端调用服务:

int result;
int *aa = (int*)soap_malloc(&service, 10*sizeof(int));
abc myabc;

myabc.__myptr = aa;
myabc.__size = 10;

service.setConfiguration(myabc, &result);

然而,在服务端,size 变为 ZERO。 我错过了什么?

谢谢。

打错了。

结构应该这样定义:

struct abc {
int *__ptr;
int __size;

};