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.....

Settnig the prereqs.....

According to various documents on SDN i found out that ESR will be the repository in which the interface of a service will be stored. While the implementation of this system will lie in a business system
Now the first question is how to define the interface. The tool which can be used for defining this interface is Integration Builder. Now in order to work with the Integration builder one needs a Software Component Version and for defining a Software Component Version one needs to have a Product.
So the first step is to create a Product. Here are the steps to do this
1) Login to your PI system
2) Double click on User Menu -> Exchange Infrastructure -> Administration -> SLDCHECK - Test SLD Connection. Alternatively execute transaction SLDCHECK
3) Step 2 should open the SLD UI in an internet explorer
4) Click on the link Products
5) Add a new Product Version by clicking "New Product Version"
6) Come back to the SLD UI in internet explorer (You can use Home link on your page or use the back button in the browser)
7) Click on the Software Components link
8) Add a New Software Component Version by clicking the button
9) In the Add New Software Component Version Select the product as the product you defined in the step 5
Once we are done with this we have got the first 2 prerequisites ready to develop our interface.
Next is to use the integration builder to start defining the interface....

~Abhishek

Initial setup

After struggling through at least 30-40 pdf documents on SDN over 100 google searches i finally figured out a system where SAP allows me to develop and test in
The system is HU6 and the details can be found in ES Workplace handbook Page 67.(https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d91e4d16-0b01-0010-57b5-c4473111136f)
There are some very specific settings which you need to do if you are accessing this system from your corporate machine. Its actually a DMZ system and you need SAP Log on to access this system.
If you are in SAP Corporate network then you need not enter any SAP Router String which is given inside the above document.
Anyways by the time i figured out the workaround to access this system i figured out a SAP internal system with a similar BASIS Component release which is there on the system HU6 which you can use for your development. Most of the things in the blog series i would be posting should work as it is on HU6.
So my intial setup was over as soon as i configured HU6 i knew i have access to a XI system which by this time i came to know is called PI and not XI anymore.
For anyone out there who wants to play with PI add HU6 system to your SAP Log on utility and off you go....
I would play with ESR now....
~Abhishek

Playing with ESR and XI

After struggling with SAP systems from outside for around 3 years now i decided to go and do something inside it. I say struggling from outside since all i did with SAP systems till now was to look at the interfaces and consume the interfaces to make something in .NET world or to look at the Netweaver screens with horror, look at the ABAP developers in awe as to how they work on such complex looking UI and look at the ABAP technology stack as a neutral observer and sometimes criticising it.
This time i decided to go in and develop at least something in the Netweaver ABAP stack myself and get rid of this fear, awe and helplessness when some discussion happens around ABAP stack.

So here's the POC which i decided to do around a week back
1) Define a simple service interface in ESR
2) Provide an implementation in ABAP stack
3) Consume the service from .NET and prove that service works

Over the period of last week it gor refined to
1) The service should have 2 methods GetEmployeeIds and GetEmployeeById
2) Use ESR, XI Integration builder and implement the service in ABAP

I'll be posting my struggles in a series of blogs and will tag this series with ESR/XI/PI

~Abhishek

Sunday, April 20, 2008

Microsoft .NET team spoiled my weekend

Well the plan for the triple thrill weekend went for a toss and culprit is me and Microsoft. Me for making certain basic assumptions about .NET as a framework and Microsoft for breaking those assumptions :).

Well so here's an interesting fact.
If you have .NET Framework 3.0 installed on your system, it doesn't mean that you have the .NET framework 2.0 SP1 class library as well on your system.

Yeah really i ain't kidding here...
According to the msdn (http://msdn2.microsoft.com/en-us/library/bb822049.aspx) .NET framework 3.0 installer would install 3.0 on top of 2.0 or 2.0 SP1 whatever is available on your system. Now .NET 2.0 SP1 gives some extra classes (I used DateTimeOffset in my code) .

The assumption i made was that if the user has .NET 3.0 on her system of course the class would be available since if a class is present in .NET 2.0 SP1 it won't be absent in a higher version. However it is not true. I can't blame MSFT since they documented it however the fun is that if i install .NET 3.0 SP1 then i have that class again.

So the matrix becomes ...
1) .NET 2.0 Class not available
2) .NET 2.0 SP1 Class is available
3) .NET 3.0 May or may not be available
4) .NET 3.0 SP1 Class is Available


and the 3rd line in the matrix is what spoiled my previous weekend. I got a call from office on a saturday that things are not working and throwing a runtime exception and i had to cancel my all weekend travel plans to figure this out.

