Search code examples
tibco-business-workstibco-topictibco-designer

how to parse incoming XML file in HTTP request and generate s response based on incoming XML data in Tibco BW


I am new to TIBCO BW development. I need your expert opinion, as I am stuck to create a response XML file. Here is the scenario.

I get a XML file in the HTTP request and after parsing the incoming request XML structure, I have to create a response document which will act as a stub to the incoming request.

First I create a HTTP Receiver which will act as receiving the XML file in the HTTP request. Then I used Parse XML to parse the incoming XML document is correct or wrong. After this activity I am stuck, since I create the Render XML activity after this but it does not fetch the data even after I map the incoming request parsed by Parse XML activity, I can see during Testing time that it is getting the whole XML in the Input but even after mapping the output with input from Parsing, I get NULL values, hence facing errors.

Please let me know where I am doing wrong, or should I use any other method to catch the incoming values, such that I can create a proper response XML document to be used as Response.


Solution

  • Once you received the HTTP request, parsed the HTTP Post Data using the "Parse XML" activity, I really advice you to use a "Mapper" to map your input (received and parsed as an XML) to a XML output schema. This output can easily be returned after.

    For example,

    My HTTP client send me an XML like this enter image description here

    And I want to return an XML like this with the addition of a and b enter image description here

    The process : Process

    And the mapper

    enter image description here

    And the end, you can send the XML HTTP response like this :

    enter image description here


    EDIT (comment) : To edit the prefix namespaces in a process. You must click on the process (left hand menu) and on the bottom side, there is a button "Namespace Registry" enter image description here if you click on it you'll be able to change the prefix name. enter image description here

    But bear in mind, this kind of manipulation can break the existing mapping in the process because everything is XML based in Tibco BW.