Web Service Example - Defining the Web Service Profile(3.0)


Start by creating a Web Service (WS) profile:

  1. Click the Configuration button in the upper left part of the  Desktop window. Then select WS Profile from the menu (double-click to open).

    The WS profile configuration dialog opens.
     

  2. In the Configuration tab, click the Import WSDL button, and select the WSDL file to import.

    You can now see the file contents on the View WSDL Content tab.
     

  3. In the Service Port Definition drop-down list on the Configuration tab, select the SOAP: Charger (Charger_SOAPBinding).

  4. In the WS profile, click the Save As... button. In the Save as dialog box select a folder and in the Name text box type "Example". Click OK. 

  5. At this point you need to check the WS directory in the APL Code Editor and see the data structure that your WS profile just generated. Open the APL Code Editor by clicking the Configuration button in  Desktop. Then select WS Profile from the menu.
     

  6. Right-click on the text pad and select UDR Assistance ...

    The UDR Internal Format Browser opens.
     

  7. Scroll down to the WS directory and expand it to see where data is stored once you save your WS profile.

The WSDL File

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:tns="http://example.com/webservice/charger"
  xmlns:x1="http://example.com/webservice/charger/types"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Charger"
  targetNamespace="http://example.com/webservice/charger">

<wsdl:types>

   <schema xmlns="http://www.w3.org/2001/XMLSchema"
   xmlns:tns="http://example.com/webservice/charger/types"
   elementFormDefault="qualified"
   targetNamespace="http://example.com/webservice/charger/types">

     <complexType name="ChargingEvent">
       <sequence>
         <element name="id" type="string"/>
         <element name="amount" type="float"/>
       </sequence>
     </complexType>

     <element name="Charge">
       <complexType>
         <sequence>
           <element name="serviceType" type="string"/>
           <element name="chargingEvent" type="tns:ChargingEvent"/>
         </sequence>
       </complexType>
     </element>

     <element name="ChargeResult">
       <complexType>
         <sequence>
           <element name="success" type="boolean"/>
           <element name="message" type="string"/>
         </sequence>
       </complexType>
     </element>

     <element name="FaultDetail">
       <complexType>
         <sequence>
           <element name="reason" type="int"/>
           <element name="message" type="string"/>
         </sequence>
       </complexType>
     </element>
   </schema>
</wsdl:types>

<wsdl:message name="ChargingRequest">
   <wsdl:part name="in" element="x1:Charge" />
</wsdl:message>

<wsdl:message name="ChargingRespone">
   <wsdl:part name="in" element="x1:ChargeResult" />
</wsdl:message>

<wsdl:message name="chargeFault">
   <wsdl:part name="faultDetail" element="x1:FaultDetail"/>
</wsdl:message>

<wsdl:portType name="Charger">
   <wsdl:operation name="charge">
      <wsdl:input name="chargingRequest" message="tns:ChargingRequest"/>
      <wsdl:output name="chargingResponse" message="tns:ChargingRespone"/>
      <wsdl:fault name="chargingFault" message="tns:chargeFault"/>
   </wsdl:operation>
</wsdl:portType>

<wsdl:binding name="Charger_SOAPBinding" type="tns:Charger">
   <soap:binding style="document"
                    transport="http://schemas.xmlsoap.org/soap/http"/>

   <wsdl:operation name="charge">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="chargingRequest">
         <soap:body use="literal"/>
      </wsdl:input>

      <wsdl:output name="chargingResponse">
         <soap:body use="literal"/>
      </wsdl:output>
      <wsdl:fault name="chargingFault">
         <soap:fault name="chargingFault" use="literal"/>
      </wsdl:fault>
   </wsdl:operation>
</wsdl:binding>

<wsdl:service name="Charger_Service">
   <wsdl:port binding="tns:Charger_SOAPBinding" name="Charger">
      <soap:address location="http://localhost:8080/charge"/>
   </wsdl:port>
</wsdl:service>
</wsdl:definitions>