Invoking a service is not much different from sending a regular HTTP request. Here the HTTP request contains the XML as a parameter. The XAI server handling requests via the HTTP protocol is implemented using a Java servlet running on the web server.
Microsoft Visual Basic/C Example
Microsoft provides an easy way to send XML requests over HTTP. To send and receive XML data over HTTP, use the Microsoft XMLHTTP object
set xmlhttp = createObject("Microsoft.XMLHTTP")
xmlhttp.Open "POST", http://Localhost:6000/xaiserver, false
xmlhttp.Send XMLRequest
XMLResponse = xmlhttp.ResponseText
Here http://localhost:6000/xaiserver is the URL of the XAI server. XMLRequest contains the XML request to be processed by XAI and XMLResponse contains the XML response document created by the XAI runtime.
Java Example
Java provides a very simple way to send a request over HTTP. The following example shows how a request can be sent to XAI from an application running under the same WebLogic server as the one XAI runs. In this example, we use the "dom4j " interface to parse the XML document.
import com.splwg.xai.external.*;
import org.dom4j.*;
String xml;
xml = "<XML request>";
XAIHTTPCallForWebLogic httpCall = new XAIHTTPCallForWebLogic();
String httpResponse = httpCall.callXAIServer(xml);
Document document = DocumentHelper.parseText(httpResponse);
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.