VC6.0下调用C#编写的WebService存在的问题?

userxk 2005-01-09 12:59:41
今用C#编写了一个最简单的WebService方法调用:
[WebMethod]
public string HelloWorld(string name)
{
return name;
}

现在VC6.0下采用SOAP Toolkit 3.0调用此接口:
void CSoapDlg::GetReturnVal()
{
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
// Connect to the service.
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->Property["EndPointURL"]= "http://192.168.1.8/MyService/ServiceList.asmx";
Connector->Connect();

// Begin the message.
Connector->Property[_T("SoapAction")] = _T("http://192.168.1.8/MyService/ServiceList.asmx/HelloWorld");
Connector->BeginMessage();

// Create the SoapSerializer object.
Serializer.CreateInstance(__uuidof(SoapSerializer30));

// Connect the serializer object to the input stream of the connector object.
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));

// Build the SOAP Message.

Serializer->StartEnvelope(_T("HelloWorld"),_T(""),_T(""));
Serializer->StartBody("");
Serializer->StartElement(_T("HelloWorld"),_T("http://192.168.1.8/MyService/ServiceList.asmx/"),
_T(""),_T(""));
Serializer->StartElement("name","","","");
Serializer->WriteString("张");
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();

// Send the message to the XML Web service.
Connector->EndMessage();

// Read the response.
Reader.CreateInstance(__uuidof(SoapReader30));

// Connect the reader to the output stream of the connector object.
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");

MessageBox((const char*)Reader->RpcResult->text);
}
可就是无法得到WebService的返回值,MessageBox里显示的是“soap:Client”的提示信息。


...全文
256 点赞 收藏 11
写回复
11 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
haoco 2005-02-03
up
回复
userxk 2005-01-25
赶快“友情UP”呀!!!
回复
huangsuipeng 2005-01-19
JF
回复
心情解码 2005-01-19
up



-- :0
回复
userxk 2005-01-18
up也可能有分。
回复
Tomgus 2005-01-15
那就恭喜楼主
再接点分:)
回复
robin0925 2005-01-15
恭喜恭喜
楼主真牛。。。。。
回复
userxk 2005-01-12
哈哈!自己搞定了。
返回值和返回XML解析文本都一起解决了。
回复
liulxmooo 2005-01-11
up
回复
LoveCherry 2005-01-09
up给分吗
回复
userxk 2005-01-09
CSDN的各位MVP们能不能帮忙看看?
回复
发帖
Web Services
创建于2007-09-28

1.2w+

社区成员

.NET技术 Web Services
申请成为版主
帖子事件
创建了帖子
2005-01-09 12:59
社区公告
暂无公告