Follow by Email

Thursday, 14 January 2016

Consuming a SOAP Web Service quickly using Web Service Data Control (WSDL) in ADF

Creating and Consuming Web Servie is an important part development cycle . In earlier posts i have described about creating SOAP/REST Web Service
Create REST Web Service with Application Module declaratively in ADF 12.2.1
Create SOAP Web Service with Application Module quickly in ADF 12.2.1

Now this post is about consuming a SOAP Web Service. A very simple way to consume Web Service is to create Web Service Data Control (WSDL) for external Web Service URL
Here i am using a Country-Currency Web Service ( to create WSDL

  • Create a Fusion Web Application with default Model and ViewController project

  • Right click on Model project , Select New--> From Gallery--> Business Tier--> Web Services and select Web Service Data Control SOAP/REST 

  • It opens WSDL creation wizard , First Step is to provide Web Service Name and URL

  • Click on next and in second screen select the methods to expose in Data Control that will be further used by application

  • In third step we can set return type of Web Service response , there are two options -XML and CSV. Leave it as default XML

  • Click on Finish button to generate DataControl.dcx (It is created when DataControl is registered on Business Service not on ADF Business Components) and WSDL document

  • Creation of WSDL is done now create a page in view controller project and expand DataControls menu , there we will see a data control created for CountryWebServices 

  • Drag and drop GetCountries operation on page as a button and expand this operation and drop String as output text formatted to show response of webservice

  • In same manner drop another method as parameter form as it has one input parameter that takes country name as input and shows it's currency as output.
    See page source code-

  • <af:panelGroupLayout id="pgl1" layout="horizontal" valign="top">
                                <af:panelFormLayout id="pfl2" inlineStyle="width:600px;">
                                    <af:button actionListener="#{bindings.GetCountries.execute}" text="GetCountries"
                                               disabled="#{!bindings.GetCountries.enabled}" id="b1"/>
                                    <af:outputFormatted value="#{bindings.Return.inputValue}" id="of2"
                                                        partialTriggers="b1" inlineStyle="width:500px;color:blue;"/>
                                <af:panelFormLayout id="pfl1" inlineStyle="width:600px;">
                                    <af:inputText value="#{bindings.CountryName.inputValue}"
                                                  shortDesc="#{bindings.CountryName.hints.tooltip}" id="it1">
                                        <f:validator binding="#{bindings.CountryName.validator}"/>
                                    <af:button actionListener="#{bindings.GetCurrencyByCountry.execute}"
                                               disabled="#{!bindings.GetCurrencyByCountry.enabled}" id="b2"/>
                                    <af:outputFormatted value="#{bindings.Return1.inputValue}" id="of1"
                                                        partialTriggers="b2" inlineStyle="color:maroon;"/>

  • Now run and check application

All done :) Sample ADF Application- Download
Cheers :) Happy Learning

No comments :

Post a Comment