Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to return a html repsonse after form guide rendering in browser?

rohsin47
Level 2
Level 2

How to return a html repsonse after form guide rendering in browser indicating that server has recieved transmission and request is submitted succesfuly?

I am rendering the form guide in browser using guide invoke service and when i submit the data in browser to server through guide , it is displaying some random number in browser?

i need to display a resposne that request is submitted successfully?

0 Replies
Jasmin_Charbonn
Level 10
Level 10

Make sure the process that the guide submits to has an output variable of type document. Then populate that variable with html data.

Jasmi

rohsin47
Level 2
Level 2

Thanks a lot Jasmi for your reply. But i m still not able to achive the desired result.

how could i define a variable with "html data" ? do i have to import html page into my LC application and then attach the page to the varibale , or is there any other way?

Also, one more doubt where should i use this variable in my process to get the same?

Let me elaborate my application. that might helpful for you. I have two processes, one guide, one form and some other assets, Now my first process is just a guide invoke process which involves guide rendering as html in browser. and other second process is the main proocess which is processing the data captured via guide in browser.

Now my Front end UI is calling the first process through a REST endpoint and opening the guide to let user enters the data in a step by step process. After user press the submit button in guide to submit the order, it is displaying some random number in browser. which i m not able to control. I want here to display a message " that order is submiitted succesfully.

Jasmin_Charbonn
Level 10
Level 10

how could i define a variable with "html data" ?

Create a variable of type document and then a service to read the html from where ever it's located. If you put it in LiveCycle, you can use the ReadRessource service. If it's on the file system, you can use the Read Document. If it's in the database, you can use the JDBC service.

Also, one more doubt where should i use this variable in my process to get the same?

You want the response once you've submitted the data, so the html is really the result of calling the process that's processing the data. So I would create an output variable of type document on that process.

Right now it displays a random number in the browser because your submit process is long lived. When a process is long lived (asynchronous), you invoke it and then you get an identifier back. It's kind of a fire and forget. You can use that identifier to check the status of the long lived process, since long lived processes can take hours, days to complete. You don't want your browser to wait that long, hence the identifier.

However if you change the process to be short lived (synchronous), the browser will wait for the result of the process, which really means the output variables for that process. If your output variable contains html, it'll display html.

So the key is make you submit process short lived and populate the output variables appropriately.

Jasmin

Jasmin_Charbonn
Level 10
Level 10

Something's wrong with the forum. I'm pasting your post here again.

Thanks a lot Jasmi for your reply. But i m still not able to achive the desired result.

how could i define a variable with "html data" ? do i have to import html page into my LC application and then attach the page to the varibale , or is there any other way?

Also, one more doubt where should i use this variable in my process to get the same?

Let me elaborate my application. that might helpful for you. I have two processes, one guide, one form and some other assets, Now my first process is just a guide invoke process which involves guide rendering as html in browser. and other second process is the main proocess which is processing the data captured via guide in browser.

Now my Front end UI is calling the first process through a REST endpoint and opening the guide to let user enters the data in a step by step process. After user press the submit button in guide to submit the order, it is displaying some random number in browser. which i m not able to control. I want here to display a message " that order is submiitted succesfully.

Jasmin_Charbonn
Level 10
Level 10

how could i define a variable with "html data" ?

Create a variable of type document and then a service to read the html from where ever it's located. If you put it in LiveCycle, you can use the ReadRessource service. If it's on the file system, you can use the Read Document. If it's in the database, you can use the JDBC service.

Also, one more doubt where should i use this variable in my process to get the same?

You want the response once you've submitted the data, so the html is really the result of calling the process that's processing the data. So I would create an output variable of type document on that process.

Right now it displays a random number in the browser because your submit process is long lived. When a process is long lived (asynchronous), you invoke it and then you get an identifier back. It's kind of a fire and forget. You can use that identifier to check the status of the long lived process, since long lived processes can take hours, days to complete. You don't want your browser to wait that long, hence the identifier.

However if you change the process to be short lived (synchronous), the browser will wait for the result of the process, which really means the output variables for that process. If your output variable contains html, it'll display html.

So the key is make you submit process short lived and populate the output variables appropriately.

Jasmin

rohsin47
Level 2
Level 2

Create a variable of type document and then a service to read the html from where ever it's located.

that i can do and it will have a html output stored in variable , but how would i display that variable output in a browser to a user?

if you change the process to be short lived (synchronous), the browser will wait for the result of the process, which really means the output variables for that process. If your output variable contains html, it will display html.

Now here i got why it is displaying random number and what is its significance but i can't change my process to short live as it contains task assignments to certain people . So, what is the other way around?

Jasmin_Charbonn
Level 10
Level 10

that i can do and it will have a html output stored in variable , but how would i display that variable output in a browser to a user?

A process is like a service. When you call it you get a response (output variables). The browser is going to try to display the output variable a best it can. If it's html, the it shouldn't have any problem displaying the result from the process.

Now here i got why it is displaying random number and what is its  significance but i can't change my process to short live as it contains  task assignments to certain people . So, what is the other way around?

If you want a response, you'll have to call a short lived process. You could call a short lived process to receive your submission and return html, then use the WebService service to invoke a long lived process to do the user assignment.

Jasmin

rohsin47
Level 2
Level 2

Hi Jasmin,

thanks for your prompt replies.

Now i m able to display the message by defining a third process(short-lived) in between which is dispalying the html repsone to the user after guide submission.

But now i  have another problem,

let me expalin what is happening. first process is invoking guide and rendering it in browser to let user enter the data.

second process is displaying the resposne to the user after guide submisison. Now my problem is how to drive contrl to third process here which is processing the user data.

as you have suggested, i have tried to invoke it via web service soap endpoint after putting the wsdl in request, but it is throwing exception and asking for soap request.

and secondly, i don't think its a good idea to use web services here as the service deployed(third process) is not returning any response.

So, could you tell me any other way around?

Jasmin_Charbonn
Level 10
Level 10

I still think web service is the way to go.

Other than that you can create a custom component that will invoke the process through the java api, or write a custom component that will invoke it using REST.

Now back to the web service. When you configure it, make sure to use the invoke_asynch instead of invoke. That way it'll call it and not wait for a response.

Then on the Request tab, click on the Generate button for the SOAP Request to generate a sample request message. You might also want to click on Remove'?' to remove the '?' from the request if you're not replacing them with actual values.

Jasmin

rohsin47
Level 2
Level 2

i have one question here.

how do i configure the soap endpoint from invoke to invoke_asynch? as when i m trying to test it , it is sending in the resposne as process can not be invoked synchronously.

Jasmin_Charbonn
Level 10
Level 10

You don't change the endpoint.

When you create a process you automatically get a SOAP endpoint. The soap endpoint comes with 5 different methods: Invoke, Invoke_Async, Invoke_Dispose, Invoke_Result and Invoke_Status.

You can any of the operation. You would need to specify the operation with the client you're using to make the web service call.

How are you testing it?

Jasmin

rohsin47
Level 2
Level 2

Hi jasmine,

As per your suggestion,

"If you want a response, you'll have to call a short lived process. You could call a short lived process to receive your submission and return html, then use the WebService service to invoke a long lived process to do the user assignment"

My current process which i have made short lived to return a response is having only one soap method - "invoke". So, to get those soap endpoint methods, i have to define a process as long lived and then invoke the webservice as invoke_asynch. But then i won't able to return a response as process will be no more short lived.

so, do i have to define one more process just to invoke web service as long lived, or is there any other way for so?

Jasmin_Charbonn
Level 10
Level 10

Let's say you have two processes.

1- Calling process

This is the process that contains the web service and is short lived.

2- Other process

This is the process that has to be long lived because it contains User steps.

When you use the Web Service service you can use either invoke or invoke_async. This is just the method the web service is going to call the the #2 process.

If you use invoke, the web service step will wait for #2 to complete before getting a response. Therefore if #1 is short lived (meaning it returns a value when all steps are completed), it might take a while before it completes because it will have to wait for #2 to complete (and other steps).

Now if you use invoke_async, it will call #2 and then get a response right away. which means your process #1 will terminate in a decent time.

You don't' have to make the #1 process long lived because you use the invoke_async operation.

You should only need two processes.

Jasmin

rohsin47
Level 2
Level 2

Hi Jasmin,

thanks again and lot for your swift replies.

now lets go through your way and i tried to explain my problem.

1- Calling process

This is the process that contains the web service and is short lived.

2- Other process

This is the process that has to be long lived beacuse it contains user steps.

Process 1 is returning a response and then as well using web service to invoke Process 2. this is the scenario. so, now when i tried to test the web service. it is throwing exception as:

<faultcode>soapenv:Server.userException</faultcode>
<faultstring>ALC-DSC-127-000: com.adobe.idp.dsc.LongLivedInvocationException: The Long Lived Service ./././..process 2 can not be invoked synchronously.</faultstring>

so, that means i have to invoke Process 2 asynchronously as it is longlived, there is no other option. and to do that i need to invoke webservice using "invoke_async" method.

But here comes the problem , Process 1 is short lived as it has to return a response and so have only method "invoke" in web services soap endpoint method.

Now, how could i use here invoke_async method to invoke Process 2? or is there any other way to do that?

Jasmin_Charbonn
Level 10
Level 10

We're going to get there!!!

You're right when you say that you have to call Process 2 using invoke_asyn because it's long lived.

Now let's understand what Process 1 (short lived) will do.

1- You're going to invoke Process 1 synchronously using invoke because it's short lived.

2- It will execute all the steps.

3- When it gets to the web service step, it'll invoke the web service using invoke_async, and that step WILL receive a response immediately. You will get back an invocation id. Then as far as this step is concerned, it's completed.

4- Then it'll go to whatever steps you have left and complete the process and return the response back to the caller.

I think you're getting confused with using invoke_asyn in a short lived process. But it doesn't matter because you'll get a response from that step (invocation id)  and  you'll be able to complete the rest of your process. You're ont wainting for the long lived process to complete.

I hope this clarifies it.

I'm not sure how else to explain it .

Jasmin

rohsin47
Level 2
Level 2

Jasmin,

when you said that in step 3,

When it gets to the web service step, it'll invoke the web service using invoke_async, and that step WILL receive a response immediately.

I want to tell you , this is not gonna happen, it will throw an exception, because,as i had told earlier,

In short lived process, you will get only one operation method and i.e invoke( invoke synchronoulsy) ,    not other ones, invoke_async, invoke_dispose, invoke_result and invoke_status. These one you will get only when your process is long lived.

so, let's say if i change my process to long lived, then i won't able to return a response. So.how do i both invoke web service asynchronoulsy as well as return a response in the same process.

Hope you got what i wanted to say.

thanks

Jasmin_Charbonn
Level 10
Level 10

"I want to tell you , this is not gonna happen, it will throw an exception, because,as i had told earlier, In short lived process, you will get only one operation method and i.e invoke( invoke synchronoulsy) ,"

The process you're trying to call from the short lived process using the web service IS long lived. Therefore the web service operation WILL show you the four operations. The web service doesn't care in which process it's being used.

In your case you use the web service operation in a short lived process to call a long lived process. So again the web service operation will show you the 4 operations.

I honestly would like to help you more but I honestly don't know how else to explain it. If you don't understand again, I suggest you call support to talk to someone one the phone.

The only thing I can tell you is that I did the exact same thing a few weeks ago and it worked, so I know this is definitely possible,

Good luck.

Jasmin

rohsin47
Level 2
Level 2

Hi jasmine,

thanks and sorry for troubling you again.

i got that problem resolved now. I don't know why its is not showing earlier but after changing short to long and then back to short and then wsdl loading it started showing invoke_async.

so, now its better now. as it is delivering a response and invoking the other process (containing user steps) through web service absolutely fine.

but now , i have another problem, as when web service call happened, it is not delivering guide ouput to the process(containing user steps). when i check the input to the process, it is showing as empty parameters.so that means i have to catch guide output xml on fly to attach it to the web service request.

i tried to do this by defining a output variable (xml type) in the process containng web service invoke. but here it failed again.

So, if you could suggest me a possible way around to achieve this.

and yes, i m really vry very thankful for all your answers till now.

rohsin47
Level 2
Level 2

Hi jasmin,

i hope you get my question.

I just wanted to know , if you could suggest a way to bind the guide output xml to web service request?

Plz let me know if you want to know more in this regard?

thanks in advance.

Jasmin_Charbonn
Level 10
Level 10

I'm going away on vacation for two weeks, so hopefully you'll be able to make sense of this.

First the output variable has nothing to do with it. The output/input variables only affect the input/output parameters of the entire process. Basically what you're going to pass to the process and what the process is going to return.

Now in your long lived process, it look like you have an input parameter of type XML.

I see two ways to pass your XML in.

1- Convert the XML into a base64 encoded string and change your input variable to a string. You'll have to decode the string back in the long lived process. LiveCycle has built-in function (in xPath) to do that.

2- Pass your xml variable as an attachment to the SOAP request in a document variable. The reason we put it in an document variable is to avoid having xml (data) witinh xml (soap request). Otherwise you would need to wrap it between CData tags.

In both cases, what you need to do is select the Generate Request button (and check Show Optional Parameter option).

If you use a string, you need to replace the  ? with the xPath expression that contains the encoded xml string.

If you use a document variable, it will fill the attachment id with a guid. Then you go on the Attachment tab, and associate the xPath expression for the document variable to the GUID that's in the SOAP request.

I'm writing this all from memory because my servers are down. So excuse me if the terminology is not exactly the same.

Jasmin