The document-literal web services include the following:
These are wrapped and stateless, meaning they do not maintain any session information.
The following is an example of how a LeasePak API web service is created and used in Java:
// these are the required import statements to use the Apache Axis API import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; // these imports are used to print out SOAP messages import org.apache.axis.MessageContext; import org.apache.axis.Message; import org.apache.axis.AxisFault; // more required imports import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; public class LPWebServiceTemplate { // this is a method that allows you to print out the SOAP request and SOAP response // useful for debugging public static void printCallRequestResponse(Call lpcall) throws AxisFault { MessageContext ctx = lpcall.getMessageContext(); Message requestMsg = ctx.getRequestMessage(); Message responseMsg = ctx.getResponseMessage(); System.out.println("SOAP REQUEST : " + requestMsg.getSOAPPartAsString()); System.out.println(); System.out.println("SOAP RESPONSE : " + responseMsg.getSOAPPartAsString()); System.out.println(); } public static void main(String [] args) { try { String lpendpoint = "http://hostname:port/deployed_location/services/service_name"; // where hostname is the name of your host machine, port is your port number, // deployed_location is the root directory where mPower is deployed, and // service_name is the name of the web service (LPClient, LPApplication, MsiAppOriginator, etc.) Service lpservice = new Service(); Call lpcall = (Call)lpservice.createCall(); // optional //lpcall.setUsername([username]); //lpcall.setPassword([password]); lpcall.setTargetEndpointAddress( new java.net.URL(endpoint) ); lpcall.setProperty(lpcall.SESSION_MAINTAIN_PROPERTY,new Boolean(false)); lpcall.setUseSOAPAction(true); // more work in Java for document literal web services // in java we must describe the operation in more detail than a xml-rpc type web service OperationDesc lpoper = new OperationDesc(); // set the operations name lpoper.setName("lpoperName"); // where lpoperName isextractLessee
,extractApplication
, etc. // setup a parameter description in the case of the Lessee record its lesseeNumber ParameterDesc lpparam = new ParameterDesc( new javax.xml.namespace.QName("http://client.web.msi", "keyNumber"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false); // where keyNumber is the application number, Lessee number, etc. of the item you wish to extract // add the parameter to the operation lpoper.addParameter(lpparam); // now we set the return type of the operation, by telling it its a string lpoper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); lpoper.setReturnClass(java.lang.String.class); lpoper.setReturnQName(new javax.xml.namespace.QName("urn:MsiAppExtractor", "lpoperNameReturn")); // where lpoperName isextractLessee
,extractApplication
, etc. // we tell the service that the opertaion is a lpoper.setStyle(org.apache.axis.constants.Style.WRAPPED); lpoper.setUse(org.apache.axis.constants.Use.LITERAL); lpcall.setOperation(lpoper); lpcall.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); lpcall.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); lpcall.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); lpcall.setOperationName( new QName("urn:mpower-ver_vnna", "lpoperName") ); Object result = lpcall.invoke(new Object[]{ new String("25") } ); printCallRequestResponse(lpcall); // where lpoperName isextractLessee
,extractApplication
, etc. } catch (Exception e) { System.out.println(e.toString()); } } }
The web services use Web Service Definition Language (WSDL) to generate client proxy classes that allow the user to treat a web service (such as LPClient) as a local object. Refer to sample_wsdl_dl.java for a WSDL example (Java RMI/Apache Axis mp_axis) pertaining to the document-literal web services.
The document-literal services do not maintain any session data. Each object (MsiAppOriginatorDocLit, MsiAppExtractor, etc.) has its own connection to LeasePak and each object maintains a connection to the LeasePak XML driver until dsDisconnect() is called. Most errors (or SOAP exceptions) are caught and re-thrown so the program can close the connection. If an unexpected error occurs, connections and XML drivers could remain open and running. NetSol recommends checking for open connections and running drivers after receiving an error or exception, and reporting any occurrences of open connections or running drivers to NetSol.