Author |
Message
|
shashivarungupta |
Posted: Sun Sep 07, 2014 3:58 pm Post subject: Converstion from XML to SOAP |
|
|
 Grand Master
Joined: 24 Feb 2009 Posts: 1343 Location: Floating in space on a round rock.
|
Hi ,
I have been trying to create/test a application/flow where input is xml message, being received by MQInput Node and based on some calculations it generates & routes the output message to the respective destination MQOutput Queue, which intrun picks up that Output xml message and tries to invoke the SOAP based WebService using SOAPRequest Node.
The second half of the Application/Message flow is like ..
MQInput > Validate > ComputeNode(1) > SOAPRequest > SOAP Extract > ComputeNode(2) > MQOutput
Where:
MQInput is having XMLNSC as Message Domain to receive and parse XML msg.
ComputeNode(1)'s objective is to convert the XML to SOAP Message before it invokes an existing WS, mentioned in SOAPRequest Node using deployable WSDL.
Based on the Reply from SOAPRequest (synchronous) the Message XML will get formulated in ComputeNode(2) before being put to MQOutput node.
There is no custom header to be added to SOAP message. Because SOAPRequest node adds the SOAP Envelope to the message automatically, I don't have to do it manually in ComputeNode(1) via ESQL. ComputeNode(1) will store MQMD of InputRoot (or Input Message to restore later while in ComputeNode(2) to generate XML msg to go to Application Output Queue.
ESQL is written in ComputeNode(1) to get the XML msg converted to SOAP msg for WS.
Quote: |
-- LOGIC BLOCK STARTS
DECLARE soapEnv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
-- Properties of input message are copied to the output message.
-- MQMD from the Input Message is Stored for later use in the Env. variable.
SET OutputRoot.Properties = InputRoot.Properties;
CREATE FIELD Environment.InputMQMD;
SET Environment.InputMQMD = InputRoot.MQMD;
-- XML to SOAP message body needs to be generated here.
/* Each Element of XML Message of InputRoot need to be directed to env.soapEnv:Body; ?
where env REFERENCE TO OutputRoot.XMLNSC.soapEnv:Envelope;
*/
-- LOGIC BLOCK ENDS
|
[ MBv8.0.0.4 is used ]
Please suggest if missing anything.
Thanks in advance. _________________ *Life will beat you down, you need to decide to fight back or leave it. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Sep 08, 2014 4:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Sounds about right...
Now go a do the following part and test:
Code: |
-- XML to SOAP message body needs to be generated here.
/* Each Element of XML Message of InputRoot need to be directed to env.soapEnv:Body; ?
where env REFERENCE TO OutputRoot.XMLNSC.soapEnv:Envelope;
*/ |
If you don't know to do the above part you need to ask for somebody local to mentor you...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
shashivarungupta |
Posted: Mon Sep 08, 2014 4:08 pm Post subject: |
|
|
 Grand Master
Joined: 24 Feb 2009 Posts: 1343 Location: Floating in space on a round rock.
|
fjb_saper wrote: |
Sounds about right...
Now go a do the following part and test:
Code: |
-- XML to SOAP message body needs to be generated here.
/* Each Element of XML Message of InputRoot need to be directed to env.soapEnv:Body; ?
where env REFERENCE TO OutputRoot.XMLNSC.soapEnv:Envelope;
*/ |
|
Code: |
SET OutputRoot.SOAP.soapEnv:Envelope.soapEnv:Body = InputRoot.XMLNSC.DETAILS;
|
I tried it out and it worked and that generates the soap message body (mandate child element), as I wanted it.  _________________ *Life will beat you down, you need to decide to fight back or leave it. |
|
Back to top |
|
 |
shashivarungupta |
Posted: Mon Sep 08, 2014 8:03 pm Post subject: |
|
|
 Grand Master
