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:
- within action method construct url of dynamic parameters
- send constructed url service
- parse returned service response parameters
- 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
Post a Comment