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

Sharing is Caring

Creating and Consuming Web Service is an important part development cycle. In earlier posts, I have described 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 (http://www.webservicex.net/country.asmx) to create WSDL

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

 

    • Right click on the 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 the second screen select the methods to expose in Data Control that will be further used by the application

 

 

    • In the 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 the page as a button and expand this operation and drop String as output text formatted to show the response of web service

 

 

 

    • In the same manner, drop another method as parameter form as it has one input parameter that takes the 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>
                            <af:panelFormLayout id="pfl1" inlineStyle="width:600px;">
                                <af:inputText value="#{bindings.CountryName.inputValue}"
                                              label="#{bindings.CountryName.hints.label}"
                                              required="#{bindings.CountryName.hints.mandatory}"
                                              columns="#{bindings.CountryName.hints.displayWidth}"
                                              maximumLength="#{bindings.CountryName.hints.precision}"
                                              shortDesc="#{bindings.CountryName.hints.tooltip}" id="it1">
                                    <f:validator binding="#{bindings.CountryName.validator}"/>
                                </af:inputText>
                                <af:button actionListener="#{bindings.GetCurrencyByCountry.execute}"
                                           text="GetCurrencyByCountry"
                                           disabled="#{!bindings.GetCurrencyByCountry.enabled}" id="b2"/>
                                <af:outputFormatted value="#{bindings.Return1.inputValue}" id="of1"
                                                    partialTriggers="b2" inlineStyle="color:maroon;"/>
                            </af:panelFormLayout>
                        </af:panelGroupLayout>

 

    • Now run and check application

 

Consuming a SOAP Web Service

 

 

 

All done 🙂

Sample ADF Application- Download

Cheers 🙂 Happy Learning

Related Posts

4 thoughts on “Consuming a SOAP Web Service quickly using Web Service Data Control (WSDL) in ADF”

  1. Hi Ashish,

    I have created a Web Service and I tested it so it's giving response. But the moment I tried to consume in main application where I've accessed it's method interface from Data control it's showing the error 404 response not found from the WebService URL which I have provided. So, please help me getting this sorted out

  2. Hi,

    Your article was very helpful. Now IE will roll back their support on Oracle forms and companies are converting forms applications to adf and other companies are integrating forms with adf to make it browser independent. Can you create an article about the same.

Leave a Reply

Your email address will not be published. Required fields are marked *