Defining the Request Structure

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Calling Web Services > Adding a Web Service Call (REST-Style) >

Defining the Request Structure

When calling Web services that expect content in the body part of the request message, you can set the request structure to be one of the following:

 

No structure
XML
JSON
Protocol Buffers files, see Protocol Buffers

 

The structure selected here determines the mappable items that appear on the mapping as children of the Body mf_ic_body item.

 

 

To define the request structure:

1.Open the Web Service Call Settings dialog box (see Web Service Call Settings).
2.Under Service Definition, select Manual.
3.Under Structures, click Edit next to Request.

mf_ws_request_structure_dialog

Tip:As a shortcut to display this dialog box, click the excel1-compicon button in the request part of the Web service component on the mapping.

 

4.Select one of the following options:

 

a) 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.

 

b) 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.

 

c) 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 XMLSpy.

 

Tip:If you have a sample XML or JSON request file but don't have a schema file, you can use XMLSpy to generate the schema file. If necessary, XMLSpy can also convert your instance file from XML to JSON, or vice versa.

 

b) For Protocol Buffers files, 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 applicable if the Protocol Buffers file contains multiple message types. Click Choose to select the message type that should be at the structure's root.

 

5.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.

 

When you save the mapping, any absolute paths on this 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, see Web Service Call Settings.


© 2019 Altova GmbH