When a file is submitted to a service, webmethods determines the mime type (in the HTTP header) and invokes the appropriate content handler. How? In order to handle non-xml files, you register the content handler you wrote (see below) with webmethods mapped to a particular mime-type. I basically write a one line java service and set it as a startup service (ServerAPI.registerContentHandler(“text/plain”, new MimeContentHandler());). This will make the service startup when you start the b2b server.
The actual content handler is a java class (not a service) that you put into the ‘classes’ directory in the same package as the startup service. It implements the ContentHandler interface. So when a file is submitted with a mime type of “text/plain”, webmethods looks at it’s registered handlers and invokes the appropriate one before your b2b service is invoked. The default handler in webmethods is that text/xml files are parsed into a node, so your service can expect a node as an input value.
To make the service a startup service, go into your B2B Integrator, click on
the package where the service is located, at the bottom, click on the
“Startup/Shutdown/Replication Services” tab. At the top (in the Startup
services section), move the service over to the “Selected
services” side. You’re all set.
Digital Oilfield Inc.