locked
Having Trouble sending wns/raw notification - 400 error RRS feed

  • Question

  • Greetings,

    I have a small logic app which is meant to fetch data from somewhere and store it on blob. I then would like to send the URL to all devices via push notification. I wish to send the URL as a raw notification, so on the app/background task, i can do some processiong.

    The problem is when i use logic app to create a http POST request to send a notification, i get a 400 error. The same header with authentication and etc, with the payload and URL works fine on a POSTMAN or REST API CLIENT. THe following are the inputs and outputs. Please help. Brain dead already. 

    This is the input.

    {
        "uri": "https://xxoppoc.servicebus.windows.net/xxopPOC/messages/?api-version=2015-01",
        "method": "POST",
        "headers": {
            "Authorization": "SharedAccessSignature sr=sb%3a%2f%2fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxt%2f&sig=qEnxxxxxxxxxxxx&skn=DefaultFullSharedAccessSignature",
            "Content-Type": "application/octet-stream",
            "ServiceBusNotification-Format": "windows",
            "ServiceBusNotification-Tags": "MyTag",
            "X-WNS-Type": "wns/raw"
        },
        "body": "Some Raw Information. Hello World"
    }

    This is the output.

    {
        "statusCode": 400,
        "headers": {
            "transfer-Encoding": "chunked",
            "date": "Wed, 30 Mar 2016 14:10:41 GMT",
            "server": "Microsoft-HTTPAPI/2.0"
        },
        "body": {
            "$content-type": "application/xml; charset=utf-8",
            "$content": "PEVycm9yPjxDb2RlPjQwMDwvQ29kZT48RGV0YWlsPlRoZSBjb250ZW50IHR5cGUgZm9yIGEgJ3ducy9yYXcnIG5vdGlmaWNhdGlvbiBtdXN0IGJlICdhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0nLlRyYWNraW5nSWQ6NTNmNjhlMGItNDc1MC00ZDRkLWJiNTAtMzJjNTBmOGIyNDk1X0czLFRpbWVTdGFtcDozLzMwLzIwMTYgMjoxMDo0MSBQTTwvRGV0YWlsPjwvRXJyb3I+"
        }
    }

    Let me mention again, I got the authentication correct as it works on Advanced REST Client on chrome and POSTMAN. The above logic app also works if i send a wns/toast notification with xml as its content-type. I however need it to be a wns/raw notification. Please help. Thank you

    Wednesday, March 30, 2016 2:27 PM

Answers

  • This is a side of the experience we are really working to improve (working with different content types).  Right now the only way the content-type is specified is based on the content type provided in the body.  In this case since it sees a "string" it is adding 'charset=utf-8' to the header to make it accurate.  I believe in order to make sure the outgoing request is actually octect-stream you need to specify you are sending binary by casting the body like this:

    "body": "@binary('Some Raw information. Hello World')"

    If you change it to that in code-view it will work

    Wednesday, April 6, 2016 3:47 AM

All replies

  • To help kick off... I found out that logic apps add charset=utf 8 to the end of content type. That might be messing this up.

    Content-Type: application/octet-stream; charset=utf-8

    Why is logic apps adding this charset=utf-8????

    Wednesday, March 30, 2016 4:03 PM
  • This is a side of the experience we are really working to improve (working with different content types).  Right now the only way the content-type is specified is based on the content type provided in the body.  In this case since it sees a "string" it is adding 'charset=utf-8' to the header to make it accurate.  I believe in order to make sure the outgoing request is actually octect-stream you need to specify you are sending binary by casting the body like this:

    "body": "@binary('Some Raw information. Hello World')"

    If you change it to that in code-view it will work

    Wednesday, April 6, 2016 3:47 AM
  • I decided to switch to Azure function apps. Have more control there. I will try out your suggestion anyway and hope it can help others. 

    Thanks for the suggestion.

    Thursday, April 7, 2016 2:47 AM