gSOAP 不从 Web 服务返回信息,但仅返回架构

发布于 2024-11-15 13:00:51 字数 1295 浏览 2 评论 0原文

我正在尝试从 Microsoft Project Server Project Web 服务检索项目信息。

我使用 gSOAP 来实现客户端。我的代码如下所示:

if ( project.ReadProjectStatus(&read_project_status_message, &read_project_status_response) == SOAP_OK )
{
    ofstream project_info("C:\\PROJECTINFO.XML");   
    project_info << read_project_status_response.ReadProjectStatusResult->__any;
}

尽管项目服务器的响应如下所示:

<soap:Envelope ...>
    <soap:Body ...>
        <ReadProjectStatusResponse ...>
            <ReadProjectStatusResult>
                <xs:schema ...>
                ...
                </xs:schema ...>
                <diffgr:diffgram ...>
                    <ProjectDataSet ...>
                    ....
                    </ProjectDataSet>
                </diffgr:diffgram>
            </ReadProjectStatusResult>
        </ReadProjectStatusResponse>
    </soap:Body>
</soap:Envelope>                   

当我打开文件 PROJECTINFO.XML(其中写入了 read_project_status_response.ReadProjectStatusResult->__any )时,我只能看到该

<xs:schema ...>
    ...
</xs:schema> 

部分。没有任何关于项目的信息。

任何人都知道为什么会发生这种情况以及如何使用 gsoap 检索项目状态信息?

提前致谢。

I am trying to retrieve project information from Microsoft Project Server Project web service.

I use gSOAP to implement the client. Here is how my code looks like:

if ( project.ReadProjectStatus(&read_project_status_message, &read_project_status_response) == SOAP_OK )
{
    ofstream project_info("C:\\PROJECTINFO.XML");   
    project_info << read_project_status_response.ReadProjectStatusResult->__any;
}

Although the response from project server looks like:

<soap:Envelope ...>
    <soap:Body ...>
        <ReadProjectStatusResponse ...>
            <ReadProjectStatusResult>
                <xs:schema ...>
                ...
                </xs:schema ...>
                <diffgr:diffgram ...>
                    <ProjectDataSet ...>
                    ....
                    </ProjectDataSet>
                </diffgr:diffgram>
            </ReadProjectStatusResult>
        </ReadProjectStatusResponse>
    </soap:Body>
</soap:Envelope>                   

when I open the file PROJECTINFO.XML (in which read_project_status_response.ReadProjectStatusResult->__any is written), I can see only the

<xs:schema ...>
    ...
</xs:schema> 

part. Nothing about the project information.

Anyone knows why this happens and how I can retrieve project status info using gsoap?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

街道布景 2024-11-22 13:00:51

太少太晚了,但是这里...

项目服务器提供的 wsdl 不完整。看起来像这样。

  <s:element name="ReadProjectStatusResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="ReadProjectStatusResult">
          <s:complexType>
            <s:sequence>
              <s:any namespace="http://schemas.microsoft.com/office/project/server/webservices/ProjectDataSet/" />
            </s:sequence>
          </s:complexType>
        </s:element>
      </s:sequence>
    </s:complexType>
  </s:element>

将其更改为以下内容(注意 s:any 之前的额外 s:element)并使用 gsoap 重新编译。现在 gsoap 将创建 2 个成员变量(xsd__schema 和 __any)。 xsd__schema 将包含架构,__any 将携带正确的数据。

  <s:element name="ReadProjectStatusResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="ReadProjectStatusResult">
          <s:complexType>
            <s:sequence>
              <s:element ref="s:schema"/>
              <s:any namespace="http://schemas.microsoft.com/office/project/server/webservices/ProjectDataSet/" />
            </s:sequence>
          </s:complexType>
        </s:element>
      </s:sequence>
    </s:complexType>
  </s:element>

Too little too late, but here goes...

the wsdl provided by the project server is incomplete. It looks like this.

  <s:element name="ReadProjectStatusResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="ReadProjectStatusResult">
          <s:complexType>
            <s:sequence>
              <s:any namespace="http://schemas.microsoft.com/office/project/server/webservices/ProjectDataSet/" />
            </s:sequence>
          </s:complexType>
        </s:element>
      </s:sequence>
    </s:complexType>
  </s:element>

Change it to the following (note the extra s:element before s:any) and recompile using gsoap. Now gsoap will create 2 member variables (xsd__schema and __any). xsd__schema will contain the schema and __any will carry the right data.

  <s:element name="ReadProjectStatusResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="ReadProjectStatusResult">
          <s:complexType>
            <s:sequence>
              <s:element ref="s:schema"/>
              <s:any namespace="http://schemas.microsoft.com/office/project/server/webservices/ProjectDataSet/" />
            </s:sequence>
          </s:complexType>
        </s:element>
      </s:sequence>
    </s:complexType>
  </s:element>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文