简体   繁体   English

如何将字符串从Web服务传递到Windows窗体应用程序?

[英]How to pass a string from web service to windows form application?

i have a web service which contains a string value into a method. 我有一个Web服务,其中包含一个方法中的字符串值。 Now i want to show that string to a windows form application. 现在,我想将该字符串显示给Windows窗体应用程序。 i know we can call methods and pass parameters to get the result from web service functions. 我知道我们可以调用方法并传递参数以从Web服务功能获取结果。

but i am not able to reverse it. 但我无法扭转它。 i only want that string into my form. 我只希望该字符串进入我的表单。 Can anybody tell me how to pass the string to my windows form from a web service??? 有人可以告诉我如何从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;
}

i want to print barcode in my windows form application. 我想在Windows窗体应用程序中打印条形码。

My webservice is in XML Format. 我的网络服务是XML格式。 Thanks in Advance... 提前致谢...

i think you need and web service which call the application: 我认为您需要和网络服务来调用该应用程序:

try to use Duplex service in which client act as a server and server act as a client. 尝试使用双工服务,其中客户端充当服务器,而服务器充当客户端。

Duplex services 双工服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将变量从C#Windows窗体应用程序传递到PHP Web服务 - How to pass variables from C# Windows Form Application to PHP Web-Service Web服务Windows窗体应用程序 - Web service windows form application 如何将参数从Web应用程序中的activex传递到exe(Windows窗体应用程序)? - How to pass parameter to an exe (windows form application) from activex in web application? 如何将数据从Windows窗体应用程序发送到Asp.Net Web服务应用程序 - How to send data from a Windows Form Application to a Asp.Net Web Service Application 如何将对象从其托管Windows服务传递到Web服务 - How to pass an object to Web Service from its hosting Windows Service 如何调用Web服务异步方法到Windows窗体应用程序? - How to Invoke web service async method to windows form application? 将C#Windows窗体应用程序中的字符串传递给php网页 - pass string from C# Windows Form Application to php webpage 如何从客户端应用程序访问Windows服务上托管的Web服务? - How to access a Web Service hosted on a Windows Service from a client application? 如何将数据从Windows应用程序传递到Web应用程序? - How to pass data from windows application to web application? 如何在 Windows 服务的应用程序中启动 windows 表单? - How to launch a windows form in an application from Windows service?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM