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 » From JSON input to element of Soap Request

Post new topic  Reply to topic
 From JSON input to element of Soap Request « View previous topic :: View next topic » 
Author Message
IIBn00b
PostPosted: Tue Dec 03, 2019 4:31 am    Post subject: From JSON input to element of Soap Request Reply with quote

Newbie

Joined: 19 Nov 2019
Posts: 7

I have an input node that receives JSON as its input.
I need to send out a SOAP message where one of the SOAP data fields is the complete JSON message as a JSON string.
I tried several things but all I'm getting is an empty field or the JSON as XML.

As an example:
The JSON input looks like this
Code:

{
  "message": "Hello World",
  "version": "1.0",
  "createdOn": "2019-10-28T14:10:42.6803246+01:00",
  "storage": {
    "diskNumber": "270",
    "diskName": "Pandora"
  }
}


In my ESQL compute node I tried this (Code snippet):

Code:
SET ins.p_aRequest = InputRoot.JSON.Data.Request;

or
Code:
SET ins.p_aRequest = InputRoot.JSON.Data;

or
Code:
SET ins.p_aRequest = InputRoot.JSON;


Which is giving me:
Code:

<SOAP_Domain_Msg xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ccs="http://www.ccm.nl">
 <Context>
  <Namespace xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ccs="http://www.ccm.nl"/>
 </Context>
</SOAP_Domain_Msg>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ccm="http://www.ccm.nl">
 <soapenv:Body>
  <ccm:ccmExtensionExecute>
   <p_iExtensionId>550</p_iExtensionId>
   <p_sParameter>test</p_sParameter>
   <p_sCrmId>179764534523</p_sCrmId>
  </ccm:ccmExtensionExecute>
 </soapenv:Body>
</soapenv:Envelope>


Where p_aRequest is not available or

Code:

<SOAP_Domain_Msg xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ccs="http://www.ccm.nl">
 <Context>
  <Namespace xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ccs="http://www.ccm.nl"/>
 </Context>
</SOAP_Domain_Msg>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ccm="http://www.ccm.nl">
 <soapenv:Body>
  <ccm:ccmExtensionExecute>
   <p_iExtensionId>550</p_iExtensionId>
   <p_sParameter>test</p_sParameter>
   <p_sCrmId>179764534523</p_sCrmId>
   <p_aRequest>
     <Data>
       <message>Hello World</message>
       <version>1.0</version>
       <createdOn>2019-10-28T14:10:42.6803246+01:00</createdOn>
       <storage>
         <diskNumber>270</diskNumber>
         <diskName>Pandora</diskName>
       </storage>
     </Data>
   </p_aRequest>
  </ccm:ccmExtensionExecute>
 </soapenv:Body>
</soapenv:Envelope>


If I do this:

Code:

SET ins.p_aRequest = '{
  "message": "Hello World",
  "version": "1.0",
  "createdOn": "2019-10-28T14:10:42.6803246+01:00",
  "storage": {
    "diskNumber": "270",
    "diskName": "Pandora"
  }
}';


The result is:
Code:

<SOAP_Domain_Msg xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ccs="http://www.ccm.nl">
 <Context>
  <Namespace xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ccs="http://www.ccm.nl"/>
 </Context>
</SOAP_Domain_Msg>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ccm="http://www.ccm.nl">
 <soapenv:Body>
  <ccm:ccmExtensionExecute>
   <p_iExtensionId>550</p_iExtensionId>
   <p_sParameter>test</p_sParameter>
   <p_sCrmId>179764534523</p_sCrmId>
   <p_aRequest>
     {
       "message": "Hello World",
       "version": "1.0",
       "createdOn": "2019-10-28T14:10:42.6803246+01:00",
       "storage": {
         "diskNumber": "270",
         "diskName": "Pandora"
       }
     }
   </p_aRequest>
  </ccm:ccmExtensionExecute>
 </soapenv:Body>
</soapenv:Envelope>


Which is what I'm looking for. But this is hard coded and by that not the solution I'm looking for (duh).

The question is: How to get the JSON from the inputNode as a string in my soap message?
Back to top
View user's profile Send private message
IIBn00b
PostPosted: Tue Dec 03, 2019 5:32 am    Post subject: Solved it Reply with quote

Newbie

Joined: 19 Nov 2019
Posts: 7

I Inserted the JSON as a blob and for the SOAPmessage I did
Code:
SET ins.p_aRequest = CAST(InputRoot.BLOB.BLOB as char CCSID 1208 Encoding 815);


That solved my issue.
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 » From JSON input to element of Soap Request
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.