Video Screencast Help

How to read variables sent via URL?

Created: 26 Oct 2010 | 6 comments

Hi there!

I am trying to get  workflow to use variables sent with the "GET" method.

I want to give a link to the webpage of the workflow of this kind:

http://server.com/myworkflow.asp?variable=value&variable2=value2

I want to read those variable names and values for use down the track in the workflow.

I can't find a way to do it. Is it possible?

Cheers,

Marcos

Comments 6 CommentsJump to latest comment

reecardo's picture

I'd move those querystring values to be input data to your workflow. That way they're guaranteed to be available downstream.

If thats not an option, you could try playing around with the Get HTTP Request Value component (try passing in variable/variable2 as input)

beamer7296's picture

I'm not entirely sure I understand the question, but try using the "Index Of Text Within Text" component in conjunction with the "Extract Text From Text" component to populate the variables.

reecardo's picture

I was going to suggest something liken that, as well :)

If you have the URL, split on the ? (the 2nd element is the QS)

Split that section on the ampersands (a=b, c=d, e=f, etc.)

Then loop through each if these guys and split on the equals to get key/value pairs

 

Kind of messy :)

scottwed's picture

Look for a component named something like "Get HTTP Params or Parameters".  It should do what you are describing. 

I confess, I haven't used it, so don't burn too much time figuring it out if the usage isn't obvious.  If you can't figure out it, reply back and I'll research it Friday/Monday and post an article.

Scott Wedekind

 

claus66's picture

If you want to start a workflow and pass varibles to it, all you need is to configure the primary models input data:

  

Add the variables you need and call your published workflow like this:

http://workflowserver.com/workflowname/?var1=val1&...

Aaron - WEVO Group's picture

You have several options, but the correct options depends on your setup.  Basically it comes down to if you are publishing as a Webservice or a Form Start.

 

1) Webservice - if you are using a Workflow type project, and publishing it as a webservice you will have to set the input variables as previously mentioned.  Once doing this, when you create the connector to the webservice it will automatically recognize the input variables and will transfer that information using standard SOAP, which is not included in the URL. If you are not publishing as a Form Start this is the recommended way to pass input variables.

 

2) Form Start - this is the case if you are using a WebForms type project, or a Workflow type project that is published as a Form Start.  Again you must first setup the input variables as mentioned above. Next, you must set the project to allow HTTP POST.  In the web.config file you will need to add the following lines:

 

 

<configuration>

    <system.web>

    <webServices>

        <protocols>

            <add name="HttpGet"/>

            <add name="HttpPost"/>

        </protocols>

    </webServices>

    </system.web>

</configuration>

 

Once this is added, you will be able to pass input variables with the URL as you have shown above.  Its worth noting that this is one of the few instances where a URL is case sensitive, and your variable names must be exact.

 

Cheers,

 

Aaron Weisser

Partner - Consulting & Development

WEVO Group

www.WEVOGroup.com