PROGRAMMING DOMINO FOR WEB APPLICATIONS


Examples: Web services
Example 1: Web service without complex data types
Here is a Web service with two operations. Each operation has an input message with 2 parts and an output message.

Property box settings


LotusScript:
%INCLUDE "lsxsd.lss"
Class WebServiceOne
 
 Sub NEW
 End Sub
 
 Function operation1(input1 As String, input2 As String) As String
 End Function
 
 Function operation2(input1 As String, input2 As String) As String
 End Function
 
End Class

Java:
import lotus.domino.*;
import lotus.domino.types.*;

public class WebServiceOne {
 public java.lang.String operation1(
   java.lang.String input1,
   java.lang.String input2) {
     return null;
 }
 public java.lang.String operation2(
   java.lang.String input1,
   java.lang.String input2) {
     return null;
 }
}

WSDL
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="urn:DefaultNamespace"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="urn:DefaultNamespace" xmlns:intf="urn:DefaultNamespace"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:message name="OPERATION2Request">
 <wsdl:part name="INPUT1" type="xsd:string" />
 <wsdl:part name="INPUT2" type="xsd:string" />
</wsdl:message>
<wsdl:message name="OPERATION1Response">
 <wsdl:part name="OPERATION1Return" type="xsd:string" />
</wsdl:message>
<wsdl:message name="OPERATION1Request">
 <wsdl:part name="INPUT1" type="xsd:string" />
 <wsdl:part name="INPUT2" type="xsd:string" />
</wsdl:message>
<wsdl:message name="OPERATION2Response">
 <wsdl:part name="OPERATION2Return" type="xsd:string" />
</wsdl:message>
<wsdl:portType name="WebServiceOne">
 <wsdl:operation name="OPERATION1" parameterOrder="INPUT1 INPUT2">
  <wsdl:input message="impl:OPERATION1Request"
   name="OPERATION1Request" />
  <wsdl:output message="impl:OPERATION1Response"
   name="OPERATION1Response" />
 </wsdl:operation>
 <wsdl:operation name="OPERATION2" parameterOrder="INPUT1 INPUT2">
  <wsdl:input message="impl:OPERATION2Request"
   name="OPERATION2Request" />
  <wsdl:output message="impl:OPERATION2Response"
   name="OPERATION2Response" />
 </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="DominoSoapBinding" type="impl:WebServiceOne">
 <wsdlsoap:binding style="rpc"
  transport="http://schemas.xmlsoap.org/soap/http" />
 <wsdl:operation name="OPERATION1">
  <wsdlsoap:operation soapAction="" />
  <wsdl:input name="OPERATION1Request">
   <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="urn:DefaultNamespace" use="encoded" />
  </wsdl:input>
  <wsdl:output name="OPERATION1Response">
   <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="urn:DefaultNamespace" use="encoded" />
  </wsdl:output>
 </wsdl:operation>
 <wsdl:operation name="OPERATION2">
  <wsdlsoap:operation soapAction="" />
  <wsdl:input name="OPERATION2Request">
   <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="urn:DefaultNamespace" use="encoded" />
  </wsdl:input>
  <wsdl:output name="OPERATION2Response">
   <wsdlsoap:body
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    namespace="urn:DefaultNamespace" use="encoded" />
  </wsdl:output>
 </wsdl:operation>
</wsdl:binding>
<wsdl:service name="WebServiceOneService">
 <wsdl:port binding="impl:DominoSoapBinding" name="Domino">
  <wsdlsoap:address location="http://localhost" />
 </wsdl:port>
</wsdl:service>
</wsdl:definitions>

Example 2: Accessing a Domino session
This example demonstrates Example 1 with code added to access a Domino session.

LotusScript:
%INCLUDE "lsxsd.lss"

Dim session As NotesSession
Dim db As NotesDatabase

Class WebServiceOne
 
 Sub NEW
   Set session = New NotesSession
   Set db = session.GetCurrentDatabase
 End Sub
 
 Function operation1(input1 As String, input2 As String) As String
 End Function
 
 Function operation2(input1 As String, input2 As String) As String
 End Function
 
End Class

Java:
import lotus.domino.*;
import lotus.domino.types.*;

public class WebServiceOne {

 private Session session;
 private AgentContext ac;
 private Database db;
 
 public WebServiceOne() throws NotesException {
   session = WebServiceBase.getCurrentSession();
   ac = session.getAgentContext();
   db = ac.getCurrentDatabase();
 }
 
 public java.lang.String operation1(
   java.lang.String input1,
   java.lang.String input2) {
     return null;
 }
 public java.lang.String operation2(
   java.lang.String input1,
   java.lang.String input2) {
     return null;
 }

}

Example 3: Array
This example demonstrates the coding for an array of type float:

LotusScript
() As Single

Java
float[]

WSDL for a Domino 8 "encoded" service:
<complexType name="ArrayOf_xsd_float">
   <complexContent>
      <restriction base="soapenc:Array">
         <attribute ref="soapenc:arrayType"
            wsdl:arrayType="xsd:float[]"/>
      </restriction>
   </complexContent>
</complexType>
WSDL for a Domino 8 "literal" service:
<complexType name="xsd_floatArray">
   <sequence>
      <element name="item" minOccurs="0" maxOccurs="unbounded" type="xsd:float"/>
   </sequence>
</complexType>
Example 4: Complex data element
This example demonstrates the coding for a data element that contains two strings:

WSDL
<complexType name="TwoStrings">
  <sequence>
      <element name="string1" nillable="true" type="xsd:string" />
      <element name="string2" nillable="true" type="xsd:string" />
   </sequence>
</complexType>

LotusScript
Note that string1 and string2 must be public.

%INCLUDE "lsxsd.lss"
Class TwoStrings
 
 Public string1 As XSD_STRING
 Public string2 As XSD_STRING
 
 Sub NEW
 End Sub
 
End Class

Java
public class TwoStrings  {
 private java.lang.String string1;
 private java.lang.String string2;

 public TwoStrings() {
 }

 public java.lang.String getString1() {
   return string1;
 }

 public void setString1(java.lang.String string1) {
   this.string1 = string1;
 }

 public java.lang.String getString2() {
   return string2;
 }

 public void setString2(java.lang.String string2) {
   this.string2 = string2;
 }
}

See Also