5.17 XMLBindFileService
The XMLBindFileService is designed to make the job of reading data from XML documents into applications and the creation of XML documents by applications simple. This is one of several services that are designed to consume the classes generated from the XML Binding Wizard (a feature of the LANSA Integrator Studio), so the use of LANSA Integrator Studio is a key part of the XMLBindFileService.
It is important to note that this service uses these bindings created with LANSA Integrator Studio and not XSL stylesheets. Because of this, this service is far simpler to use than using one of the services that requires an XSL stylesheet, so in general you would use this over the other options.
So, for example, if you receive an order in XML format into a directory on your server, the XMLBindFileService could be used to read the order data in the XML document, convert the data to fields inside your program, from which the program can then process the data as required. Alternatively, your application might be the one that needs to create an order to be sent to a supplier. In which case your application would prepare the data required for the order then use the XMLBindFileService to create the XML document.
It is important to be aware that the XMLBindFileService is not responsible for the transportation of the XML file between the client and the server. In the event of using it to READ an XML file into a program, it assumes that the file is already there. If you are receiving an XML document then it is generally the sender's responsibility to send the file to you, though you will of course need to tell them how and where to do that. Having said this, there may be times when you may need to 'pull' the XML document from another location to your server for a READ into your application. When this service is used to WRITE, or create, an XML document it is not concerned with how, when or where it is delivered to the recipient. If you are the one creating the XML document, then more often than not it would be your responsibility to send the document.
If you are responsible for the transportation of the XML document then you might want to consider using one of a range of transport services that are also available with LANSA Integrator. Refer to the Related Services for further information on these transport based services.
Related Services
The XMLBindFileService is one of several services that can consume the classes generated from the XML Binding Wizard (a feature of the LANSA Integrator Studio). Other services in this family combine the XML binding with specific transport support. These include:
- XMLBindQueueService
- HTTPInboundXMLBindService
- HTTPOutboundXMLBindService
The XMLBindFileService does not provide transport of the XML document. If you need to transport the document, you may need to use one the services above, or combine the XMLBindFileService with one of the transport focused services such as:
- FTPService - this service allows an application to send and receive files to and from a remote FTP server.
- HTTPService -this service provides a number of content handlers to send and receive content using the HTTP protocol.
- SMTPMailService - this service could be used to attached an XML document to an email and send it to a recipient.
- SMTPAttachmentSignatureService - this service could be used to send the XML document by email attachment with a digital signature.
- POP3MailService - this service could be used to receive an email that contains an XML document as an attachment.
- JMSFileService - this service could be used to send and receive the XML documents using enterprise messaging systems such as ActiveMQ, SonicMQ, TibcoMQ and WebSphereMQ.
The XMLParserService and XMLFileService provide alternate means of reading and writing XML files, but for most new applications, using one of the services associated with the XML Binding Wizard (such as the XMLBindFileService) is the recommended approach. The XMLParserService and XMLFileService require the use of XSL stylesheets, which is a far more complex approach than using the XML Binding Wizard approach.
Technical Specifications
The XMLBindFileService needs to be used in conjunction with the bindings created using the XML Binding Wizard of the LANSA Integrator Studio. You must start with a sample XML document to use to describe the mappings between the XML elements and the fields in your program. The XML document may be created by yourself or supplied by a third party. Once created you will need to move the relevant .jar and property files to the server before you can run the application.
Please refer to the XML Binding Wizard if you are not familiar with this.