Expand my Community achievements bar.

SOLVED

get datas from temp schema in different workflow

Avatar

Level 1

Hello,

I'm creating a web service SOAP in adobe campaign that can be called by a tier application.

I want this web service to call a workflow and get the result of datas from this workflow.

My workflow looks like this :

Start -> signal -> query -> enrichment -> javascript

I tried in the javascript web service to select datas from the enrichment temporary table. But it does not work.

Here is the error when i'm trying a select querydef in the javascript web service :

The temporary 'temp:enrich_broadlog' schema is not defined in the current contex

I checked the name of temporary schema and set the javascript in pause to prevent purge. It is the right one. But I can't manage to retrieve any data from it.

I guess that I can't get datas from a temporary schema if the javascript execution is not from this workflow.

My only solution is to store data in a ftp file and do more process. But I'd like to know if is it possible to get workflow datas directly by calling the workflow by the web service.

Thank you for your help.

1 Accepted Solution

Avatar

Correct answer by
Level 10

To my mind, it could not work from the external jsSoap.js because through soaprouter.jsp you can accede only to schemas defined, with WSDL definition. And temp:enrich_broadlog doesn't have such a WSDL definition.

So I suggest you to:

  1. extend the target dimension factory schema (I guess it is nms:delivery?) with some elements or attributes, for instance cus:delivery.wfkStatut
  2. in the workflow, use save entity method to store the status value in wkfStatut element or attribute after your JS activity jsWkf
  3. so within the jsSoap.js thanks to the WSDL knows this element/attribute and gets the value.


Alternative way: instead of extending a factory schema, create a custom schema if it is more convenient for you.

Additional tip/improvement: you can define a specific method in the extended schema/custom schema (the web method code being in Administration>Settings>Javascript code node) in order to do some actions inside the AC side instead of client side (the jsSoap.js) and so hiding the business rules /actions to make on AC side.

Regards
J-Serge

View solution in original post

5 Replies

Avatar

Level 10

Hi,

I'm not sure I understand the JavaScript part. You first say that you have a JavaScript activity in your workflow, then you mention the JS execution is not from this workflow. Can you give more precisions about this?

Florent

Avatar

Level 10

Hi Sakadam,

Moreover, may you tell if you run a queryDef in the Javascript of your workflow to retrieve the temp:enrich data?

As several posts related to workflow query/enrichment activities mentioned, you can't accede directly to your xml context but must run a queryDef, because query/enrichment elements (targetData) are only made for delivery activity or standard activity access, and not accessible directly from the context (it is different from webApp).

See 2 posts mentioning it:

Re: About get the result of Query Activity from JavaScript Activity in a workflow

Re: Update instance variable with target data field.

Re: Access to targetData and recipients from Delivery Script

So please confirm that it is this data set that your try to accede from your external call.

Regards
J-Serge

Avatar

Level 1

Hi, thank you for your reply.

Sorry I was not clear.

Tier service :

=> Javascript : we can call it 'JsTier.js' for example

Web service soap :

=> Javascript : jsSoap.js

Workflow :

=> Javascript : jsWkf.js => not a file, directly in workflow

So here how it works :

1) JsTier.js call soap service in jsSoap.js.

2) jsSoap.js launch signal to workflow and wait until workflow end.

3) workflow go to query > enrich (the value would be @statut for example) > jsWkf.js.

4) jsWkf.js change the value of @statut via queryDef in enrich temporary schema

Here is what I want to do :

5) jsSoap.js still waiting then retrieve @statut value by querydef in the enrich temporary schema (not purged yet). And return the value to jsTier.js.

But I get the error : The temporary 'temp:enrich_broadlog' schema is not defined in the current context

I saw post about queryDef in temporary, I think this is what i am trying to do. But I am calling a queryDef to a temporary schema from a javascript file that is not in the workflow.

I am not sure if the schema is in the same context because i am trying to access a temporary schema from a separate javascript.

Avatar

Correct answer by
Level 10

To my mind, it could not work from the external jsSoap.js because through soaprouter.jsp you can accede only to schemas defined, with WSDL definition. And temp:enrich_broadlog doesn't have such a WSDL definition.

So I suggest you to:

  1. extend the target dimension factory schema (I guess it is nms:delivery?) with some elements or attributes, for instance cus:delivery.wfkStatut
  2. in the workflow, use save entity method to store the status value in wkfStatut element or attribute after your JS activity jsWkf
  3. so within the jsSoap.js thanks to the WSDL knows this element/attribute and gets the value.


Alternative way: instead of extending a factory schema, create a custom schema if it is more convenient for you.

Additional tip/improvement: you can define a specific method in the extended schema/custom schema (the web method code being in Administration>Settings>Javascript code node) in order to do some actions inside the AC side instead of client side (the jsSoap.js) and so hiding the business rules /actions to make on AC side.

Regards
J-Serge

Avatar

Level 1

I didn't want to modify any attributes or elements in the schema but seems that I have to.

Thank you for your clarification.