# Whats wrong with the Java Code

**URL:** <https://community.wowza.com/t/whats-wrong-with-the-java-code/47186>\
**Category:** Wowza Video (Formerly Streaming Cloud)\
**Created:** [June 20, 2016, 5:31pm UTC](https://community.wowza.com/t/whats-wrong-with-the-java-code/47186 "2016-06-20T17:31:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Murali\_G](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@Murali\_G](https://community.wowza.com/u/Murali_G)\
**Post date:** [June 20, 2016, 5:31pm UTC](https://community.wowza.com/t/whats-wrong-with-the-java-code/47186/1 "2016-06-20T17:31:20Z")

</div>

Hello wowza team, first of all I’d like to thank the awesome assistance of the sales representatives . I am developing an android application, its a social platform where people can meet and chat. We have video streaming feature in the application and so we are using the WOWZA REST API. I am using the below code to get create a live video steam.

String url = “[https://api.cloud.wowza.com/api/v1/live\_streams](https://api.cloud.wowza.com/api/v1/live_streams)”;

URL uri = new URL(url);

HttpsURLConnection conn = (HttpsURLConnection) uri.openConnection();

conn.setConnectTimeout(5000);

conn.setRequestProperty(“Content-Type”, “application/json; charset=UTF-8”);

conn.setRequestProperty(“wsc-api-key”, API\_KEY);

conn.setRequestProperty(“wsc-access-key”, API\_ACCESS\_KEY);

conn.setDoOutput(true);

conn.setDoInput(true);

conn.setRequestMethod(“POST”);

JSONObject body = new JSONObject();

body.put(“name”, name).put(“transcoder\_type”, “transcoded”).put(“billing\_mode”, “pay\_as\_you\_go”)

.put(“broadcast\_location”, “asia\_pacific\_singapore”).put(“encoder”, “other\_rtsp”)

.put(“delivery\_method”, “pull”).put(“source\_url”, sourceUrl).put(“aspect\_ratio\_width”, “1280”)

.put(“aspect\_ratio\_height”, “720”);

JSONObject jsonObject = new JSONObject();

jsonObject.put(“live\_stream”, body);

byte[] outputBytes = jsonObject.toString().getBytes(“UTF-8”);

OutputStream os = conn.getOutputStream();

os.write(outputBytes);

os.close();

InputStream in = conn.getInputStream();

String result = IOUtils.toString(in, “UTF-8”);

Log.i(TAG, "Response : "+ result);

in.close();

conn.disconnect();

wowzaResponse = new Gson().fromJson(result, WowzaResponse.class);

I am getting the following error, it would be really helpful the community can help me identify the error and help me with the integration process.

“java.io.FileNotFoundException: [https://api.cloud.wowza.com/api/v1/live\_streams](https://api.cloud.wowza.com/api/v1/live_streams)” on the line “InputStream in = conn.getInputStream();”

---

<div class="post-metadata">

**Author:** ![sal\_jefferson](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sal\_jefferson](https://community.wowza.com/u/sal_jefferson)\
**Post date:** [June 20, 2016, 6:47am UTC](https://community.wowza.com/t/whats-wrong-with-the-java-code/47186/2 "2016-06-20T06:47:47Z")

</div>

Hello there and welcome to the Wowza support forum. Troubleshooting custom code is a bit beyond the scope of this forum.

But as for your current error, is it possible the server was unavailable at the time of execution? Are you still getting the error?

You may wish to consider hiring the help of a Wowza endorsed consultant to assist you in this development. If so please post a request to the [find a consultant forum](http://community.wowza.com/c/-/7).

Best,

Salvadore
