HTTP (Magic xpi 4.9)
The HTTP component allows the Magic xpi Server to send and receive HTTP requests from a Web server. The HTTP component is used in two ways:
|
To use the HTTP component with a proxy server, create these entries in the [MAGIC_ENV] section of the Magic.ini file:
A Web server is required for triggering execution of Magic xpi flows via HTTP calls.
The proxy server address should be set only if you are using a proxy server.
|
As a step in a flow: The HTTP component is used to send and receive information using various HTTP methods. The HTTP component supports the Get, Post, and Rest HTTP methods. When you select the Post or Get operations, you must specify a URL. The HTTP component will request that the server carry out your request to the requested URL.
-
In the Get method, the requested URL is retrieved and sent back to the requester. The requested information is returned in the User BLOB.
-
In the Post method, the component will post information to the indicated URL. This method is often used to post information to a use bulletin board add a file to a directory. You must also specify header information when using this method.
-
In the Rest Method, an HTTP request is executed and the results are returned.
As a trigger component: The HTTP trigger component is used to trigger a flow and also allows passing parameters through the Web. A flow is triggered when the HTTP component receives a request from the Web. The request is sent in a specific syntax and includes the arguments and parameters that are to be updated.
You can define the underlying infrastructure using the HTTP Framework setting.
To fetch the HTTP request body:
-
Ensure that the <Magic xpi installation>/Runtime/scripts/config/mgreq.ini file's HttpVars entry is enabled and that it contains MG_POST_BODY.
-
In the flow, the C.HTTP_Body context variable will hold the HTTP body content when the flow is invoked by the HTTP trigger.
| There is a difference in behavior between the IIS-based Web requester and the Java-based Web requester hosted with Apache. When submitting a form to the Web requester, in the Java Web requester, you will get all of the form parameters. But, the C.HTTP_Body variable will be empty regardless of the settings explained in the steps above. In IIS, both the form parameters and the row HTTP request body are received. |
|
There is a sample project available for this component. You can find the sample project at: <Magic xpi installation>\Extra\SampleProjects
|
HTTP – Configuration
HTTP – Error Codes