Creating a sample WSDL, WADL and XSD for business service

We are creating below the files - XSD, WSDL and WADL
These files will be used to create a business service in a service bus project which in turn will call a REST based service:-

DemoCurrencyExchange.xsd

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:app="http://schemas.mydemo.tech/demorest"
            targetNamespace="http://schemas.mydemo.tech/demorest" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
            elementFormDefault="qualified" nxsd:version="JSON" nxsd:jsonTopLevelArray="true" nxsd:encoding="UTF-8">
  <xsd:complexType name="currencyExchangeType">
    <xsd:all>
      <xsd:element name="base" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="date" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="rates" maxOccurs="1">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="AUD" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="BGN" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="BRL" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="CAD" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="CHF" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="CNY" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="CZK" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="DKK" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="GBP" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="HKD" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="HRK" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="HUF" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="IDR" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="ILS" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="INR" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="JPY" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="KRW" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="MXN" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="MYR" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="NOK" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="NZD" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="PHP" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="PLN" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="RON" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="RUB" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="SEK" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="SGD" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="THB" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="TRY" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="USD" type="xsd:string" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="ZAR" type="xsd:string" minOccurs="0" maxOccurs="1"/>
        </xsd:sequence>
      </xsd:complexType>
      </xsd:element>     
    </xsd:all>
  </xsd:complexType>
  <xsd:element name="getExchangeRatesRequest">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="symbolsDataField" type="xsd:string" minOccurs="1" maxOccurs="1"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="getExchangeRatesResponse">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="currencyExchange" type="app:currencyExchangeType" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="AppError">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="messages" minOccurs="0" maxOccurs="1">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="messages" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>





DemoCurrencyExchange.wsdl

<?xml version= '1.0' encoding= 'UTF-8' ?>
<wsdl:definitions targetNamespace="http://service.mydemo.tech/demorest" xmlns:tns="http://service.mydemo.tech/demorest"
                  xmlns:ns1="http://schemas.mydemo.tech/demorest"
                  xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:import namespace="http://schemas.mydemo.tech/demorest" schemaLocation="DemoCurrencyExchange.xsd"/>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="BadRequestMessage">
    <wsdl:part name="fault_BadRequest" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="MethodNotAllowedMessage">
    <wsdl:part name="fault_MethodNotAllowed" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="UnauthorizedMessage">
    <wsdl:part name="fault_Unauthorized" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="ForbiddenMessage">
    <wsdl:part name="fault_Forbidden" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="UnsupportedMediaTypeMessage">
    <wsdl:part name="fault_UnsupportedMediaType" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="UnprocessableEntityMessage">
    <wsdl:part name="fault_UnprocessableEntity" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="InternalServerErrorMessage">
    <wsdl:part name="fault_InternalServerError" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="NotFoundMessage">
    <wsdl:part name="fault_NotFound" element="ns1:AppError"/>
  </wsdl:message>
  <wsdl:message name="getExchangeRates_inputMessage">
    <wsdl:part name="request" element="ns1:getExchangeRatesRequest"/>
  </wsdl:message>
  <wsdl:message name="getExchangeRates_outputMessage">
    <wsdl:part name="reply" element="ns1:getExchangeRatesResponse"/>
  </wsdl:message>
  <wsdl:portType name="DemoCurrencyExchangePort">
    <wsdl:operation name="getExchangeRates">
      <wsdl:input message="tns:getExchangeRates_inputMessage"/>
      <wsdl:output message="tns:getExchangeRates_outputMessage"/>
      <wsdl:fault name="BadRequest" message="tns:BadRequestMessage"/>
      <wsdl:fault name="MethodNotAllowed" message="tns:MethodNotAllowedMessage"/>
      <wsdl:fault name="Unauthorized" message="tns:UnauthorizedMessage"/>
      <wsdl:fault name="Forbidden" message="tns:ForbiddenMessage"/>
      <wsdl:fault name="UnsupportedMediaType" message="tns:UnsupportedMediaTypeMessage"/>
      <wsdl:fault name="UnprocessableEntity" message="tns:UnprocessableEntityMessage"/>
      <wsdl:fault name="InternalServerError" message="tns:InternalServerErrorMessage"/>
      <wsdl:fault name="NotFound" message="tns:NotFoundMessage"/>
    </wsdl:operation>   
  </wsdl:portType>
  <wsdl:binding name="DemoCurrencyExchange_ptt-binding" type="tns:DemoCurrencyExchangePort">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getExchangeRates">
      <soap:operation soapAction="getExchangeRates"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
</wsdl:definitions>



DemoCurrencyExchange.wadl

<?xml version = '1.0' encoding = 'UTF-8'?>
<application xmlns:soa="http://www.oracle.com/soa/rest" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://service.mydemo.tech/demorest"
             xmlns:demoapi="http://schemas.mydemo.tech/demorest" xmlns="http://wadl.dev.java.net/2009/02">
  <grammars>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:import namespace="http://schemas.mydemo.tech/demorest" schemaLocation="DemoCurrencyExchange.xsd"/>
    </xsd:schema>
  </grammars>
  <resources>
    <resource path="/latest">
      <method name="GET" soa:wsdlOperation="getExchangeRates">
        <request soa:paramElement="pns:getExchangeRatesRequest" xmlns:pns="http://schemas.mydemo.tech/demorest">
          <param name="symbols" style="query" soa:expression="$msg.request/demoapi:_fields" type="xsd:string"/>
        </request>
        <response status="200">
          <representation mediaType="application/json" element="cns:getExchangeRatesResponse"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="400" soa:wsdlFaultName="BadRequest">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="401" soa:wsdlFaultName="Unauthorized">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="403" soa:wsdlFaultName="Forbidden">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="404" soa:wsdlFaultName="NotFound">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="405" soa:wsdlFaultName="MethodNotAllowed">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="415" soa:wsdlFaultName="UnsupportedMediaType">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="422" soa:wsdlFaultName="UnprocessableEntity">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
        <response status="500" soa:wsdlFaultName="InternalServerError">
          <representation mediaType="application/json" element="cns:AppError"
                          xmlns:cns="http://schemas.mydemo.tech/demorest"/>
        </response>
      </method>
    </resource>
  </resources>
</application>

Featured Post

How to create an AQ (Advanced Queue) on Oracle DB

Keywords: Advanced Queue, AQ, AQ Creation, Queue, Queue Creation, How to create a queue, Queue in SOA, SOA, OSB, BPEL -------------------...