如何让gsoap从wsdl生成具有复杂结构的纯c代码而不将它们更改为char *?

时间:2012-01-10 19:37:28

标签: c wsdl code-generation gsoap

我有一个复杂类型的wsdl-shema:

<complexType name="stringArray">
  <sequence>
    <element name="strings" type="xsd:string" minOccurs="0" 
             maxOccurs="unbounded"/>
  </sequence>
</complexType>

此复杂类型用于消息:

<message name="insertResponse">
    <part name="err" type="xsd:int"/>
    <part name="title" type="xsd:string"/>
    <part name="text" type="xsd:string"/>
    <part name="date" type="xsd:dateTime"/>
    <part name="authors" type="stringArray"/>
    <part name="topics" type="intArray"/>
</message>

当我使用wsdl2h生成头文件时,我得到:

struct ns2__insertResponse
{
    int                                 err;
    char*                               title;
    char*                               text;
    time_t                              date;
    wsdl__stringArray                   authors;
    wsdl__intArray                      topics;
};

但是当我尝试用soapcpp2生成代码时,我在soapStub.h中得到以下内容:

struct ns2__insertResponse
{
    int err;        /* SOAP 1.2 RPC return element (when namespace qualified)     */    /* required element of type xsd:int */
    char *title;    /* optional element of type xsd:string */
    char *text;     /* optional element of type xsd:string */
    time_t date;    /* required element of type xsd:dateTime */
    char *authors;  /* optional element of type wsdl:stringArray */
    char *topics;   /* optional element of type wsdl:intArray */
};

为什么它将wsdl__stringArray更改为char *以及如何使其保留propriate结构?

0 个答案:

没有答案