【发布时间】:2014-03-26 02:33:23
【问题描述】:
我有一个 Web 服务,它在方法中包含一个字符串值。现在我想将该字符串显示给 Windows 窗体应用程序。 我知道我们可以调用方法并传递参数以从 Web 服务函数中获取结果。
但我无法扭转它。我只希望该字符串进入我的表单。谁能告诉我如何将字符串从网络服务传递给我的 Windows 窗体???
public XmlDocument ScanProduct(string barcode)
{
ClsFunction fun = new ClsFunction();
XmlDocument dom = new XmlDocument();
XmlElement Reply = dom.CreateElement("Reply");
dom.AppendChild(Reply);
str1 = fun.RmvQuote(barcode);
try
{
Reply.SetAttribute("itemno", "1043");
Reply.SetAttribute("upcno", fun.RmvQuote(barcode));
Reply.SetAttribute("item_desc1", "Chio Red Paprika 12/175g");
Reply.SetAttribute("item_desc2", "CHIO RED PAPRIKA 12/175G");
}
//<Reply replycode="success" msg="You are successfully login." sid="0" />
catch (Exception ex)
{
XmlElement ReplyCode = dom.CreateElement("ReplyCode");
Reply.AppendChild(ReplyCode);
XmlText text = dom.CreateTextNode("invalid request");
ReplyCode.AppendChild(text);
XmlElement Message = dom.CreateElement("Message");
Reply.AppendChild(Message);
XmlText replymsg = dom.CreateTextNode("invalid request, or unauthorized access");
Message.AppendChild(replymsg);
}
return dom;
}
我想在我的 Windows 窗体应用程序中打印条形码。
我的网络服务是 XML 格式的。 提前致谢...
【问题讨论】:
-
你的winform应用是如何调用web服务的?除非您使用双工连接,否则您无法从 Web 服务推送内容。
-
所以我想知道我应该怎么做才能让条形码进入我的 Windows 窗体。条形码来自一个安卓应用程序。
-
提出另一个请求?
-
你能举个例子吗?
-
你现在打电话怎么样?做类似的事情
标签: c# xml winforms web-services