320 likes | 335 Views
Learn to build HTTP Call scenarios in SAP Business One Integration Framework (B1if). Process inbound and outbound messages, set up sender and receiver systems, test scenarios, and analyze case studies.
E N D
Integration Framework of SAP Business OneTraining Solution Architects TeamFebruary 2011 How to make a HTTP Call
B1if Training: How to build a HTTP Call in B1if • The following training is designed to show you how to build a Http Call scenario using B1if. After this training, you should be able to: • Build a scenario processing HTTP Call in B1if. • Setup the scenario and test it for running.
Agenda • Integration Scenario Package Scenario Step Inbound Outbound Processing • Setup Steps Sender System Receiver System Activate • Test Message Log • Case Analysis Process http call in B1if
Agenda • Integration Scenario Package Scenario Step Inbound Outbound Processing • Setup Steps Sender System Receiver System Activate • Test Message Log • Case Analysis Process http call in B1if
Case Analysis: Integration Step – XXX.callHTTP (Synchonous) http response Browser http request call B1if The potential scenario is making several http calls to public services (e.g. Telecom, Bank, Google, Facebook API etc) and composing together into a new interface in B1if An HTTP Call is triggered via A URL by an external system (e.g. browser), and the request is sent to B1if. The scenario step XXX.callHTTP in B1if is triggered for process by the given URL parameter(e.g. action=callHTTP), calling to the target http call URLs for result. Then transform and handover the call results back to the original caller via HTTP
Agenda • Integration Scenario Package Scenario Step Inbound Outbound Processing • Setup Steps Sender System Receiver System Activate • Test Message Log • Case Analysis Process http call in B1if
Setup: Create an HTTP Any system 2 3 Path: SLD/B1iServer 4 5 6 1 3 2 4
Setup: Create an HTTP Any system 2 3 Path: SLD/B1iServer 4 5 6 1 2
Integration: Scenario Package Path: Scenarios/Package Design 1 2 3 B1if will add the namespace configured before the Scenario identifier as configured. The package will be created in design mode after save. If you want to modify the package later on, you can use the ellipsis (…) button next to the Scenario Package Identifier textbox to select your package.
Integration: Scenario Step Path: Scenarios/Step Design 4 1 2 3 B1if will add the namespace configured before the step identifier as configured. The step will be empty and a version number will be automatically assigned for version control.
Integration: Inbound (1/2) Path: Scenarios/Step Design/Working Step/[Inbound] 1 2 3 6 7 4 5 8 9
Integration: Outbound Path: Scenarios/Step Design/Working Step/[Outbound] 2 3 1 No outbound required. The final response will be sent back to the caller.
Integration: Processing Path: Scenarios/Step Design/Working Step/[Processing] The processing is the part in which B1if transforms the inbound message to the outbound message in order to get the desired results. Each processing unit inside the scenario step is called an atom and can do different types of work. By default all scenario steps have one atom ( called final) associated with an xslt file to perform the last transformation.
Integration: Processing Path: Scenarios/Step Design/Working Step/[Processing] 1 2 5 3 4
Integration: Processing Path: Scenarios/Step Design/Working Step/[Processing] 1 5 4 2 3
Integration: Processing Path: Scenarios/Step Design/Working Step/[Processing] After the configuration the Processing diagram should be showing a green light icon at the top of both httpCall atoms. The next step is to modify the XSLT file of the Final atom using your preferred XML Editor. In order to have access to the XSLT file, WebDav should be enabled as “full”. Refer to B1if guides for instructions or the session about “B1if installation”
Integration: Processing Path: Scenarios/Step Design/Working Step/[Processing] The httpCall payload is prepared in the xform atom (atom2).The parameters will be specified in the XSLT file (atom2.xsl) The httpCall atom processes the http call with the given parameters The final atom transforms the httpCall result and hands over the response to the original requester
Integration: Processing – Implement atom2.xsl <xsl:templatename="transform"> <callxmlns=""> <!--query id="identifier" value="value"/--> <!--optional - define your own query parameters - multiple elements allowed--> <connect> <!--the connect section is optional - you can also define a reference to the sld--> <destProtocol>http</destProtocol> <destHost>www.google.com</destHost> <destPort>80</destPort> <destPath>/</destPath> <query/> <proxyHost/> <proxyPort/> <method>get</method> <authentification></authentification> <user></user> <password></password> <user2query/> <password2query/> <sslTruststorePath/> <sslTruststorePassword/> </connect> <!--optional - default isxml--> <pltype>html</pltype> <payload></payload> <htta> <par id="httpheader.???" value=""> <!--optional - you can specify here your own http header definitions - multiple elements allowed--> </par> <par id="htta.returnpltypeforce" value=""> <!--optional--> </par> <par id="htta.returnpltypedefault" value=""> <!--optional--> </par> </htta> </call> </xsl:template> You can make any HTTP call with the given URL parameters, such as calling facebook, twitter etc Note: Depending on your system different parameters need to be specified. For example if there is a proxy server, proxyHost and proxyPort should be specified.
Integration: Processing – Implement atom0.xsl (final step) <xsl:templatename="transform"> <result xmlns=""> <xsl:copy-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@id='atom1']/*"/> </result> </xsl:template> Copy the result of callHTTP atom, in this case it is “atom1”
Agenda • Case Analysis Process http call in B1if • Integration Scenario Package Scenario Step Inbound Outbound Processing • Setup Steps Sender System Receiver System Activate • Test Message Log
Setup: Steps 2 3 Path: Scenarios/Setup 4 5 6 4 1 2 3
Setup: Sender 2 3 Path: Scenarios/Setup 4 5 6 1 2 3 4 5 6
Setup: Receiver 2 3 Path: Scenarios/Setup 4 5 6 No Receiver required for this scenario, since it is a synchronous call, the response will be sent back to the sender. No Outbound channel defined. 1 2
Setup: Activate 2 3 Path: Scenarios/Setup 4 5 6 1 2 After the operation is completed the status of the Package is changed from design to active
Setup: Check activation 2 3 Path: Scenarios/Control 4 5 6
Agenda • Case Analysis Process http call in B1if • Integration Scenario Package Scenario Step Inbound Outbound Processing • Setup Steps Sender System Receiver System Activate • Test Message Log
Test: Check trigger 2 3 Path: Scenarios/Control 4 5 6 1 2
Test • After everything is completed you can perform the following test: • Open the browser • Paste the trigger URL to process the http call • Result as below
Test: Message Log 2 3 Path: Monitoring/Message Log 4 5 • The result of the tests will be displayed in the message log • Select the date and time you want to check. • Click on Display/Refresh button to check results • For more information about debugging check the Debugging Appendix. 6
Thank You! For more information visit SDN at http://sdn.sap.com