ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button

Constructing Web Services with the Globus Toolkit Version 4
Pages: 1, 2, 3, 4, 5

Loan Payment Processing Service Interface Definition

The port types for the Loan Payment Processing example are defined the a file loan.wsdl. It describes three operations (createLoan, processLoanPayment, and getLoan) that the loan payment processing service will provide. First, let's describe the requests/responses:



<types>

  <xsd:element name="createLoan">
    <xsd:complexType>
      <xsd:sequence>
          <xsd:element name="loanNumber" type="xsd:int"/>
        <xsd:element name="amountUPB" type="xsd:double"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="createLoanResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="returnValue" type="xsd:int"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="processLoanPayment">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="loanNumber" type="xsd:int"/>
        <xsd:element name="amount" type="xsd:double"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="processLoanPaymentResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="returnValue" type="xsd:int"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="getLoan">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="loanNumber" type="xsd:int"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="getLoanResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="returnValue" type="tns:LoanType"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

</types>

We define the loan data type in a file, loan.xsd. We use the import <xsd:import schemaLocation="loan.xsd"/> directive to import this file into loan.wsdl and use it as a return type for the getLoan operation.

<complexType name="LoanType">
    <sequence>
        <element name="loanNumber" type="int"/>
        <element name="UPB" type="double"/>
        <element name="status" type="string"/>
        <element name="createDate" type="string"/>
    </sequence>
</complexType>

Next we define all of the messages. A Message element consists of one or more part sections. Each part element corresponds to a parameter. Each part has a type attribute. Messages can be either Requests (input messages) or Responses (output messages).

<message name="CreateLoanInputMessage">
  <part name="parameters" element="tns:createLoan"/>
</message>
<message name="CreateLoanOutputMessage">
  <part name="parameters" element="tns:createLoanResponse"/>
</message>

<message name="ProcessLoanPaymentInputMessage">
  <part name="parameters" element="tns:processLoanPayment"/>
</message>
<message name="ProcessLoanPaymentOutputMessage">
  <part name="parameters"
    element="tns:processLoanPaymentResponse"/>
</message>

<message name="GetLoanInputMessage">
  <part name="parameters" element="tns:getLoan"/>
</message>
<message name="GetLoanOutputMessage">
  <part name="parameters" element="tns:getLoanResponse"/>
</message>

Finally, we define all of the port types. A port type defines one or more operations using the operation element. Each unique operation element defines an operation and the input/output messages associated with the operation. The operation elements within a port type define the syntax for calling all methods in the port type.

<portType name="LoanPortType">
  <operation name="createLoan">
    <input message="tns:CreateLoanInputMessage"/>
    <output message="tns:CreateLoanOutputMessage"/>
    <fault name="Fault" message="ogsi:FaultMessage"/>
  </operation>
  <operation name="processLoanPayment">
    <input message="tns:ProcessLoanPaymentInputMessage"/>
    <output message="tns:ProcessLoanPaymentOutputMessage"/>
    <fault name="Fault" message="ogsi:FaultMessage"/>
  </operation>
  <operation name="getLoan">
    <input message="tns:GetLoanInputMessage"/>
    <output message="tns:GetLoanOutputMessage"/>
    <fault name="Fault" message="ogsi:FaultMessage"/>
  </operation>
</portType>

Pages: 1, 2, 3, 4, 5

Next Pagearrow