ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SAP OData service call to send BASE64 data

Post new topic  Reply to topic
 SAP OData service call to send BASE64 data « View previous topic :: View next topic » 
Author Message
ghoshly
PostPosted: Wed Dec 18, 2024 3:42 pm    Post subject: SAP OData service call to send BASE64 data Reply with quote

Partisan

Joined: 10 Jan 2008
Posts: 333

Hello,

I am trying to call a SAP OData service from ACE 12 message flow and within the payload one field is actually an attachment in Base64 format.

The field is defined as string in SAP and through the service invocation, SAP developer is only getting first 255 characters, hence the complete file is not received. I tried to send the field as BLOB after decoding it, but it didn't help.

What is the best way to handle this scenario which appears to be very common. I would be thankful for any pointer to resolve this.


Best Regards..
Back to top
View user's profile Send private message
timber
PostPosted: Wed Jan 01, 2025 10:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

Please provide details of the input message tree and the code that you have tried.
Back to top
View user's profile Send private message
ghoshly
PostPosted: Tue Jan 07, 2025 12:46 pm    Post subject: Reply with quote

Partisan

Joined: 10 Jan 2008
Posts: 333

Hello Tim,

Thanks for responding, the input message is a SOAP message which is received from IBM Maximo. I am just selecting few fields and generating JSON message payload to call SAP Odata service.

DOCUMENTDATA is the field in the source message tree which contains the Base64 format of an attachment to an work order which I should share with SAP.

Code:

      DECLARE NS_Max NAMESPACE 'http://www.sodexo.com/maximo';
      
      DECLARE RF_Output REFERENCE TO OutputRoot;
      DECLARE RF_Doclinks  REFERENCE TO InputRoot.SOAP.Body.NS_Max:*[<].NS_Max:*[<].NS_Max:DOCLINKS;
      DECLARE RF_WorkOrder REFERENCE TO RF_Doclinks.NS_Max:WORKORDER;
      
      CREATE LASTCHILD OF OutputRoot AS RF_Output DOMAIN 'JSON' NAME 'JSON';
      CREATE LASTCHILD OF RF_Output AS RF_Output NAME 'Data';
      
      IF RF_Doclinks.Action = 'Delete' THEN
          SET RF_Output.Function      = 'D'; -- Check RF_Doclinks.Action and assign values based on that
      ELSE
          SET RF_Output.Function      = 'C';
      END IF;      
      SET RF_Output.MaximoWO      = RF_WorkOrder.NS_Max:WONUM;
      IF LENGTH(COALESCE(RF_WorkOrder.NS_Max:WOJO6, '')) > 0 THEN
        SET RF_Output.SAPWOrder   = RF_WorkOrder.NS_Max:WOJO6;
      END IF;
      SET RF_Output.MaximoWOID   = RF_Doclinks.NS_Max:OWNERID;
      SET RF_Output.FileName      = RF_Doclinks.NS_Max:URLNAME;
      SET RF_Output.FileDesc      = RF_Doclinks.NS_Max:DESCRIPTION;
      SET RF_Output.DocType      = RF_Doclinks.NS_Max:DOCTYPE;
      SET RF_Output.Content      = RF_Doclinks.NS_Max:DOCUMENTDATA;  -- CAST(BASE64DECODE(RF_Doclinks.NS_Max:DOCUMENTDATA) AS BLOB);
      
Back to top
View user's profile Send private message
timber
PostPosted: Thu Jan 09, 2025 3:39 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

The input field is base64. So you need to
- decode the base64 to get a BLOB (base64decode) and then
- encode the BLOB as a character stream ( CAST blob AS CHARACTER CCSID <choose ccsid carefully to match what the receiver expects>
Back to top
View user's profile Send private message
ghoshly
PostPosted: Thu Jan 09, 2025 5:50 pm    Post subject: Resolved` Reply with quote

Partisan

Joined: 10 Jan 2008
Posts: 333

Well, thanks for your response Tim.

my code worked when SAP developer decoded the base 64 and converted into Hex.

I would try the character stream for a Odata service where the output field type is STREAM.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SAP OData service call to send BASE64 data
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.