Joined: 24 Feb 2009 Posts: 1343 Location: Floating in space on a round rock.
|
As integral part of the flow (mentioned in OP) , I have the SOAP message and its Body (as mentioned in the previous post) before it hit the SOAPRequest node, but as soon as it does, it fails saying 'no SOAP.Body' and 'SOAP tree cannot be serialized'. [captured below, the ExceptionList]
Code: |
ExceptionList
RecoverableException
File:CHARACTER:F:\build\slot1\S800_P\src\DataFlowEngine\ImbDataFlowNode.cpp
Line:INTEGER:1154
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmMQInputNode
Name:CHARACTER:MechanismMFlow2#FCMComposite_1_1
Label:CHARACTER:MechanismMFlow2.MQ Input
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
Insert
Type:INTEGER:14
Text:CHARACTER:MechanismMFlow2.MQ Input
RecoverableException
File:CHARACTER:F:\build\slot1\S800_P\src\DataFlowEngine\TemplateNodes\ImbRequestTemplateNode.cpp
Line:INTEGER:532
Function:CHARACTER:ImbRequestTemplateNode::processMessageAssemblyToFailure
Type:CHARACTER:ImbRequestTemplateNode
Name:CHARACTER:MechanismMFlow2#FCMComposite_1_4
Label:CHARACTER:MechanismMFlow2.SOAP Request
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
Insert
Type:INTEGER:14
Text:CHARACTER:MechanismMFlow2.SOAP Request
RecoverableException
File:CHARACTER:F:\build\slot1\S800_P\src\WebServices\WSLibrary\ImbSOAPRequestNode.cpp
Line:INTEGER:819
Function:CHARACTER:ImbSOAPRequestNode::requestData
Type:CHARACTER:ImbRequestTemplateNode
Name:CHARACTER:MechanismMFlow2#FCMComposite_1_4
Label:CHARACTER:MechanismMFlow2.SOAP Request
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3754
Text:CHARACTER:Error occurred in ImbSOAPRequestHelper::makeSOAPRequest()
ParserException
File:CHARACTER:F:\build\slot1\S800_P\src\WebServices\WSLibrary\ImbSOAPParser.cpp
Line:INTEGER:1360
Function:CHARACTER:ImbSOAPParser::refreshBitStreamFromElementsInner
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3605
Text:CHARACTER:SOAP tree cannot be serialized
ParserException
File:CHARACTER:F:\build\slot1\S800_P\src\WebServices\WSLibrary\ImbSOAPParser.cpp
Line:INTEGER:710
Function:CHARACTER:ImbSOAPParser::refreshBitStreamFromElementsInner
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3603
Text:CHARACTER:no SOAP.Body
Insert
Type:INTEGER:5
Text:CHARACTER:SOAP.Body
|
Could you please suggest. _________________ *Life will beat you down, you need to decide to fight back or leave it. |
|
Back to top |
|
 |
mgk |
Posted: Tue Sep 09, 2014 3:07 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
The SOAP Parser Domain automatically adds the SOAP Envelope so you do not have to.
Therefore, you should just add your message body under SOAP.Body like this:
Code: |
SET OutputRoot.SOAP.Body.DETAILS = InputRoot.XMLNSC.DETAILS; |
Note that you may find there is a namespace on DETAILS that you do need to add...
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
shashivarungupta |
Posted: Tue Sep 09, 2014 5:41 pm Post subject: |
|
|
 Grand Master
Joined: 24 Feb 2009 Posts: 1343 Location: Floating in space on a round rock.
|
mgk wrote: |
The SOAP Parser Domain automatically adds the SOAP Envelope so you do not have to.
Therefore, you should just add your message body under SOAP.Body like this:
Code: |
SET OutputRoot.SOAP.Body.DETAILS = InputRoot.XMLNSC.DETAILS; |
Note that you may find there is a namespace on DETAILS that you do need to add... |
Thanks a ton !!
I've set the SOAP.Body and the necessary Namespace NameValue pair in the Context of SOAP tree, it worked well.
Code: |
DECLARE myNS NAMESPACE 'http://localhost:7800/InvokeMeSchema';
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:mNS = myNS;
SET OutputRoot.SOAP.Body.DETAILS = InputRoot.XMLNSC.DETAILS;
|
Because the input was simple XML and gottu to be converted to Soap message witth soap body (including namespaces) , I've added the custom namespace to the Context of Soap tree.
Also did play with the SOAP Envelope while Extracting it (using SOAPExtract) and generating the simple XMLNSC Message to MQ Output queue. Which is so worked well. _________________ *Life will beat you down, you need to decide to fight back or leave it. |
|
Back to top |
|
 |
|