Trading Networks 10.3 | Administering and Monitoring B2B Transactions | Integration Server Administrator's Guide | Content Handlers in Integration Server | Content Handlers for HTTP and FTP Requests
 
Content Handlers for HTTP and FTP Requests
Integration Server selects a content handler based on the content type of the request and uses the content handler to parse the content of the request.
The following table identifies which content handler Integration Server uses for incoming HTTP and FTP requests based on the registered content type.
Integration Server uses the content handler
When the content type is
To parse
ContentHandler_CGI
text/html and watt.server.default
ContentHandler is set to false
CGI content and unformatted text.
This content handler does the following:
*Decodes an incoming input stream and converts the content to key/value pairs. If the key already exists, the value is added to a list in the pipeline with the key key+list.
*Writes the key/value pair to an HTML table.
application/x-www-form-urlencoded
Name/value pairs obtained from web forms.
ContentHandler_Default
text/html and watt.server.default
ContentHandler is set to true
Input stream from an HTTP request or a document from an FTP request.
This content handler does the following:
*For HTTP requests, it passes the contents of the input stream from the HTTP request to the service specified in the submit method in an input stream named contentStream.
*For FTP requests, it passes the contents of the document from the FTP request to the service specified in the submit method in an input stream named contentStream.
*For HTTP and FTP, it writes a key/value pair to an HTML table.
ContentHandler_FlatFile
application/x-wmflatfile
Flat file content.
This content handler does the following:
*Passes the contents of the flat file to the service specified in the submit method in an input stream named ffdata.
*Returns data in an input stream or a ByteArray called ffreturn.
For information about using this content-type header, see Flat File Schema Developer’s Guide .
ContentHandler_IDAT
application/x-wmidatabin
Input stream from an HTTP request or a document from an FTP request.
This content handler does the following:
*Converts the input stream or document to an iData object.
*Converts the data to an XML representation of IData.
ContentHandler_JSON
application/json
JSON content.
Note:Integration Server supports the application/json content type only with the invoke, rest, and restv2 directives.
The behavior of this content handler is based on the setting for the watt.server.http.jsonFormat parameter.
*When set to parsed, parses JSON content into pipeline variables automatically. You can then use JSON to compose pipelines and execute existing services without calling pub.json:jsonStreamToDocument.
*When set to stream, adds the request body to the pipeline as jsonStream. The pub.json:jsonStreamToDocument service converts the jsonStream into a document (IData object) so you can use the elements from jsonStream in a flow service.
*When set to bytes, passes the incoming stream of JSON content as a byte array named jsonBytes.
Note:
For detailed information about the watt.server.http.jsonFormat parameter, see Server Configuration Parameters. For more information about the pub.json:jsonStreamToDocument service, see webMethods Integration Server Built-In Services Reference .
ContentHandler_Multipart
multipart/related
multipart/mixed
multipart/form-data
Objects that are part of related body parts. For example, an HTML web page with its related ../_graphics/is_administrators_guide_graphics/graphics files.
This content handler does the following:
*Passes the input stream to the pipeline with the key contentStream.
*Writes a key/value pair to an HTML table.
ContentHandler_RPC
application/x-wmrpc
Input stream from an HTTP request or a document from an FTP request.
This content handler does the following:
*Converts the data from an input stream to a key/ value pair.
*Writes the values as RPC encoded to the data stream.
ContentHandler_RPC2
application/x-wmrpc2
Input stream from an HTTP request or a document from an FTP request.
This content handler does the following:
*Creates an iData object from the input stream or document.
*Writes the values as RPC encoded to the data stream.
ContentHandler_SOAP
text/xml
Input stream from an HTTP request or a document from an FTP request.
This content handler does the following:
*Adds a SOAP request message to the pipeline with the key soapRequestData.
*Adds a SOAP response to the pipeline with the key soapResponseData.
application/soap
SOAP messages.
application/soap+xml
SOAP 1.2 messages serialized as XML.
ContentHandler_XML
text/xml
XML content.
application/xml
XML content.
Note:Integration Server supports the application/xml content type only with the invoke, rest, and restv2 directives.
The behavior of this content handler is based on the setting for the watt.server.coder.responseAsXML parameter. This behavior is applicable only for REST directives.
*When set to true, Integration Server receives the XML response for any REST API request in proper XML format.
*When set to false, Integration Server receives the XML response for any REST API request in converted XML format containing IData objects.
Notes:
*Other webMethods products and customer applications can register different content handlers for any of these Content-Type headers, which might change the behavior of Integration Server when Integration Server receives messages of that type. For example, Trading Networks registers its own XML content handler for text/xml. When this happens, Integration Server will use the Trading Networks content handler to process incoming XML messages.
*If the Content-Type header field specifies a content type for which no content handler has been registered, Integration Server uses the default content handler (ContentHandler_Default), which treats the content as text/html.
*If an FTP or FTPS port receives a file that does not have an extension, Integration Server uses the default content handler (ContentHandler_Default), which treats the content as text/html.
*Integration Server provides the following Java API that enables you to register your own services along with the associated coders for multipart content handler: com.wm.app.b2b.server.ServerAPI.registerCoderForMultipart(String serviceName, Class coder). You can unregister the coder using the following Java API: com.wm.app.b2b.server.ServerAPI.removeCoderForMultipart(String serviceName). If you do not register a coder or when you unregister an existing coder for a particular service, then Integration Server uses the default content handler (ContentHandler_Default) for the service.
*A web service request that specifies a content type of application/xml succeeds in versions of Integration Serverprior to version 9.12. However, the web service request fails in Integration Server version 9.12 and later. This is because prior to Integration Server 9.12, Integration Serverdid not provide out of the box support to directly handle the content type application/xml. If a content handler was not specified for application/xml, Integration Server used the default content handler. The default handling is the same as the handling of text/html, resulting in XML being placed in the pipeline as an inputStream. Beginning with version 9.12, Integration Server added a content handler named ContentHandler_XML to support the content type application/xml, resulting in the content being placed in the pipeline as an XML node. This behavior change causes the web service request to fail in version 9.12 because the web service expects an inputStream, not an XML node. To address this issue and avoid having to change the service to accept an XML node instead of an inputStream, you can use the watt.server.content.type.mappings server configuration parameter to map the application/xml content type to the text/xml content type. Integration Server will use the text/xml content handler when receiving a request that specifies a content type of application/xml. Specify the following:
watt.server.content.type.mappings=application/xml text/xml