例: Web サービス

例 1: 複合データ型なしの Web サービス

ここに、2 つの操作を持つ Web サービスがあります。各操作には出力メッセージ、および 2 つのパートから構成される入力メッセージがあります。

プロパティボックスの設定

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>

例 2: Domino セッションへのアクセス

この例では、例 1 に Domino セッションにアクセスするコードを追加しています。

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;
  }
}

例 3: 配列

この例では、float 型の配列のコードを示します。

LotusScript

() As Single

Java

float[]

Domino 8 「エンコード」サービスの WSDL:

<complexType name="ArrayOf_xsd_float">
   <complexContent>
      <restriction base="soapenc:Array">
         <attribute ref="soapenc:arrayType"
            wsdl:arrayType="xsd:float[]"/>
      </restriction>
   </complexContent>
</complexType>

Domino 8 「リテラル」サービスの WSDL:

<complexType name="xsd_floatArray">
   <sequence>
      <element name="item" minOccurs="0" maxOccurs="unbounded" type="xsd:float"/>
   </sequence>
</complexType>

例 4: 複合データ要素

この例では、2 つの文字列が入ったデータ要素のコードを示します。

WSDL

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

LotusScript

string1 と string2 は 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;
  }
}