使用带有查询参数的 gSoap 进行 Web 服务查询
我正在尝试将为 C# 编写的soap 查询转换为Visual C++ 中的gSoap 查询。
C# 查询将 XML 节点添加到查询调用中,以便将参数传递给查询:
XmlNode queryOpts = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
queryOpts.InnerXml = "<DateInUtc>TRUE</DateInUtc>";
这是 C# 查询,传递各种参数(某些参数被指定为 XmlNode 对象)
XmlNode nodeListItems = listService.GetListItems("Announcements", null, query, viewFields, null, queryOpts, null);
C++ / gSoap 查询允许我传递查询和响应对象:
listService.__ns10__GetListItems(&announcementQuery, &announcementResponse)
查询对象具有可以设置的与 C# 调用中的参数相关的各种属性:
announcementQuery.listName
announcementQuery.query
announcementQuery.queryOptions
announcementQuery.viewFields
第一个参数是一个字符串,没问题。
query、queryOptions 和 viewFields 有点令人困惑。
“query”是_ns2__GetListItems_query类型的类,它具有以下功能&成员:
soap_default()
soap_get()
soap_in()
soap_out()
soap_put()
soap_serialize()
soap_type()
__any
__mixed
对于查询、queryOptions 和 viewFields,我只想指定一个 xml 格式的字符串,就像 C# 代码所做的那样,但我不确定这是如何完成的。
有人可以就此提供一些经验吗?
谢谢!
I'm attempting to convert a soap query written for C# into a gSoap query in Visual C++.
The C# query adds an XML node's to the query call, in order to pass parameters to the query:
XmlNode queryOpts = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
queryOpts.InnerXml = "<DateInUtc>TRUE</DateInUtc>";
Here's the C# query, passing various args (some args are specified as XmlNode objects)
XmlNode nodeListItems = listService.GetListItems("Announcements", null, query, viewFields, null, queryOpts, null);
The C++ / gSoap query allows me to pass a query and response object:
listService.__ns10__GetListItems(&announcementQuery, &announcementResponse)
The query object has various properties that can be set that relate to the arguments in the C# call:
announcementQuery.listName
announcementQuery.query
announcementQuery.queryOptions
announcementQuery.viewFields
The first argument there is a string, no problem.
The query, queryOptions and viewFields are a bit confusing.
"query" is a class of type _ns2__GetListItems_query, and it has the following functions & members:
soap_default()
soap_get()
soap_in()
soap_out()
soap_put()
soap_serialize()
soap_type()
__any
__mixed
for query, queryOptions and viewFields, I'd simply like to specify an xml formatted string, like the C# code does, but I'm not sure how this is done.
Can someone cast some experience on this?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您已经找到了答案,但我会为后代发布一些注释。
下面是一个简单的 C++ 演示,用于将 XML 文档发送到 ASP.NET Web 方法。
以下是 .NET 服务中的简单 Web 方法:
如果一切正常,您将在控制台上看到“Response: hi”。
I'm assuming you've already discovered the answer to this, but I'll post some notes for posterity.
Here's a simple C++ demo for sending and XML doc to a ASP.NET web method.
Here's the trivial web method in the .NET service:
If everything works, you'll see "Response: hi" on your console.