View
1
Download
0
Category
Preview:
Citation preview
Yatsea Li
SAP Business One Solution Architects Team
Sep 2010
Headquarters
Branch Office
Customer
Acquisition
Customer
Branch Office
Subsidiary
ManufacturingSite
Supplier
Exposing and Hosting Web Services
for SAP Business One with B1iSN
Build and Run a Web Service to add or update
Business Partners in SAP Business One
Goals
Target Audience: SAP Business One Technical Consultant.
Required Skill Set: XML, XSLT, XPath, Web Services
Prerequisites:
Apply to B1iSN 2007 PL11 and B1iSN 8.8 PL 00 or higher version.
Follow previous blog at
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/16298 showing how to
Build & Run a B12B1 Scenario - BIU.B1PO2B1SO with B1iSN 2007.
After completing this chapter, you will be able to:
Describe how B1iSN supports Web Services
How to generate a WS2WS BIU within a BizPackage to host a Web Service
How to add additional call to SAP Business One in BIU
How to generate WSDL for a WS2WS BIU
How to test Web Service hosted within B1iSN
Agenda
Build & Run (BPWebService)
Part 1: Introduction to Web Services in B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Test – Send SOAP request to add a new Business Partner
B1iSN Tools
Will be used in the later section
Add the following URLs of B1iSN tools into your browser’s favorites
SAP B1iSN Tools:
http://localhost:8080/B1iXcellerator/exec/dummy/com.sap.b1ip.system.cc/bfd/AdminConsole.bfd?!defdoc=/com.sap.b1i.datasync.b1isntools/ui/B1iSNTools.xml
SAP B1iSN Admin Console:
http://localhost:8080/B1iXcellerator/exec/dummy/com.sap.b1i.datasync.ui/bin/ControlCenter.htm
SAP iApp Explorer:
http://localhost:8080/B1iXcellerator/exec/dummy/com.sap.b1i.system.iae/bin/IAE.htm
SAP B1iP Control Center
http://localhost:8080/B1iXcellerator/exec/dummy/com.sap.b1ip.system.cc/bfd/AdminConsole.bfd?!defdoc=../xml/ControlCenter.xml
Log-On Information for these tools:
User name: B1iadmin
Password: Your B1iadmin’s password
Additional Documents Reference:
B1iSN Guides
B1iSN Guides:
B1iSN Guide – 01 Development Environment
B1iSN Guide – 02 Integration Development
B1iSN Guide – 03 Extensibility
B1iSN Guide – 04 Connectivity
B1iSN Guide – 05 Operations
Menu path:
SAP B1iSN Tools=>
Guide=>…
Note:
These guide documents
will be referred in the later
section .
Connectivity Types
B1iSN provides many of out-of-the-box connectivity types
SAP Business One (DI, SQL)
SAP ERP (RFC / ALE/XI-PI)
SAP NetWeaver BW (RFC / SOAP)
Database systems (SQL)
HTTP any
File (CSV, Offset)
Web Services (in/out, sync/async)
For each connectivity type multiple systems can be set up (many to many)
Connectivity types are represented in B1iSN via System Types
Web Services
Supporting Web Services in B1iSN:
B1iSN as Consumer and Provider
Additional Documents Reference:
B1iSN Guide for Web Services
Menu path:
SAP B1iSN Tools=>Guide=>04 Connectivity=>…
Agenda
Build & Run (BPWebService)
Part 1: Introduction to Web Services in B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Test – Send SOAP request to add a new Business Partner
3rd Party Application B1iSNWeb Service Provider
Add /Update a
Business Partner
BizPackage: WebServices
BIU: BPWebService
Call SAP Business One in BIU
Exposing and Hosting a Web Service in B1iSN:
Build and Run BPWebService for SAP Business One
Design Phrase - Exposing a web service in B1iSN:
The web service is implemented as a BIU from W.AnySystem to W.AnySystem. The web service calls B1iSN and waits for a response in a synchronous way.
The logic of the service call is implemented with an additional call to SAP Business One to add or update the business partner in the BIU flow. Note: Calling BAPI, SQL etc is also possible in the main flow of BIU, so are multiple calls.
Run-time Phase - Hosting a web service in B1iSN:
The web service is hosted as a run-time Business Process instance in B1iSN, responsible for receiving the request from external system and handing over to the target BIU for process
The web service BIU will call SAP Business One with the given request payload, adding or updating the business partner.
The web service BIU sends back the response to the external system.
SAP Business One
Add /Update a
Business Partner
Backend
Request
Response
Web Service Configuration
WSDL Generation
Design – BizPackage
Identifier/Name
BizArea
One or multiple sender
One or multiple receiver
Trigger (Event, Scheduler)
Scenario Type (Initial, Process)
Potential Sender Systems
Potential Receiver Systems
BizStep 1
BizStep 2
BizStep 3
BizStep 4
…
bp.Z.XXX_WebServices
Web Services
one
one
http request
process
W.AnySystem
W.AnySystem
XXX_BPWebService
Note: XXX stands for the name space of your company. In order to avoid conflict,
please replace XXX with your company’s name space accordingly.
Design – BizStep
Identifier/Name
Sender SysType
Receiver SysType
Sender Object
Receiver Object
Inbound Task Filter
Data Enrichment
Retrieval Method 1
Retrieval Key 1
Retrieval Method 2
Retrieval Key 2
Properties
Property 1
Property 2
Property 3
Property 4
Property 5
Property 6
XXX_BPWebService
W.AnySystem
W.AnySystem
Z.W.AnySystem_XXX_BusinessPartner (to be created )
Z.W.AnySystem_XXX_BusinessPartner (to be created )
Design – Sender/Receiver Object
SysType
Object Id
Local Object Id
Key Handling
Key Path
Value Mapping
Field 1
Field 2
Field 3
Field 4
…
Service calls
Get
Add
Update
Remove
…
W.AnySystem
Z.W.AnySystem_BusinessPartner (to be created)
2
none
n.a.
n.a.
n.a.
n.a.
Agenda
Build & Run (BPWebService)
Part 1: Introduction to Web Services in B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Test – Send SOAP request to add a new Business Partner
Graphical Design Screen
(Document reference: B1iSN Guide – 02 Integration Development)
The Graphical Scenario Designer gives you a complete overview of particular BizStep/BIUMETA.
It allows you to identify wrong or missing configurations and it allows you to correct the settings
immediately.
To modify a particular BizStep/BIUMETA, choose the relevant BizPackage and BizStep, then
click Button Display.
To open an empty Graphical Design screen, leave BizPackage, BizStep as empty, then click
Button Display.
1
2
3
Generate BizPackage with BIU:
The BIU will be mapped and register as a Web Service later on
Note: Just enter the biz package and biu identifier names starting with XXX, “XXX_BusinessPartner” as sender object type, the system will automatically add the prefix “W.AnySystem_”
2
3
BizPackage Identifier:bp.Z.XXX_WebServices
BizArea:Web Services
BIU Identifier:biu.Z.XXX_BPWebService
Sender SysType:
W.AnySystem
Receiver SysType:
W.AnySystem
Sender ObjectType:Z.W.AnySystem_XXX_BusinessPartner
Receiver ObjectType:Z.W.AnySystem_XXX_BusinessPartner
1
BizPackage & BIU Documents
Result:
The BizPackage Definition Document is generated
/sim.com.sap.b1i.datasync.001/bp.Z.XXX_WebServices/BizPackageMETA.xml
The BIU Documents are generated
The BIU Definition Document
/sim.com.sap.b1i.datasync.001/biu.Z.XXX_BPWebService/BIUMETA.W.AnySystem_W.Any
System.xml
The BIU Version Document
/sim.com.sap.b1i.datasync.001/biu.Z.XXX_BPWebService//version.xml
The BIU Transformation Flow Definition
/sim.com.sap.b1i.datasync.001/biu.Z.XXX_BPWebService//Main.bfd
The BIU Transformation XSL Document
/sim.com.sap.b1i.datasync.001/biu.Z.XXX_BPWebService/biu.Z.XXX_BPWebService.xsl
Graphical overview of BizStep: B1UDO2B1UDO
A green box depicts a specified item, which relevant and correct.
A yellow box depicts a specified item, which is not correct
A red box is displayed in case the item relevant for the scenario,mandatory but not yet specified or missing in the repository.
Object XXX_BusinessPartner to be created
Agenda
Build & Run (BPWebService)
Part 1: Introduction of supporting Web Services within B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Test – Send SOAP request to add a new Business Partner
Graphical overview of BizStep:
XXX_BPWebService
Click new button to create
“XXX_BusinessPartner”
1
Schema: /com.sap.b1i.datasync.repository/ObjectType.xsd/B1.2007_BusinessPartners.xsd
Refer to next slide for how to find the BizStore-URI for the schema of SAP Business One Object
SysType:
W.AnySystem
Object Id:XXX_BusinessPartner
Local Object Id:
2
Value Mapping:
no value mapping
Key Handling:
no key handling
[Save]
[Generate]
[Activate]
3
4
5
[Details]2
Criteria Fields:
no criteria fields
Category:Standard ObjectType
1
Generate Sender/Receiver ObjectType:
Z.B1.8.8_MyUDO
How to find the BizStore-URI for the schema
of SAP Business One Object
1
2
3
Check new ObjectType
Result:Sender and Receiver ObjectType blocks turns green, as new object type XXX_BusinessPartner has been generated.
Agenda
Build & Run (BPWebService)
Part 1: Introduction to Web Services in B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Test – Send SOAP request to add a new Business Partner
Set up System Landscape for Web Service
system
WS_Sys System Type is W.AnySystem.
No connectivity parameters are required as it will be used as
Web Service Provider(Connectivity List (Passive)).
1
2
3
Set up System Landscape for the Target SAP
Business One system
Document Reference about how to create a B1i system for SAP Business One system. : <<$B1iSN_CD\Technology\Documentation\Solution_Operations_Guide_EN_SAP_Business_One_integration_platform.pdf>>
Check the blog How to Build & Run a B12B1 Scenario - BIU.B1PO2B1SO with B1iSN 2007 in
SDN, and follow the chapters 6 and 7 about how to setup a system for SAP Business One system.
It will be used as backend system to add or update
the business partner
Assign the systems to B1iSN
1
2
3
4
Agenda
Build & Run (BPWebService)
Part 1: Introduction to Web Services in B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Test – Send SOAP request to add a new Business Partner
Configure WS Inbound
1
2
3
4
Configure WS Inbound Mapping
1
2
3
BIU Web Service Registration
1
2
3
Generate WSDL
2
1
3
4
Generate WSDL cont.
Note:
You can save the WSDL, then use it for
consuming the web service in external
application
2
1
Agenda
Build & Run (BPWebService)
Part 1: Introduction to Web Services in B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Test – Send SOAP request to add a new Business Partner
Modify the main BizFlow
As explained in the Design we have a W.AnySystem to W.AnySystem BIU.
In order to call B1 we will modify the Main.bfd to add the call to SAP B1, the sequence will
follow then the read lines marked in the following picture:
DI API Call to Add/Update a BP
Modify the main BizFlow:
Adding a xform2hdr atom to prepare the message to send to B1
1
2
3
Create an xsl file(PrepareCall.xsl) transforming the payload for
adding a new Business Partner in SAP Business One
Note:
1.Save the file as “PrepareCall.xsl” locally to be uploaded to BizStore
Actions:
“add” - invoking SAP Business One to add a new Business Partner with the inbound xml.
“update” - updating an existed Business Partner.
“getByKey” - Retrieving a Business Partner with the given BP Code.
……
The right request inbound should be given accordingly.
PrepareCall.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent"
xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms"
xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions"
xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:targetxsl="http://TargetXSLPrefixAlias"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" sim:force="" b1im:force=""
jdbc:force="" rfc:force="" b1ie:force="">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<Envelope xmlns="">
<Header>
<Action>add</Action>
</Header>
<Body>
<xsl:copy-of
select="//b1im:B1IMessage/b1im:Body/b1im:Payload/*"/>
</Body>
</Envelope>
</xsl:template>
</xsl:stylesheet>
Upload the PrepareCall.xsl into BizStore
BizStore-URI:
/sim.com.sap.b1i.datasync.001/biu.Z.XXX_BPWebService/PrepareCall.xsl(unified)
Result:
2
1
3
45
Link the xform2hdr atom with PrepareCall.xsl
XSL:#/sim.com.sap.b1i.datasync.001/biu.Z.XXX_BPWebService/PrepareCall.xsl(unified)
1
2
3
4
Modify the main BizFlow:
Add a single call atom to invoke the Target B1 for adding a new BP
SysId:Target SAP Business One System
Connectivity Type:B1DI
Inline XSL:#/b1im:B1IMessage/b1im:Header/b1im:Z/*
1
2
3
4
5
6
7
8
Implement the transformation in
biu.Z.XXX.B1UDO2B1UDO.xsl
The scenario is copying all response of the call from
SAP Business One back to the external system.
Agenda
Build & Run (BPWebService)
Part 1: Introduction to Web Services in B1iSN
Part 2: Analysis
Part 3: Generate BizPackage with BIU
Part 4: Generate ObjectTypes
Part 5: Set up System Landscape
Part 6: Configure BIU as WebService
Part 7: XSLT implementation
Part 8: Tests – Send SOAP request to add a new Business Partner
Define Business Process instance for
BizPackage XXX_WebServices (1)
1
2
3
4
5
Define Business Process instance for
BizPackage XXX_WebServices (2)
6
7
Activate the Business Process instance
1
2
3
4
Test 1: Trigger the web service to Add a new
BP from wfetch
1
2
3
4
Test preparation
Test Tool: wfetch
Download it from internet.
Path:/B1iXcellerator/exec/soap/<WS.SysId>.inboundRR/com.sap.b1i.datasync.ipo/P71/P71RR.ipo/WS_SynchronIN
Note: Replace the <WS.SysId> with the W.AnySystem system defined in Page#28
User: B1iadmin
Passwd: Your B1iadmin’s password
SOAP Request:<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<BOM>
<BO>
<AdmInfo>
<Object>2</Object>
<Version>2</Version>
</AdmInfo>
<BusinessPartners>
<row>
<CardCode>ZZZZZZ</CardCode>
<CardName>Yatsea Li</CardName>
<Notes>Test from wfetch</Notes>
</row>
</BusinessPartners>
</BO>
</BOM>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Check Message Logs
1
2
B1iMessage
Check result in the target SAP Business One
system
Summary
You should be able to:
Describe the Web Services function in B1iSN
Expose and host a web service for SAP Business One with B1iSN
The End
© 2010 SAP AG. All rights reserved. / Page 33
This presentation and SAP„s strategy and possible future developments are subject to change and may be changed by SAP at any time for any reason without notice. This document is provided without a warranty of any kind,
either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement
© 2010 SAP AG. All Rights Reserved
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.
IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.
Oracle is a registered trademark of Oracle Corporation.
UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.
Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.
HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.
Java is a registered trademark of Sun Microsystems, Inc.
JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.
SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, Clear Enterprise, SAP BusinessObjects Explorer and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.
Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP France in the United States and in other countries.
All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.
The information in this document is proprietary to SAP. No part of this document may be reproduced, copied, or transmitted in any form or for any purpose without the express prior written permission of SAP AG.
This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This document contains only intended strategies, developments, and functionalities of the SAP® product and is not intended to be binding upon SAP to any particular course of business, product strategy, and/or development. Please note that this document is subject to change and may be changed by SAP at any time without notice.
SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, or other items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitation shall not apply in cases of intent or gross negligence.
The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages.
Recommended