Reputation: 673
How can I get a stream in JaxWS while reading the response from a URL? My problem is that I get the URL response as a 500 MB data. So I am looking for a response stream which I can save directly into a file.
final MyBean myBean = new MyBean("posted MyBean", 11);
Response response = webTarget.path("resource").request("application/xml")
.post(Entity.entity(myBean, "application/xml"));
System.out.println(response.getStatus());
final String responseEntity = response.readEntity(String.class);
System.out.println(responseEntity);
Upvotes: 1
Views: 317
Reputation: 673
Found the answer myself. We can get the stream as below:-
InputStream in = response.readEntity(InputStream.class);
Upvotes: 1