Request/Response Structures
This section of the dialog enables you to select the request and response structures of your Web service call. When you call Web services that expect content in the body part of the request message or return content in the body part of the response message, you can set request and response structures to be any of the following:
•No structure
•XML
•JSON
Note: | In Web service calls created with MapForce, you can use standard JSON as request or response structure; JSON Lines or JSON5 structures are not supported. |
The structure selected here determines the mappable items that appear on the mapping as children of the Body item.
Request structure
To define the request structure of your Web service call, navigate to the Structures section of Web Service Call Settings dialog and click Edit next to the Request field. This opens the Request Structure dialog (screenshot below). Alternatively, you can open the Request Structure dialog, by clicking the button in the request part of the Web service component in your mapping.
Structure type
After you have opened the Request Structure dialog, select one of the following options in the Structure Type section:
•If the Web service expects no content in the body part, or if you would like to provide the raw body (MIME entity) directly from the mapping, select No structure.
•For XML, obtain the XML or DTD schema of the request from the provider of the Web service. If you select an XML instance file, it must have a valid schema reference. Some XML schemas define elements with global declaration (that is, elements whose parent is the schema element). For such schemas, you can choose what element in the schema should be the root element of the mapping structure in MapForce. To do this, click Choose, and then, in the dialog box that appears, select the desired root element.
•For JSON, obtain the JSON schema of the request from the provider of the Web service or generate it from a sample JSON file with a tool such as Altova XMLSpy.
•For Protocol Buffers, obtain from the Web service provider the .proto file describing the binary file and then click Browse to select the file. The Root Message Type field is relevant when the Protocol Buffers file contains multiple message types. Click Choose to select the message type that should be at the structure's root.
Tip: | If you have a sample XML or JSON request file but do not have a schema file, you can use Altova XMLSpy to generate the schema file. If necessary, XMLSpy can also convert your instance file from XML to JSON, or vice versa. |
Override content type
Optionally, select the Override content type check box if you need to override the Content-Type header set implicitly by MapForce. You can also enter parameters after the content type, for example, Content-Type: text/html; charset=utf-8.
Response structure
To define the response structure of your Web service call, navigate to the Structures section of Web Service Call Settings dialog and click Edit next to the Response field. This opens the Response Structure dialog (screenshot below). Alternatively, you can open the Request Structure dialog, by clicking the button in the response part of the Web service component in your mapping.
Structure type
After you have opened the Request Structure dialog, you need to select one of the options in the Structure Type section. If the Web service returns no content in the body part, or if you would like to process the raw body (MIME entity) directly from the mapping, select No structure. For information about the other options available in this section of the dialog, see Structure Type in the Request Structure subsection above.
Content type and HTTP status
Optionally, fill the Content type and HTTP status text boxes (screenshot below) if you need to filter a response MIME entity by media (content) type and HTTP status code. This is useful if you need conditional handling depending on the HTTP status code and the content type returned by the Web service call. For an example, see Error Handling in HTTP APIs.
By default, the Content type filter is set to */*, which matches all media types. The default HTTP status codes are 200-299. If the Web service call returns some other status code that is not handled explicitly, the mapping execution will fail with an error.
Note
When you save the mapping, any absolute paths in the Request/Response Structure dialog box will become relative to the mapping design file (.mfd) if the check box Save all file paths relative to mfd is selected in component settings. |