开发者

gSOAP does not return information from web service, but it returns only schema

开发者 https://www.devze.com 2023-03-13 03:22 出处:网络
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:

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>
                开发者_StackOverflow<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.


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消