Friday, May 23, 2008

Defining the Interface using Integration builder

In the previous steps I am done with setting the prereqs to start defining an interface in the ESR. I started with defining the interface now. Here are the steps
1) Login to the PI system
2) Double click on User Menu -> Exchange Infrastructure ->SXMB_IFR - Start Integration Builder. Alternatively execute the transaction SXMB_IFR.
3) This should open an internet explorer window with links to various tools. Click on Integration Repository
4) Step 3 would download and install a Java application (jnlp file) to your system
5) Provide credentials to login to the integration builder
6) Once the integration builder starts go to Tools -> Transfer from System Landscape Directory -> Import Software Component Versions
7) Select the software component in which we want to develop our interface and import it
8) Once we do this select the Software Component Version in the left naviagtion menu. Right click and add a namespace in which we would be doing the development
9) Expand the interface objects -> Data Types and right click on Data Types to add Data Types
10) Add the Data Types Employee, EmployeeId, Name

Here's how various structures look like after editing them using Integration Builder ...

a) Name
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.office.tst" targetNamespace="http://sap.office.tst">
<xsd:complexType name="Name">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
1a2def0028c111dd8c9c000bcd9b93dd
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
93b077b028aa11ddcc0b001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LastName" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
93b077b128aa11ddb07c001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>


b) EmployeeId
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.office.tst" targetNamespace="http://sap.office.tst">
<xsd:simpleType name="EmployeeId">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
b58a93e028c111ddcfe2000bcd9b93dd
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
</xsd:schema>


c) Name
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.office.tst" targetNamespace="http://sap.office.tst">
<xsd:complexType name="Name">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
1a2def0028c111dd8c9c000bcd9b93dd
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
93b077b028aa11ddcc0b001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LastName" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
93b077b128aa11ddb07c001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

Next we go ahead and define 2 Message Types as input and output message of the operation we want to define in our wsdl . ( I am unable to find how to have more then 2 messages in my interface for wsdl and hence i am adding only 2 Message Types as off now. To Add a message type in the Navigation Tree we can right click on Message Type and add a new one

Here are 2 schemas of 2 message types i added

a) GetEmployeeInput
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.office.tst" targetNamespace="http://sap.office.tst">
<xsd:element name="GetEmployeeInput" type="EmployeeId" />
<xsd:simpleType name="EmployeeId">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
02f3c70028c211ddad54000bcd9b93dd
</xsd:appinfo>
</xsd:annotation>
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
</xsd:schema>

b) GetEmployeeOutput
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://sap.office.tst" targetNamespace="http://sap.office.tst">
<xsd:element name="GetEmployeeOutput" type="Employee" />
<xsd:complexType name="Employee">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
886faed028c211dd8216000bcd9b93dd
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Id" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
4ca5845028aa11ddb1c2001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Name" type="Name">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
4ca5845128aa11ddb4a1001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Name">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
88721fd228c211ddb301000bcd9b93dd
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
93b077b028aa11ddcc0b001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="LastName" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
93b077b128aa11ddb07c001321f4509b
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Once done with adding these 2 MessageTypes i have added a MessageInterface to my little POC using the Add New MessageInterface wizard which we again get by right clicking the MessageInterfaces node on the navigation tree in my SCV
Here's where my confusions have started as there are various options on what type of Message Interfaces do i want. So i am stopping this blog post here and would write the next steps in my next post.....

~Abhishek

PS: Its relatively simple to write a service in .NET since we follow inside out approach of defining a wsdl i.e. we define our classes first and wsdl is generated out of the box by the Visual Studio. This approach is time consuming however this way i have more control over how my wsdl, schemas etc. should look like so i like this more then .NET :) . Its taking lot of time since it is my first time i am doing this however i am sure with time it would become easier for me to use outside in approach of defining a web service.....

No comments: