REST SDK,如何从这个wsdl中获得正确的结果?

时间:2014-12-01 05:43:39

标签: c++ rest sdk wsdl

wsdl文件位于此页面中:

http://202.102.95.130:9999/epeisong-ws/AccountService?wsdl

我想打电话给"登录"函数,对应的wsdl是:

-<xs:complexType name="login">    
-<xs:sequence><xs:element name="userName" type="xs:string" minOccurs="0"/>    
<xs:element name="password" type="xs:string" minOccurs="0"/>    
<xs:element name="logSourceType" type="xs:int" minOccurs="0"/>
</xs:sequence>    
</xs:complexType>-<xs:complexType name="loginResponse">    
-<xs:sequence>
<xs:element name="returnwalletID" type="xs:int"/></xs:sequence></xs:complexType>

这是c ++代码:

int main(int argc, char* argv[])
{
    std::wcout << L"Calling HTTPGetAsync..." << std::endl;
    HTTPGetAsync().wait();
}`

  `pplx::task<void> HTTPGetAsync()
{
    http_client client(U("http://202.102.95.130:9999/epeisong-ws/AccountService?wsdl/"));
    utility::string_t functionname = U("login");
    utility::string_t userName = U("test1");
    utility::string_t password = U("1234567");
    utility::string_t logSourceType = U("1");`  

    utility::string_t accounturl = functionname + U("/") + userName + U("/") + password + U("/") + logSourceType + U("/");
    uri_builder builder(accounturl);

    return client.request(methods::GET, builder.to_string()).then([](http_response response)
    {
        std::wostringstream stream;
        stream << L"Server returned status code " << response.status_code() << L'.' << std::endl;
        std::wcout << stream.str();

        stream.str(std::wstring());
        stream << L"Content type: " << response.headers().content_type() << std::endl;
        stream << L"Content length: " << response.headers().content_length() << L"bytes" << std::endl;
        std::wcout << stream.str();
        auto bodyStream = response.body();
        streams::stringstreambuf sbuffer;
        auto& target = sbuffer.collection();

        bodyStream.read_to_end(sbuffer).get();
        stream.str(std::wstring());
        stream << L"Response body: " << target.c_str();
        std::wcout << stream.str();
        getchar();
    });
}

但它刚刚返回

中的总wsdl代码
http://202.102.95.130:9999/epeisong-ws/AccountService?wsdl

我希望得到&#34;登录&#34;有趣的回报价值,我该怎么办?

1 个答案:

答案 0 :(得分:0)

我并不完全熟悉请求的语法,但您的基本URL包含?wsdl后缀,可能在服务器端将其解释为对wsdl文档本身的请求。尝试从最初的http_client实例中删除该部分URL,看看是否进一步。