This section describes the steps required for an AIC to call an XML Web service.
Create a C# class project in Microsoft Visual Studio .NET for the AIC that calls the XML Web service. View the Reference.cs file to ensure that the XMLRoot information contained in this class is correct, and that the structure matches the class in the original .cs file created for the XML Web service.
To view and update the Reference.cs file
The root element appears as:
[System.Xml.Serialization.XmlAttribute( Namespace=http://tempuri.org )] public class RootElementName {
[System.Xml.Serialization.XmlRoot( RootElementName )] public class RootElementName {
Where RootElementName is the name of the document s root element.
The AIC project must contain a reference to access the XML Web service remotely. After this reference is made, the project acts as a client to that XML Web service. For example:
// Reference to the hub XML Web service using Supp_send_invoice.localhost;
To indicate that the project is an AIC, the code must implement the ProcessMessage method on the IBTSAppIntegration interface.
The following example is from the supplier's client code that sends an invoice to the hub XML Web service:
string IBTSAppIntegration.ProcessMessage(string strDocument) { // The incoming string is CommonInvoice, convert the // xml string into an object by deserializing it CommonInvoice invoice; XmlSerializer serializer = new XmlSerializer(typeof(CommonInvoice)); TextReader stringstream = new StringReader(strDocument); invoice = ((CommonInvoice)serializer.Deserialize(stringstream)); // Open up the hub XML Web service Hub_services web_service = new Hub_services(); // Process the order string result = web_service.Process_invoice(invoice); web_service = null; return result; }
When creating your AIC project in Microsoft Visual Studio .NET, you might want to use a fixed GUID value to maintain binary compatibility. Otherwise, the GUID for the component changes every time you compile the code. In that case, any references to this component would have to be rebound in your XLANG schedules.
The following procedure assigns a static GUID value to the component and registers the AIC for COM interoperability:
using System.Runtime.InteropServices;
[Guid( )] public class AIC_name : IBTSAppIntegration
Note The "Guid" literal string shown above is case-sensitive.
The Create GUID dialog box appears.
The project Property Pages dialog box appears.
Previous Next |