# Unable to create Wowza CDN HLS Target

**URL:** <https://community.wowza.com/t/unable-to-create-wowza-cdn-hls-target/54209>\
**Category:** Wowza Streaming Engine\
**Tags:** cdn\
**Created:** [November 20, 2019, 4:45pm UTC](https://community.wowza.com/t/unable-to-create-wowza-cdn-hls-target/54209 "2019-11-20T16:45:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Subramanian\_Raj1](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Subramanian\_Raj1](https://community.wowza.com/u/Subramanian_Raj1)\
**Post date:** [November 20, 2019, 4:45pm UTC](https://community.wowza.com/t/unable-to-create-wowza-cdn-hls-target/54209/1 "2019-11-20T16:45:36Z")

</div>

This is my Java Code, first I am creating StreamTarget in [cloud.wowza.com](http://cloud.wowza.com), I want to pass the return value to the Wowza Streaming Engine CDN target…

When I run the code it is giving file not found error. It looks the something wrong with the URL, can anyone help on this.

```auto
StreamTargetsApi apiInstance = new StreamTargetsApi();<br><br>StreamTargetWowza targetWowza = new StreamTargetWowza();<br>targetWowza.setName(fixtureId);<br>targetWowza.setUseSecureIngest(true);<br>targetWowza.setStreamName(fixtureId);<br><br>targetWowza.setProvider(StreamTargetWowza.ProviderEnum.AKAMAI_CUPERTINO);

try {<br> result = apiInstance.createWowzaStreamTarget(targetWowza); //This is working perfectly able to create the StreamTarget in cloud.wowza.com

//Now I want to pass the result value to Streaming enging. But getting error File not found error

    URL url = new URL("http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/pushpublish/mapentries/"+result.getName());

    getResponseFromHttpUrl(url,result.getConnectionCode(),result.getName(),result.getStreamName(),result.getId(),result.getHlsPlaybackUrl());
    return result;

} catch (ApiException e) {
    System.err.println("Exception when calling StreamTargetsApi#createWowzaStreamTarget");
    System.err.println("Exception when calling StreamTargetsApi#Code:"+e.getCode());
    System.err.println("Exception when calling StreamTargetsApi#ResponseBody:"+e.getResponseBody());
    e.printStackTrace();
}

```

```auto
private static String getResponseFromHttpUrl(URL url, String strConnectionCode, String entryName, String sourceStreamName, String targetid, String playbackurl) throws IOException {

    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("POST");
    connection.addRequestProperty("Accept","application/json");
    connection.addRequestProperty("Content-Type","application/json");
    connection.addRequestProperty("connectionCode",strConnectionCode);
    connection.addRequestProperty("enabled","true");
    connection.addRequestProperty("entryName",entryName);
    connection.addRequestProperty("profile","wowza-cdn");
    connection.addRequestProperty("sourceStreamName",sourceStreamName);
    connection.addRequestProperty("wowzaCloud.adaptiveStreaming","false");
    connection.addRequestProperty("wowzaCloud.accountApiKey","FZQ ****");
    connection.addRequestProperty("wowzaCloud.accountAccessKey","Wn0 ****");
    connection.addRequestProperty("wowzaCloud.targetId",targetid);
    connection.addRequestProperty("hls_playback_url",playbackurl);
    try {
        InputStream in = connection.getInputStream();

        Scanner scanner = new Scanner(in);
        scanner.useDelimiter("\\A");

        boolean hasInput = scanner.hasNext();
        if (hasInput) {
            return scanner.next();
        } else {
            return null;
        }
    } catch (Exception e){
        Log.e("Error",e.toString());
    }

    finally {
        connection.disconnect();
    }
    return null;
}

```

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [November 20, 2019, 8:06pm UTC](https://community.wowza.com/t/unable-to-create-wowza-cdn-hls-target/54209/3 "2019-11-20T20:06:55Z")

</div>

Hello, what documentation were you following to set this up?
