简体   繁体   中英

wpf legacy server call

We have a legacy application running tomcat that publishes data in a simple html table. I have no control on the remote server publishing the data. I am looking to extract the data into a WPF desktop application and display it as a table.

Is there any way a WPF application can make a url call, get the result and parse the data. This would be similar to AJAX from JSP.

Any thoughts/ideas? Please advice.

Regards,

Yes, you can use a web service proxy class if the service is SOAP or use the WebClient class to request the data.

Once you get the data, use LINQ to parse it.

To get a more specific answer, you need to make your question more specific.

This isn't really a WPF question (as that's just the mechanism to display the information once you've retrieved and parsed it).

You could use something like HttpWebRequest to open the URL and retrieve the data, then write some code to parse the HTML and then you can use WPF to finally display it any way you like.

It depends on the condition of the HTML that you're receiving from the legacy application.

If it's XHTML, it can be parsed by an XML parser, and you can use the WebClient class to retrieve it from the server and LINQ or the XmlDocument to parse and query the data returned./

If it's not well-formed XML, you'll need to use an HTML parser to parse it, which probably means that you'll want to use the HTML Agility Pack .

Of course, you may not need to parse it at all. You might be able to get away with simply using a WebBrowser control to display it. It all depends on your requirements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM