IS web redirection possible from browse invoked service

Want to redirect page to a url after the service completes (passin output from service as parameter to the url)

Appreciate help- from people already familiar with this.
Thanks,

Could your output template just include a <HEAD> and some <META> to redirect?

Something like the following may work:

<HTML>
<HEAD>
<TITLE>Your title</TITLE>
<META HTTP-EQUIV=Refresh CONTENT=“0; URL=URL TO REDIRECT TO”>
</HEAD>
<BODY></BODY>
</HTML>

Good idea , thanks but can I dynamically pass the data from flow as parameter to the URL. Because I guess output templates are prebuilt files… which means the META URL “has” to be prebuilt too…
isn’t it?
Thanks,
LC

You can pass dynamic information to the template. Just use

URL=%value url%

and then the redirect URL to the url pipeline variable in your flow.

Thats nice to know. I didnt know that output templates accept variable substitutions,
Thanks!!!
LC

Tried this, but it would have been very neat if there existed a way to call the URL directly instead of having to redirect to it…the small refresh delay is unavoidable in the case of redirection…

You could do a call to pub.client:http to the URL that you would redirect to and then call pub.flow:setResponse to override the return of the service with the result from the redirect URL.

Following up on this thread…

Can IS 4.6 issue an HTTP redirect?

ie: In the HTTP exchange below, can IS 4.6 set the “Location:…” response header?


POST /invoke/test HTTP/1.0

HTTP/1.1 302 Found
Location: http://www/login?ticket=83298589822536
Date: Wed, 18 Jun 2003 00:39:35 GMT
Content-Type: text/html


The pub.flow:setResponse service doesn’t seem useful.
There is a HTTP response header object in the server’s Java API:
com.wm.net.HttpHeader header = Service.getHttpResponseHeader(…)
We can use this method to set the HTTP response status:
header.setResponse(302, “Found”);
However, this only sets the response status line, not the “Location” response header line below it.

We’ve got to use an HTTP redirect since we’re implementing the OCI/Roundtrip standard which requires a redirect – but we can’t be sure user’s browsers will obey HTTP meta-tags (<meta>) or Javascript location directives (doc.location="…").

  • Sonam

Sonam,

You can use header.setField(fieldName, fieldValue) to set any field on the response header.

Rupinder

Thanks Rupinder. I just got the same answer from WM Support too.

The com.wm.net.HttpHeader class in the IS Server Java API is undocumented. Here’s what I know about three methods in that class:


// Set HTTP response code
setResponseCode(ResponseCode_Integer);
// Set HTTP response code with reason phrase
setResponseCode(ResponseCode_Integer, ResponseReasonPhrase_String);
//Add HTTP response field.
addField(HeaderFieldName_String, HeaderFieldValue_String);


So the following code in a Java service redirects HTTP invokes of that service to yahoo.com:


com.wm.net.HttpHeader h = Service.getHttpResponseHeader(null);
h.setResponse(302, “Found”);
h.addField(“Location”, “http://yahoo.com”);


Sorry, in my post above, the following method:
setResponseCode
(ResponseCode_Integer, ResponseReasonPhrase_String)

…should really have been:
setResponse
(ResponseCode_Integer, ResponseReasonPhrase_String)