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 (http://www.webservicex.net/country.asmx) to create WSDL
Cheers :) Happy Learning
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 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- - Now run and check application
<af:panelGroupLayoutid="pgl1"layout="horizontal"valign="top">
<af:panelFormLayoutid="pfl2"inlineStyle="width:600px;">
<af:buttonactionListener="#{bindings.GetCountries.execute}"text="GetCountries"
disabled="#{!bindings.GetCountries.enabled}"id="b1"/>
<af:outputFormattedvalue="#{bindings.Return.inputValue}"id="of2"
partialTriggers="b1"inlineStyle="width:500px;color:blue;"/>
</af:panelFormLayout>
<af:panelFormLayoutid="pfl1"inlineStyle="width:600px;">
<af:inputTextvalue="#{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:validatorbinding="#{bindings.CountryName.validator}"/>
</af:inputText>
<af:buttonactionListener="#{bindings.GetCurrencyByCountry.execute}"
text="GetCurrencyByCountry"
disabled="#{!bindings.GetCurrencyByCountry.enabled}"id="b2"/>
<af:outputFormattedvalue="#{bindings.Return1.inputValue}"id="of1"
partialTriggers="b2"inlineStyle="color:maroon;"/>
</af:panelFormLayout>
</af:panelGroupLayout>
Cheers :) Happy Learning