Using TN as request/Reply, and get response back to calling flow.

Hi,

Please help on how to Use TN for a Request Reply mechanism.

I have Flow Service A, that needs to submit a document to TN, which triggers a Processing Rule to invoke service B.

I want the output/Response parameter “Response” from service B, back to the flow of serviceA.

Service A
Get Xml
Extracts EDI doc
Submits to TN using wm.tn:receive
Map Step, waiting for response…

Service B
Extracts EDI
Maps to Web Service.
Gets response from Ws
Maps response to EDI
converts to XML String “Response”

I need this “Response” in service A. Please help.

You can try using java service doInvoke or something sort of to get the entire pipeline output response signature from service B to A instead of having processing rule based invoke:

HTH,
RMG

Thanks,

But I have to Us TN, to identify the EDI document. As the XML can contain different type of EDI’s.

So once submitted to TN, TN will identify the Processing service, and will identify the processing service. I just need to bring the response of processing service back to Service A(Submitter)

In that case create TN handler service and it will receive EDIdata and explicitly do invokes service B using Java based Invoke method and extract the pipeline output to A…so just make sure the Invoke returns the pipeline values as expected.

HTH,
RMG

As long as the processing rule is synchronous, whatever is placed in the pipeline by Service B will be available to Service A after the call to wm.tn:receive returns. You don’t need to call Service B directly and you definitely do not need to use Java.

Thanks Reamon

I tried that. But it is not bringing the output of service B to Service A

  1. Set processing rule to execute service synchronous.

  2. Then I tried setting TN_clearTNObjects = false.

Either did not bring back any output of Service B to A… is there any other settings needs to be done?

Do I need to do anything at the end of service B (Processing Service) to make the variables available to service A.

I believe JS invoke does help returns the pipeline and I don’t think synchronous will help get the entire/expected pipeline returns to B…

There is nothing wrong to test using java invoke I would say:

Just my thoughts!

HTH,
RMG

This will not work her, as this is EDI processing, so Service A publist to TN can be routed to Service B or C or D, depending on EDI DocType…

But all of them will have same output signature, to send response back…

Eg: EDI270 → service B
EDI276 → service C…etc…

It’s been a number of years but I have indeed done this in the past. In Developer you won’t see the vars. At run-time, they should be there. Have you done a save pipeline to see?

My suggestion is also uses TN only but only difference is instead of calling service B directly it calls generic handler handler service (say processInbound) that does the actual do Invokes svc B,C etc…based on the transaction X12/type/version from your table.

Sorry If this design still does’t work for you:

HTH,
RMG

Same issue will be here to, as the handler service (say processInbound) will bring the response back from service B, C, D… in pipeline, but how to bring that response back to service A…

My Scenerio is

Client submits edi in XML → ServiceA → submits EDI to TN → Processing rule invokes Service B,C, D to get response back from backend system.

how do I get the response back to Service A , so I can send it back to Client? on a sync call.

Have you done a savePipeline to see if the vars are in the pipeline after the receive call?

Even though its a synchronous call how would you get response back like similar to http and setResponse calls:

TN isn’t request/reply for processing data we sent internally in your example service A (submitted EDI to TN and not exactly received from externally via http to receive/handler service) and you sent synchronous response back:

HTH,
RMG

yes, I tried doing savePipeline, but var are not being returned to the Caller service by TN.

Hello Reamon,

With your solution I went a step further. but still issue.

When I submit the data to TN (wm.tn:receive) as a node, it does return the outputs back.

But when I submit the data to TN as a stream, it does not return the outputs back…

As I have to submit EDI, I have to submit is as stream instead of Node.

Any suggessions on how to handle this?

It shouldn’t be submit as stream to tn:receive…it must be node only…except if you are using flat file routing (routeFlatfile call work with streams)

HTH,
RMG

Make sure all the EDI-related rules are sync.

But it may be that for EDI this isn’t possible/advisable (my earlier work with returning pipeline vars wasn’t for EDI). The splitting of the envelopes may kick off threads. You may be stuck. If threads are used and you cannot control them via the rules, then you won’t be able to pass a synchronous response back.

Hi,

Has anybody found the way how to do this? I tried wm.tn:receive I could not get response from the processing rule service. Can you please help?

Thanks,

Not sure if this will fit your scenario, but we have a similar requirement in which B2B Service A processes an EDI document in TN, publishing a canonical, which is subscribed and processed by a service on the EAI server (Service B). At the conclusion of Service B, a canonical called TNDocumentStatus is published. B2B server subscribes to TNDocumentStatus and updates the User Status in the related TN EDI document with the status value from Service B.

If you are not using pub/sub, perhaps you could create a custom flat file or XML document type in TN (called something like TN Document Status that contains the Response from Service B and values necessary to identify the original EDI document in TN) and Service B could generate TN documents of that type. The processing rule for that document type could invoke a service that updates the User Status (or custom doc attributes) for the related EDI document.

-Mary