Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将字符串从web服务传递到windows窗体应用程序?_C#_Xml_Winforms_Web Services - Fatal编程技术网

C# 如何将字符串从web服务传递到windows窗体应用程序?

C# 如何将字符串从web服务传递到windows窗体应用程序?,c#,xml,winforms,web-services,C#,Xml,Winforms,Web Services,我有一个web服务,它在方法中包含一个字符串值。现在我想向windows窗体应用程序显示该字符串。 我知道我们可以调用方法并传递参数,以从web服务函数获得结果 但我无法逆转。我只想把那个字符串写进我的表格里。有人能告诉我如何从web服务将字符串传递到我的windows窗体吗 public XmlDocument ScanProduct(string barcode) { ClsFunction fun = new ClsFunction(); XmlDocument d

我有一个web服务,它在方法中包含一个字符串值。现在我想向windows窗体应用程序显示该字符串。 我知道我们可以调用方法并传递参数,以从web服务函数获得结果

但我无法逆转。我只想把那个字符串写进我的表格里。有人能告诉我如何从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;
}
公共XML文档扫描产品(字符串条形码)
{
ClsFunction fun=新的ClsFunction();
XmlDocument dom=新的XmlDocument();
XmlElement Reply=dom.CreateElement(“Reply”);
dom.AppendChild(回复);
str1=fun.RmvQuote(条形码);
尝试
{
回复:SetAttribute(“项目编号”、“1043”);
Reply.SetAttribute(“upcno”,fun.RmvQuote(条形码));
回复:SetAttribute(“项目描述1”,“Chio Red Paprika 12/175g”);
回复:SetAttribute(“项目描述2”,“CHIO RED PAPRIKA 12/175G”);
}
// 
捕获(例外情况除外)
{
xmlement ReplyCode=dom.CreateElement(“ReplyCode”);
Reply.AppendChild(ReplyCode);
XmlText text=dom.CreateTextNode(“无效请求”);
ReplyCode.AppendChild(文本);
XmlElement Message=dom.CreateElement(“消息”);
答复.追加儿童(信息);
XmlText replymsg=dom.CreateTextNode(“无效请求或未经授权的访问”);
Message.AppendChild(replymsg);
}
返回dom;
}
我想在windows窗体应用程序中打印条形码

我的Web服务是XML格式的。
提前感谢…

我认为您需要一个调用应用程序的web服务:

尝试使用双工服务,其中客户端充当服务器,服务器充当客户端


您的winform应用程序如何调用web服务?除非使用双工连接,否则无法从web服务推送内容。因此,我想知道如何将条形码导入windows窗体。条形码来自android应用程序。提出另一个请求?你能给我举个例子吗?你现在怎么打电话?做类似的事情