Thursday, April 24, 2014

Creating Consumer Proxy for MII Interface


xMII - MII is another system developed/bought by SAP which also acts as a Middleware. It is similar to PI but this system is specifically used for Shop Floor integration.

I will try to write another post explaining about MII(as much as I know :) ) but in this post the main aim is to explain as how to create a Consumer Proxy on SAP for an MII interface using a WSDL generated by the SOAP interface on MII.

There is restriction at SAP level that only 1 Interface is allowed per package. So, to overcome this restriction, we followed a method of creating sub-packages under 1 package and then 1 MII Proxy in 1 subpackage. This was actually proposed by SAP themselves when we raised a message.

So, first step is create a new Package(SPACKAGE is the tcode), this will be the main package or header package. Now, for our proxy, create another package in the same transaction and add it as the sub-package. Below snapshot shows package with multiple sub-packaged under it.(Tcode SPACKAGE)


Once the package is ready, go to SE80 and display the header package created. You will see all the sub-packages under it, right click on the appropriate package and say Create - Enterprise Service as shown below,



Next pop-up will ask you with option as what kind of Enterprise Service do you want to create.

NOTE: Based on SAP Version, the wizard screens might look different to what I have here but it should have the option I have selected in my images.

Select the Service Consumer radio button, click on next,


In the next screen, select the type of source, in our current scenario its WSDL,


Next screen is the location where we have our source, if we have the downloaded WSDL with us then select the Local File radio button and click on Continue, if you know the WSDL URL then select the URL radio button, similarly select the appropriate radio button. Click on Next,

Based on above option, the way next screen looks changes. If you have selected the WSDL and Local File as the option, then in the next screen give the location on the desktop where you have the file. Click on next, and the next screen is the final screen where you specify the Package Name, Transport Number and also the Prefix for the Proxy name.


Once you click on Finish, necessary Data Structures, Classes and methods get generated which needs to be called in your report to trigger the proxy and send data to MII.

SOAMANAGER Configuration:

Now, we have our Webservice ready on ABAP point of view. But now we would need to configure in webservice to point to target system using SOAMANAGER(Used to be tcode WSADMIN).

Open a new session and go to transaction SOAMANAGER:

1.   This transaction will generate another IE session (some times you must have an existing session open for this to work). Go to the Application and Scenario Communication tab and select the Single Service Administration link.(On new versions, it is Webservice Configuration on Service Administration Tab)


1.      In the Search tab screen Select Consumer Proxy, enter the proxy name that was created on your SAP system in the Search Pattern, select  Both Names in the Field and select the Go button.  


1.   Select the row for your proxy and hit the Apply Selection button. Then select the Create Logical Port button.
a   

Now, we have to create 2 logical ports, one is to copy few system settings from WSDL and the other one is actual port to connect to target system. Reason for 2 ports is, in the actual port we will be using we would need system information which we can copy from the 1st port we created using WSDL data.

Create Automatic Logic port using WSDL:

Click on Create Logical Port, in the pop-up select WSDL based, and Via File Radio button.



Now, create a second Create a Logical Port with configuration type Manual.


Click on Apply Settings and this will later generate a third set of screens where you can enter user name and password. This user-id is to connect to MII system to trigger that webservice.


Start another session of SOAMANAGER and navigate to transport setting tab of the original logical port(created based on WSDL) and copy the settings from that port to the Manual logical port-Transport settings tab.

Once copied, save the web service configuration.
Now, you can delete the first port you have created and make this port as the default port.

Now, you can write a function module(SE37) to call the Proxy we created initially and test if the trigger is sent to MII or not.

This process of setting up SOAMANAGER I have explained is not specific to MII, it would be same to any webservice which you want to consume on SAP, if you do not have PI as the middleware. If you have PI, we wouldnt need to do any SOAMANAGER configuration as everything will be through PI.

Currently I am working on setting up SAP delivered ESR and also Custom webservice through PI, I will try to write a blog on the same once I have it fully working :).