Consuming WebService in Visual Composer-2
The Previous blog showcased how to Consume Standard SAP provided webservices in Visual Composer.This one demonstrates how to make use of BAPI’S as webservices and then Consume it in Visual Composer.The Blog also enlighten’s the error that may be encountered while using the webservice in Visual Composer.Following are the Steps which needs to Performed:- ><server ID XXXXXX>->Services—>WebService Security.
- Click on Create Button At the Bottom and Enter The name of the System.
- Enter The WSDL URL , and Fill in the Login Credentials if the wsdl is authenticated.
- Press Save button.
Fig 1. Showing the navigation structure in the Visual Administrator.
Fig 2:Enter the Url,System details and login credentials.
Once the above steps have been performed we can see the name of the System appearning in the Visual Composer.We can also define Webservice system through visual composer but at times when the wsdl is authenticated Visual Composer throws and error.
Consuming a Webservice in Visual Composer :-
For a reference i am making use of the classical SAP BAPI FLIGHTGETLIST.
- Log on to VC and create model–>Iview.
- Check wether the system which you have created is appearing the “find data”.
- Drag The webService on the screen as shown in the Figure 4.
- Define the web service(as shown in Figure 3) by choosing the input.
- Test the webService .
Rationale behind testing the webservice is to Know whether the webservice is working fine or not.Once the webservice responds well and returns the desired ouput, Connect the input form and the output table as shown in the figure.
Fig 3 : Defining The webservice.
Fig 4 : When only Required Fields are Connected.
It is to be noted that once we depoly this iview and Enter the desired input it does not return anything .So we need to provide input to all the input fields(as shown in the figure 5) no matter we are using them or not , similarly we can make the form visibilty as False. once we deoply the iview ,enter the input we get an desired output as shown i figure 6.
Airline :- LH
ROWS :- 10
(Sign and option i am passing as the prefilled value from the backend only in the visual composer).Thats why it is advisable to customize the bapi to avoid useless input ports.
Fig 5:- Showing The correct Approach.
Figure 6:- Desired Output.
Error that May be Encountered :-
If the webservice is draged inside a layer it will show the following error:-
Fig 7:- Error when Draged Directly into the Layer.
Solution is Drag the Webservice inside the dash Board , define it and then you can place the webservice inside the Layer.
- [Portal Request Failed. | https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/portal%2brequest%2bfailed]
- [Seeting Up WebServices. | https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/setting%2bup%2bweb%2bservices]
- [Connectivity | https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/connectivity]