簡體   English   中英

如何將字符串從Web服務傳遞到Windows窗體應用程序?

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

我有一個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;
}

我想在Windows窗體應用程序中打印條形碼。

我的網絡服務是XML格式。 提前致謝...

我認為您需要和網絡服務來調用該應用程序:

嘗試使用雙工服務,其中客戶端充當服務器,而服務器充當客戶端。

雙工服務

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM