Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Sending toServiceBus withBrokerProperties fails withBad Request #9

Open
@gaevoy

Description

@gaevoy

When I run the following SQL script to send aTestMessage message to Azure Service Bus topic{ServiceBusTopicName}:

declare @headers nvarchar(max), @url nvarchar(max), @payload nvarchar(max), @response nvarchar(max);set @headers= json_object('Accept':'application/xml','Content-Type':'application/json','BrokerProperties':'{"Label": "TestMessage", "SessionId": "Session1"}');set @payload= json_object('MessageId':1);select @headers, @payload;set @url='https://{ServiceBusName}.servicebus.windows.net/{ServiceBusTopicName}/messages'exec sp_invoke_external_rest_endpoint    @url= @url,    @method='POST',    @headers= @headers,    @payload= @payload,    @credential= [https://{ServiceBusName}.servicebus.windows.net],    @response= @response outputselect cast(@responseas xml)go

It fails with400 Bad Request pointing to'BrokerProperties' is invalid:

<output>  <response>    <status>      <httpcode="400"description="Bad Request" />    </status>    <headers>      <headerkey="Date"value="Thu, 05 Oct 2023 13:32:20 GMT" />      <headerkey="Transfer-Encoding"value="chunked" />      <headerkey="Content-Type"value="application/xml; charset=utf-8" />      <headerkey="Server"value="Microsoft-HTTPAPI/2.0" />      <headerkey="Strict-Transport-Security"value="max-age=31536000" />    </headers>  </response>  <result>    <Error>      <Code>400</Code>      <Detail>The value '{\"Label\": \"TestMessage\", \"SessionId\": \"Session1\"}' of the HTTP header 'BrokerProperties' is invalid. TrackingId:1030e3ab-5a69-4414-b28e-73af5a76888d_G58, SystemTracker:***, Timestamp:2023-10-05T13:32:19</Detail>    </Error>  </result></output>

However, once I removeBrokerProperties from the header, it works returning201 Created:

<output>  <response>    <status>      <httpcode="201"description="Created" />    </status>    <headers>      <headerkey="Date"value="Thu, 05 Oct 2023 13:39:17 GMT" />      <headerkey="Transfer-Encoding"value="chunked" />      <headerkey="Content-Type"value="application/xml; charset=utf-8" />      <headerkey="Server"value="Microsoft-HTTPAPI/2.0" />      <headerkey="Strict-Transport-Security"value="max-age=31536000" />    </headers>  </response></output>

My best guess issp_invoke_external_rest_endpoint does not correctly decode a value that contains encoded JSON

{"Accept":"application\/xml","Content-Type":"application\/json","BrokerProperties":"{\"Label\":\"TestMessage\",\"SessionId\":\"Session1\"}"}

What am I doing wrong?
Do you have any workarounds?
It there better place to file this bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp