ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 205 - AZ-204 discussion

Report
Export

DRAG DROP

You are a developer for a Software as a Service (SaaS) company. You develop solutions that provide the ability to send notifications by using Azure Notification Hubs.

You need to create sample code that customers can use as a reference for how to send raw notifications to Windows Push Notification Services (WNS) devices. The sample code must not use external packages.

How should you complete the code segment? To answer, drag the appropriate code segments to the correct locations. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

NOTE: Each correct selection is worth one point.


Question 205
Correct answer: Question 205

Explanation:

Box 1: windows

Example code:

var request = new HttpRequestMessage(method, $"{resourceUri}?api-version=2017-04");

request.Headers.Add("Authorization", createToken(resourceUri, KEY_NAME,

KEY_VALUE));

request.Headers.Add("X-WNS-Type", "wns/raw");

request.Headers.Add("ServiceBusNotification-Format", "windows");

return request;

Box 2: application/octet-stream

Example code capable of sending a raw notification:

string resourceUri = $"https://{NH_NAMESPACE}.servicebus.windows.net/{HUB_NAME}/messages/";

using (var request = CreateHttpRequest(HttpMethod.Post, resourceUri))

{

request.Content = new StringContent(content, Encoding.UTF8,

"application/octet-stream");

request.Content.Headers.ContentType.CharSet = string.Empty;

var httpClient = new HttpClient();

var response = await httpClient.SendAsync(request);

Console.WriteLine(response.StatusCode);

}

Reference:

https://stackoverflow.com/questions/31346714/how-to-send-raw-notification-to-azure-notification-hub/31347901

asked 02/10/2024
Eric De La Vega
41 questions
User
0 comments
Sorted by

Leave a comment first