【发布时间】:2014-12-01 05:43:38
【问题描述】:
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
我想获取“登录”乐趣的返回值,我该怎么办?
【问题讨论】:
-
请去掉“REST”标签——这与 REST 无关。