Skip to Content

This blog is going to discuss about how to integrate .NET Microsoft applications and SAP ECC using SAP PI, how they will implement code in .NET environment to send request to SAP PI.

We have diffeent options to integrate .NET applications and SAP Systems.

Using SAP .NET connector without using middleware’s .

The SAP .NET Connector is a development environment that enables communication between the Microsoft. NET platform and SAP systems. This connector supports RFCs and Web services, and allows you to write different applications such as Web form, Windows form, or console applications in the Microsoft Visual Studio.Net. With the SAP .NET Connector, you can use all common programming languages, such as Visual Basic. NET, C#, or Managed C++.

Refer below SAP help document to know more about the SAP .NET connector.

http://help.sap.com/saphelp_NW04/helpdata/en/e9/23c80d66d08c4c8c044a3ea11ca90f/content.htm

Using SAP NetWeaver Gateway,

Refer Below link to know more about SAP NetWeaver GateWay

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30bd4b8d-9f7a-2e10-7bba-e407b21a21e4?QuickLink=downloads&overridelayout=true

Recently I had done integration of the .NET Microsoft application and SAP ECC 6.0 using SAP Net weaver Process Integration 7.1 EHP1.

Refer below blog to choose the Right Adapter to integrate with SAP systems; it gives clear picture how to integrate SAP Systems using SAP PI with different approaches.

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2162

How to send the request from .net Application to SAP PI.

PI development process is same as any normal interface, get wsdl/xsd for both request and response structures or define data types manually if the interface is synchronous, asynchronous case you don’t required response structures., then complete ESR part(message type,service interfaces ,message and Operation mappings).

Create SOAP sender communication channel and receiver side (RFC/Proxy/IDoc) then complete configuration in ID and test your development in PI point of view. After that publish your sender agreement in Service registry and provide WSDL URL to .NET application team.

Refer below my blog how to publish service in service registry and how to test interface using WS Navigator.

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/23725

.Net Application team expects WSDL and Service URL from PI Team.

After publishing the sender agreement in service registry (SR)  automatically WSDL URL will be generated share WSDL or you can share the WSDL file by selecting an option display WSDL in Sender agreement.

But the best approach is providing WSDL URL to .NET team because if any structural changes in request/response strcutures then  just publishing the sender agreement in Service registry will automatically update with new structure and WSDL URL remains same ,.NET team have to refresh their environment once to view the new structure.

if you provide WSDL file manually then you have take WSDL file for new structure and have to send one more time (Via Mail),AFAIK it’s not a right approach.

.NET have WCF programming platform to send request to PI,WCF is the place where exactly coding will be done.

Windows Communication Foundation (WCF):

Windows Communication Foundation is a programming platform and runtime system for building, configuring and deploying network-distributed services, Interoperability is the fundamental characteristics of WCF. It is unified programming model provided in .Net Framework 3.0. WCF is a combined feature of Web Service, Remoting, MSMQ and COM+. WCF provides a common platform for all .NET communication.

Stpe1:

After providing the WSDL and Service URL to .net team, first they will add WSDL in their WCF environment;

PS: Make sure that WSDL URL should be accessible in .NET environment.

1NET.png

2NET.png

Step2:

Enter the PI credentials and click on the ok. If SAP WSDL find then it will display the following data, now WSDL structure will be available in WCF environment.

3NET.png

Step3:

They will Name the service in “Namesapce” section. The Service will add under App_WebReferences section with given name in Namesapce.Then Go to Web.config page in ASP.Net Application and add end point address is nothing but service url.

<endpoint address=”http://xxxxxxxxxx.com:59000/XISOAPAdapter/MessageServlet?channel=:BC_SOAP_MyAccounts:CC_MyAccounts_SOORDERS_SOAP_Sender

4NET.png

Step4:

Final step is writing code in coding section in the application, they will add code to access the SAP methods.

SAPServiceName.IXXXXX_OutClient objClient = new SAPServiceName.IXXXXX_OutClient();

objClient.ClientCredentials.UserName.UserName = “***UserName***”;

objClient.ClientCredentials.UserName.Password = “***Password***”;

5NET.png

PS:

1)  In Sync scenarios if response message structure payload huge means sometimes .Net team may face time out expcetions, they have to change theIR configuration details in their environment to accept huge payload as a response.

2)  PI point view make sure that SAP System returns response within expected time.

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Seenuvasan Balakrishnan
    I think..We have been doing the same think..

    But I don’t know does this approach avoiding the XI and directly connecting to the PI system.

    I’m not a SAP person.. I’m a .Net Architect..

    Thanks
    Seenu.

    (0) 
  2. Faycal CHRAIBI
    Hi Raja,

    Interesting insight on the PI / .NET integration, and this could be useful to many. However, this kind of integration is a bit too heavy for what it’s meant to do.

    Wouldn’t it be leaner to use rather ODATA (Rest) ? I would most probably be less costy in terms of efforts and resources. Gateway can be deployed as an add-on to an existing system now (7.0 EHP2 supported only today but 7.03 and 7.3 + 7.01 and 7.1 to come over the next quarters).

    You’ve had just a quick mention of Gateway, but might be interesting to compare both solutions for the same usage.

    (0) 
  3. Alok Sharma
    HI Raja,

    Good blog, as far as i know this is a known process and we have implemented it in 2009. Only thing which is more important, when we capture the Runtime Exception in .Net application say on communication failure, Mapping error etc., There will be two options. One you cature the main brief exception or 2nd you capture the whole detailed inner exception. But most of the business scenarios are where end user can extract the report. Now they are able to see the technical error which is not relevant to them.

    Now i would like to see if you can elaborate more on this area, so that a meaningful message can be written to Business and an actual error can be given to PI support.

    Thanks

    (0) 
    1. Seenuvasan Balakrishnan
      Alok Sharma,

      There is known issue with PI that returns the following exception

      “The one-way operation returned a non-null message with Action=”.”

      You can catch this exception using System.ServiceModel.ProtocolException..

      The error message is “”The one-way operation returned a non-null message with Action=”.”

      More description of this error:
      ==============================
      // == Suppressed this exception==
      // Caused by a SAP/SOAP HTTP 202 response message with no content being
      // returned to the .Net asynchronous web service call. The .Net Framework
      // does not accept the null on the response packet and throws the exception.
      // The SAP/SOAP webservice call is successful in this case, however, and
      // the exception can be ignored. SAP has a patch detailed on released
      // Note 1459995 to correct this issue.
      ======================

      And you can catch any other protocal exception using the same object.. System.ServiceModel.ProtocolException..

      ======================
      For all another exception, we are following the normal exception catch..
      ======================

      (0) 

Leave a Reply