IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

BytesToString returning "" string

webMethods Community Member

webMethods Community MemberThu July 22, 2021 02:30 AM

webMethods Community Member

webMethods Community MemberThu July 22, 2021 02:32 AM

webMethods Community Member

webMethods Community MemberThu July 22, 2021 03:10 AM

webMethods Community Member

webMethods Community MemberThu July 22, 2021 03:26 AM

webMethods Community Member

webMethods Community MemberThu July 22, 2021 03:29 AM

webMethods Community Member

webMethods Community MemberThu July 22, 2021 03:34 AM

webMethods Community Member

webMethods Community MemberThu July 22, 2021 03:37 AM

  • 1.  BytesToString returning "" string

    Posted Wed July 21, 2021 11:16 AM

    Hello.

    So I use pub.string:bytesToString with the mapping already set, but it appears the flow can’t decode/translate properly that it returns the string as rectangle character, as seen as the image below

    I don’t understand how this can happen, because the reference that I follow can do this properly with the same mapping as this

    p2

    and the string that the reference I follow to make this service successfully convert the bytes to string like this

    The expectation for the string for my service is like this (in one line though)

    {
    "attributes": {
    "client_name": "",
    "client_number": "",
    "inquiry_result": [
    {
    "name": "",
    "value": ""
    },
    {
    "name": "",
    "value": ""
    ]
    },
    "client_number": ""
    }
    

    Is it because of the “[” and “]” characters that cause this problem? or anything else?

    I really need help to solve this problem cause I have tried to set the encoding to “utf-8”, “ASCII”, “iso-8859-1” but none of them are working, am I missing something?

    Thank you in advance


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 11:37 AM

    Can you provide a complete copy of your service ?
    Also where are you getting the bytes from ?
    regards
    John Carter
    Product Manager @ Software AG
    Integration & Microservices runtime


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 01:25 PM

    Hi @John_Carter4 thanks for replying, i think I couldn’t give you a copy of my service but if it’s required to do so, I probably reconsider it.

    I’m getting the bytes from pub.client.http services


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 4.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 01:43 PM

    Make sure that you set the input “loadAs” to bytes.
    Also you should check the header/status to check that the call is working properly and returning a proper response.
    John.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 5.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 01:59 PM


  • 6.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:16 PM

    Can you set a header in your http headers to “Accept” and set the value as “application/json”.
    If you make the http call from an client app such as postman does it work ?


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 7.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:22 PM

    you mean the yellow one right?

    if so

    I’ve set my headers to content-type to application/json right now, should I add a new one called “Accept”?
    p6

    Yes, if I’ve hit in postman with the input string provided with my service, it works


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 8.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:25 PM

    Yes add “Accept” as that determines the expected format for the response.
    Postman might be setting the header automatically. I would also look very closely at the request including the headers generated by postman and ensure it matches your setup.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 9.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:28 PM

    and the value for “accept” is “application/json” too or not?

    Edit : I’ve tried with the value for “accept” is “/” and “application/json” but it doesn’t work too


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 10.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:33 PM


  • 11.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:36 PM


  • 12.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:41 PM

    I suspect the REST API that you are invoking. Try using a REST Client and see what your URL responds with as output.

    On Postman, set both the Content-Type and Accept to application/json and post the response here (after sanitizing).

    KM


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 13.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:44 PM

    Hi @Venkata_Kasi_Viswanath_Mugada1 i’m not sure what are you refer to, but if i hit it from postman, i got this output/response which are expected

    About sanitizing, what does it mean?


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 14.  RE: BytesToString returning "" string



  • 15.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:50 PM

    Ah yes @Venkata_Kasi_Viswanath_Mugada1 , thanks for the correction I believe I accidentally delete the “}” after value field. It should be there in the expected output


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 16.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:59 PM

    Replicating your service at my side, hang on mate - will respond shortly.

    KM


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 17.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 03:04 PM

    Thanks for the info Kasi, but right now it’s 2 AM in my time zone, so I probably will go asleep soon, but I will check it later.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 18.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 03:09 PM

    I’m unable to replicate your issue at my side; cannot do this without looking at your code.
    Can you provide a complete copy of your service, with just the user/password removed?

    KM


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 19.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 03:12 PM

    Any idea to how can i send it without uploading it to public? i probably can send one to @John_Carter4 too


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 20.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 03:21 PM

    You can upload it to a private space (say, your Google Drive) and use the Message feature to send us the link -

    Click on our profile and select Message -

    Then add our usernames and send us the message; I’ve sent you a test message -

    KM


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 21.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 04:11 PM

    I’ve investigated your service and don’t see an issue; it seems straightforward.

    I see that you are using API Gateway as the provider - can you update the API policy, to store the request and response payloads and see if there’s any issue in them?

    Regards,
    Kasi


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 22.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 11:00 PM

    Thanks for investigating kasi. I believe i can’t update the policy of the API, as i am didn’t have the access to it. My senior said that if i can hit it in the postman and returns the response, it must be something wrong with the service. But i dont know where to fix that


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 23.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 02:05 AM

    It could be an IS or built-in service issue and it would be easy to check if you can get your API GW team to help investigate. Alternatively, check if you have installed the latest fixes and then open a support ticket.

    KM


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 24.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 02:30 AM


  • 25.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 02:32 AM

    I meant the team that supports your API Gateway environment.

    KM


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 26.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 02:35 AM

    I will ask to them about this.

    Do you think the problem that cause this is because of the " [ " and " ] " character are in the response? I don’t really know if that would intervene the bytesToString service

    Is there anything that i can do to resolve this? do you think it might word if i add the value for “encode” field in bytesToString???


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 27.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 02:52 AM

    You can try setting UTF-8 as the encoding. Do you have any Indonesian or any other language-specific characters in the response? If yes, then you will have to use the appropriate encoding for that language.

    You confirmed that the response JSON (from your Postman) is valid. We’re speculating now without much to go on - create a support ticket via Empower to get this issue investigated.

    Suggestion - Try using “stream” as the loadAs option and see? There’s a streamToString service available.

    KM


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 28.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:10 AM

    Maybe I’m late to the party, but UTF-8 should be quite comprehensive covering most languages.

    Regarding

    Another alternative is to take the input JSON string , pass that to stringToBytes , pass the output to bytesToString again, check if you see a difference.

    Not only related to this question, but having a cloud environment (with a set of products installed) where flows can be created and demonstrated should reduce the to and fro in such issues. If someone doesn’t want to share with public , sanitization /appropriate ACLs can be applied as well.

    It will be much easier to share flow snippets that way and will allow others to look at the flow and respond.

    Regards,
    Nagendra


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 29.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:15 AM

    I believe it all is in english, Kasi.

    I’ve tried to set it as UTF-8, and it doesnt work

    About the streamToString service, it doesnt available at my WmPublic Package


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 30.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:17 AM

    It should be in the pub.io folder by default.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 31.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:22 AM

    Ah just seen this, thanks, i’ve tried it, and it doesnt work… again
    image

    This is the flow
    image


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 32.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:26 AM

    Check your fixes and create a support ticket, @Ghifari17.

    @Nagendra_Prasad, yes UTF-8 usually does it, but I did have problems a few years ago while dealing with Chinese characters and had to use a specific encoding. I also tested string to bytes and viceversa, no issues on my 10.5 wM setup.

    KM


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 33.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:29 AM

    I agree , while creating a ticket , having a standalone package which has the inputs to the public service, and the expected results , would speed up resolution.
    -NP


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 34.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:34 AM

    To create a ticket, i need to request an account first right? i can’t use this account there?


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 35.  RE: BytesToString returning "" string

    Posted Thu July 22, 2021 03:37 AM

    You need an Empower account, with your work email address. Reach out to your supervisor or the wM administration team - they should already have one for a few contacts in the organization.

    If you are a contractors or service provider to your wM customer, reach out to the customer to create a ticket with their Empower account.

    KM


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 36.  RE: BytesToString returning "" string

    Posted Wed July 21, 2021 02:37 PM

    can you set newSession to true, something in your session might be corrupting the request.
    John.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 37.  RE: BytesToString returning "" string