REST curl example not showing payload on Try-Me

cverges
cverges Member Posts: 3
edited December 2020 in General Discussions #1

I'm following the instructions at https://docs.solace.com/RESTMessagingPrtl/Solace-REST-Example.htm to use curl to publish to a topic:

curl -i \
    'http://<ip>:9000/TOPIC/test' \
    -X POST \
    -H 'Authorization: Bearer (omitted)' \
    -H 'Content-Type: text/plain' \
    -H 'User-Agent: SolaceTest' \
    -d 'Hello, World'

On the Solace PubSub+ Standard's Try-Me section, I'm seeing the message come in for the topic test as expected, but the payload of Hello, World doesn't show. PubSub+ is VMR 9.7.0.40.

Am I doing something wrong? Any advice for how to troubleshoot next?

Best Answers

  • arih
    arih Member, Employee Posts: 125 Solace Employee
    #2 Answer ✓

    Hi @cverges
    I remember seeing this before but not yet really knows what's happened. But I do know that the Try-me inside the Web manager is having that issue, but other code samples or Try-me on the Solace Cloud is fine. I'd suggest you use the other way for now. I'l see if i can find out what it is the cause and update here later.

    For sample code, you can pick your favorite in github.com/solacesamples and just make sure to modify the topic name to subscribe in the TopicSubscriber code.
    For Solace Cloud, you can simply use the Try-me tab there (not inside Web manager or after you click Manage Service). See below for sample.

  • arih
    arih Member, Employee Posts: 125 Solace Employee
    #3 Answer ✓

    yeah, I just tested it out myself and see the same issue with my env, but codes work fine.

  • arih
    arih Member, Employee Posts: 125 Solace Employee
    #4 Answer ✓

    Not a PEBKAC most definitely :smiley: my test with SDKPerf also shows slightly different payload raw content for both REST and the pub try-me app.

    For now, we can use application/octet-stream in curl such as below until the tutorial gets updated:

Answers

  • arih
    arih Member, Employee Posts: 125 Solace Employee
    #5 Answer ✓

    Hi @cverges
    I remember seeing this before but not yet really knows what's happened. But I do know that the Try-me inside the Web manager is having that issue, but other code samples or Try-me on the Solace Cloud is fine. I'd suggest you use the other way for now. I'l see if i can find out what it is the cause and update here later.

    For sample code, you can pick your favorite in github.com/solacesamples and just make sure to modify the topic name to subscribe in the TopicSubscriber code.
    For Solace Cloud, you can simply use the Try-me tab there (not inside Web manager or after you click Manage Service). See below for sample.

  • cverges
    cverges Member Posts: 3

    Thanks for the fast reply, @arih! If it's just limited to the Try-Me functionality, I'm OK ignoring for now. I just wanted to confirm that the payload is being published properly to a subscriber, and haven't yet finished bringing up my topic subscriber. If you're confirming that this is just due to a Try-Me bug and the REST publishing does, in fact, work, then I'm good to go.

  • arih
    arih Member, Employee Posts: 125 Solace Employee
    #7 Answer ✓

    yeah, I just tested it out myself and see the same issue with my env, but codes work fine.

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 491 admin

    Yea when sending plain raw text on the REST port theres an issue with showing the body from the Try Me tab, a workaround is if you have access to a solace cloud account you can navigate to the Try Me! widget from your service and under the subscriber you can click on the "show advanced settings" and change the connection to localhost. Alternatively you can also use this public TryMe! widget found here https://solace.com/products/event-broker/software/getting-started/ which is configured to connect to a local broker by default (in your case). Hope this helps!

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    Weird, it works for me on my 9.2 software broker:

  • cverges
    cverges Member Posts: 3

    @Aaron, I'll trade you? :-)

    It's a fairly bare-bones installation for testing purposes. I enabled the REST protocol on the default port (9000) and published to the dynamic topic "test". There is an error sdtContainer is not defined that pops up when the REST call is made; it does not show up when publishing via Try-Me. Related in some sense, but not entirely clear what/why at first glance. Nothing in the JS error logs, for example, and the web socket comms are fairly light:

    Please let me know if you want any other screens/details. I wouldn't be surprised if it's a situational bug (PEBKAC or otherwise).

  • arih
    arih Member, Employee Posts: 125 Solace Employee
    #11 Answer ✓

    Not a PEBKAC most definitely :smiley: my test with SDKPerf also shows slightly different payload raw content for both REST and the pub try-me app.

    For now, we can use application/octet-stream in curl such as below until the tutorial gets updated:

  • FalkLademann
    FalkLademann Member Posts: 8

    Having same issue, this message appears when publishing to topic from Mulesoft Anypoint Studio Version: 7.8.0. Using "Try me!" as a producer in the same setup would work fine.
    For messages published by Mulesoft, it is either "sdtContainer is not defined" or also "URI malformed" on some.

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 491 admin

    Hey @FalkLademann I believe you are publishing messages from Mulesoft via a REST API call? What version of the broker are you using? And are you using a software (docker image) or a cloud broker?

  • FalkLademann
    FalkLademann Member Posts: 8

    Publish is by JMS. VMR 9.8.0.12 on Docker engine 20.10.2

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 491 admin

    We had a bug in VMR 9.8 that is fixed in 9.9 so I would recommend checking that out when the new one comes out. In the meantime you can still consume your messages with any other SMF API and access the payload

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    @cverges @FalkLademann this has been fixed and delivered in the 9.9 software broker! To be clear, it was only a bug inside the Try Me! little console when displaying messages... the broker was still working fine and everything. Just the little Try Me! subscriber app couldn't show TextMessages.

    Anyhow, thanks for letting us know about this..!

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 491 admin

    Thanks for the update on this @Aaron !