java - How to obtain data from a webservice in a JSF action method? -


i'm trying determine correct api calls on facescontext following when processing backing bean action:

  1. within action method construct url of dynamic parameters
  2. send constructed url service
  3. parse returned service response parameters
  4. continue action method processing based on reponse string request.

any suggestions on highlevel api calls steps 2 , 3 send me in right direction appreicated. note, service i'm calling external application in blackbox. instructions are: send url in specified format, parse response see happened.

this problem not specific jsf in particular, you'll find nothing in jsf api. standard java api offers java.net.url or, allows more fine grained control, java.net.urlconnection fire http requests , obtain response inputstream can freely parse usual java way.

inputstream response = new url("http://google.com").openstream(); // ... 

depending on content type of response, there may 3rd party api's ease parsing. example, google gson if it's json or jsoup if it's html/xml.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -