Try PubSub+

REST curl example not showing payload on Try-Me

cvergescverges Member Posts: 3
edited December 2020 in General Discussions

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

  • ariharih Member, Employee Posts: 57 Solace Employee
    Accepted 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.

  • ariharih Member, Employee Posts: 57 Solace Employee
    Accepted Answer

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

  • ariharih Member, Employee Posts: 57 Solace Employee
    Accepted 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

  • cvergescverges 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.

  • TamimiTamimi Member, Administrator, Employee Posts: 97 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!

  • AaronAaron Member, Moderator, Employee Posts: 154 Solace Employee

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

  • cvergescverges 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).

Sign In or Register to comment.