Well what can i say except that yeah its a mess up done by me (Since i didn't read the documentation) however i still believe folks at Microsoft messed up.
I think its a happened of deadlines and schedules of the framework release ....

So its a lesson for me that now on i would never believe on classes introduced in SP releases of .NET framework....

~Abhishek

Friday, April 11, 2008

Duplicate e-mails detection by a mail client

This is the topic i worked on for last 2 days and i still do not have a certain answer. Basically i was trying to find out how can a mail client like outlook or may be Exchange server detect a duplicate message.
The scenario i considered is like the following
I send a mail from a@a.com to d@d.com. Now there can be 2 paths from SMTP server for a.com to SMTP server d.com and the paths are a.com->b
.com->d.com and a.com->c.com->d.com Now what happens if a.com relays the message to both b.com and c.com . This can be because of a bug or may be because of some implementation logic. In such a case d.com would receive the same mail twice and then the question is will the SMTP server at d.com or a mail client for d@d.com be able to detect that it is the same copy of 2 messages.
Me and my colleagues' thoughts on looking at the mail headers of various mails in our inbox was that the Message-Id parameter in the message header should help detect and delete/merge such duplicates.
So i did a simple POC by sending 2 messages with same message id (even same header) to my inbox. And i got 2 messages in my inbox as well :(.
Now the question is, is it a exchange/outlook bug or a feature. I still do not have an answer. I'll be trying it for my gmail account soon.
In the meantime i got SMTP specs by Jonathan Postel on http://www.ietf.org/rfc/rfc0821.txt and a cursory look at it makes me conclude 2 things
1) An ideal SMTP server would never do something as crazy as i am thinking (It very clearly discusses the protocol for relaying a message from 1 SMTP to another and i kind of feel that it would do it only to 1 SMTP server and would jump to next only when it gets an error code. No clue on what happens if other SMTP goes down after receiving this message and before giving a OK)
2) Message Id is something we can't rely on as primary key for an e-mail message as it is quite possible that there are malicious SMTP servers which can change the header while mail is passing through their place.

So on the whole my current feeling is ideally the duplicate e-mails won't be generated and if they are then there's no fool proof way to figure them out and merge them at the destination server/ mail client.


~Abhishek

PS :- I am off for triple thrill of Climbing, burma bridge and rappelling this weekend. Will write a post on that once back and some more details on the above topic as well :)

Sunday, April 6, 2008

Conquering the nandi hills on foot

Finally after a long time I did what i wanted to do long back :)
We trekked the nandi hills on foot...
Well the idea was to go to Kalvarhalli Beta (Henceforth K-Beta) for a trek with 4 friends however that didn't work out. We had planned to start at 4 in the morning and the start got delayed by an hour and a half (As usual when its waking up early in the morning me and all my friends are late :) ) Anyhow we started off from my place at 5.30 in the morning and on the way decided to go to nandi hills instead of K-Beta as it would be damn hot by the time we figure out our original destination.
My first reaction in the morning when we got up was forget trekking we'll just go on a drive and be back however by the time we reached nandi hills i was all pumped up :)
So as soon as we reached nandi hills (Around 6.30 ) we did a small trek on a small hill first so as to warm ourselves up and see if we can catch clouds on the peak of this small hill. As luck would have it by the time we reached to the peak the clouds were gone :(
Anyhow it served as a nice warm up trek (4 Kms) for us and the next in line was Nandi hills waiting to be conquered.
So we came down, had a nice breakfast and started Nandi hills trek on foot at around 8.30 AM. On the way we got some nice patches and the brutal sun. By 11.30 AM we were up on Nandi hills and it was quite tiring to walk all the way up. Once up all of us jumped on all the water, melons, anything which can rehydrate us...
We killed some time on the top and then everyone was of the opinion to take a bus back however on persistent pleas made by me and because we had to wait for the bus for at least 45 mins. we all decided to walk all the way back and damn it was fun.
Specially the last 4 Kms as everyone was stretched out of their limits and that's what the treks are meant for. To cross the boundaries of your physical limitations (Wow i can't believe i came up with that :D )
At the end we all reached the foot of the hill and somehow made it back to Bangalore. All tired and dehydrated it was a fun trek and the good thing was to see that the sunburn hit me back after the ski vacation in Auli.
We made a total walking of around 20 Kms during the day :)
At the end of it as they say pictures speak.....
Here are a couple of them from my camera





~Abhishek