Server modules

Did I mention that the Lansa documentation is incomplete?

Problem: Create a simple server module to accept a bit of data and simply reply with a string. Let that data be set with querystring parameters.

If I wanted to send the data as parameters in a POST request I would just do this:

POST to http://[DOMAIN/BASEPATH]/w=[WEBROUTINE]&r=[SRVROUTINE]&vlweb=1&part=[PARTITION]&lang=[LANGUAGE]

with, for instance,

FIELD1=DATA1&FIELD2=DATA2

But if the client expects to be able to send the data as part of the querystring, in a GET request, I need to do this:

GET to http://[DOMAIN/BASEPATH]/w=[WEBROUTINE]&r=[SRVROUTINE]&vlweb=1&part=[PARTITION]&lang=[LANGUAGE]&f(FIELD1)=DATA1&f(FIELD2)=DATA2

I could not find that f(…) trick, putting the parameters inside the parentheses, in the documentation but a very lucky search on the forum helped me.

My sample server module looks like this:

Begin_Com Role(*EXTENDS #PRIM_SRVM)

Define Field(#PROC_OUTPUT) Type(*string) Length(65535)

Srvroutine Name(DATA) Response(#RESPONSE)
  Field_Map For(*INPUT) Field(#FIELD1)
  Field_Map For(*INPUT) Field(#FIELD2)
  * do something with FIELD1 and FIELD2 here
  #PROC_OUTPUT := "Done"
  #RESPONSE.ContentString := #PROC_OUTPUT
Endroutine

End_Com

 

 

One thought on “Server modules

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s