Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.

Applies to:
EHP 1 for SAP NetWeaver Process Integration (PI) 7.1 SP 02

Summary:
This article shows how Web standards based interoperability between Microsoft .NET 3.5 Framework and EHP 1 for SAP NetWeaver Process Integration 7.1 works. The focus is on showing how you can setup a sample scenario between a .NET client application and an ABAP backend system by using PI. The scenario is based on the delivered standard SFLIGHT demo. Author: Markus Hardank

Company: SAP Deutschland AG & Co KG Created on: 21 June 2010

Author Bio:
Markus Hardank, SAP Deutschland AG & Co KG, PI development consultant.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 1

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Table of Contents
Introduction ......................................................................................................................................................... 3 Scenario Overview .............................................................................................................................................. 3 Setup Certificates ............................................................................................................................................... 4 Prerequisites ................................................................................................................................................... 4 Configuration Steps in PI ................................................................................................................................ 4 Configuration on .NET Client .......................................................................................................................... 8 Setup Scenario in EHP 1 for SAP NetWeaver PI 7.1 ....................................................................................... 11 Prerequisites: ................................................................................................................................................ 11 Design in ES Repository ............................................................................................................................... 11 Configuration in Integration Directory ........................................................................................................... 12 Setup in Microsoft Visual Studio ....................................................................................................................... 16 Prerequisites: ................................................................................................................................................ 16 Development in Microsoft Visual Studio ........................................................................................................... 18 Run the Scenario .............................................................................................................................................. 20 Related Content ................................................................................................................................................ 21 Copyright........................................................................................................................................................... 22

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 2

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Introduction
With EHP 1 for SAP NetWeaver Process Integration and Microsoft .NET framework 3.5 a lot of Web standards are supported. And with the SAP Enterprise Service Explorer for .NET an add-in is available for Microsoft Visual studio 2005 and 2008 to easily access Enterprise Services in your Services Registry and generate the proxy skeletons. Now this also works in the area of security without any additional customer bindings. It is possible to directly start coding your client coding and access the backend via SAP NetWeaver Process Integration. In the scenario the authentication is based on X.509 certificates. Therefore, the guide gives a short overview how to get certificates and what steps are required to make the whole thing working. To make it easily reproducible without much configuration effort on the PI side I extend the standard SFLIGHT demo scenario.

Scenario Overview
The figure below shows our scenario. We use the FlightAvailabilityCheck as part of the SFLIGHT demo scenario to check from a .NET flight booking client the availability of a flight in the airline backend system. Therefore it is necessary to setup the SFLIGHT demo scenario as described in the configuration guide.

Focus in this guide

.Net 3.5
Client application WS X.509 Certificate

PI
XI (SFLIGHT standard)

ABAP Backend

Standard SFLIGHT demo

In this article we concentrate to call the FlightAvailabilityCheck Web service from a simple .NET flight booking system. The communication is based on https. For authentication at the PI system we use an X.509 certificate.

Note: In this scenario we focus on the mediated configuration. It is of course also possible to use direct communication (direct connection object) if you do not need the additional functionality provided by PI (routing, mapping). In this case you have to create an additional inbound interface on the PI side and create a new proxy for this interface on the ABAP system. The direct connection configures the ABAP system via cash notifications. The .NET application uses the WSDL from the direct connection object.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 3

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Setup Certificates
Prerequisites Your system is already configured to use https.

Configuration Steps in PI For the further configuration steps you need a public key infrastructure. Especially the following is required: A public/private key pair for the .NET client application (created by a trusted Root CA) An SSL certificate for the PI server (signed by a trusted Root CA) A root CA public certificate

Note: Currently only V1 certificates are supported on AS ABAP. You can check the certificate version by double clicking on the certificate and then under Details.

If you want to setup your own certificate authority and create and sign certificates open ssl might be an interesting tool. For configuration we already have the necessary certificates and install them in the involved systems. In the PI system, go to transaction STRUST and import the Root CA certificate.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 4

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

After the import, export the certificate to the database under category Root CA.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 5

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Then create a certificate request and send it to your CA to sign it (also in transaction STRUST).

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 6

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

After you have received the signed response from your CA, import it in transaction STRUST.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 7

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

After a successful import of the response from the CA you can see that the (Self-Signed) marking disappears. Configuration on .NET Client On the .NET client application you have to install the public/private key pair in the personal certificate store and the root certificate of your CA. In the Microsoft environment it is pretty simple. Just click on your certificate and follow the wizard.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 8

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 9

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Repeat the procedure for the Root CA certificate.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 10

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Setup Scenario in EHP 1 for SAP NetWeaver PI 7.1


Prerequisites: SFLIGHT Demo is configured.

Design in ES Repository We want to use the Web services runtime and we do not want to change the SAP Basis software component. Therefore I just recreate the necessary objects in a new software component.

If you use other message types in your interface than the ones used in the standard scenario you of course also have to create the corresponding message and operation mapping.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 11

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Configuration in Integration Directory You can now start with the configuration in the Integration Directory. Create a business component with the corresponding communication channels. Then create Sender Agreement, Receiver Determination, Interface Determination and Receiver Agreement. I created a configuration scenario for putting them all together there.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 12

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Here you can decide on the complexity of the scenario. I deleted the conditions and only added one airline (LH) for simplicity reasons.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 13

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Publish the service to the service registry

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 14

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

In the Integration Directory go to the Sender Agreement and select Sender Agreement Publish in SR

Just follow the wizard for publication.

Afterwards you can check in the SR via http://<host>:<port>/sr if the service is available there.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 15

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Setup in Microsoft Visual Studio


Prerequisites: Installed Microsoft Visual Studio 2005 or Microsoft Visual Studio 2008 Installed .NET 3.5 framework Installed SAP Enterprise Service Explorer for .Net

In Visual Studio, logon to the Services Registry and search for your service interface. Find further information on how to work with SAP Enterprise Service Explorer in the related content section.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 16

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 17

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Development in Microsoft Visual Studio


Start developing your coding. An example coding could look like this:
using using using using using using using System; System.Collections.Generic; System.Linq; System.Text; System.Security.Cryptography; System.Security.Cryptography.Xml; System.Security.Cryptography.X509Certificates;

namespace CheckFlightAvailability { class Program { /* * Function for * printout of the results * */ static void PrintResults(CheckFlightAvailabilityService.FlightCheckAvailibilityResponse result) { if (result.Availibility != null) { Console.WriteLine("Connections found: " + "\n"); Console.WriteLine("Availability"); Console.WriteLine("----------"); Console.WriteLine("Economax: " + result.Availibility.Economax); Console.WriteLine("Econofree: " + result.Availibility.Econofree); Console.WriteLine("Businmax: " + result.Availibility.Businmax); Console.WriteLine("Businfree: " + result.Availibility.Businfree); Console.WriteLine("Firstmax: " + result.Availibility.Firstmax); Console.WriteLine("Firstfree: " + result.Availibility.Firstfree); } else { Console.WriteLine("No seats available."); } } /* * Function for searching for the right certificate in the * personal certificate store of the current user. * */ static public X509Certificate GetCertificates() { //Open the My certificate store. X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); certStore.Open(OpenFlags.ReadOnly); X509Certificate myCert = null;

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 18

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

/* * Loop through each certificate and find the certificate * with the appropriate name. */ foreach (X509Certificate c in certColl) { if (c.Subject.Contains("CN=testapplication")) { myCert = c; break; } } if (myCert == null) { throw new CryptographicException("The X.509 certificate could not be found."); } certStore.Close(); return myCert; }

static void Main(string[] args) { try { // select flight //ServiceReference.FlightCheckAvailibility request = new ServiceReference.FlightCheckAvailibility(); CheckFlightAvailabilityService.FlightCheckAvailibility request = new CheckFlightAvailability.CheckFlightAvailabilityService.FlightCheckAvailibility(); request.AirlineID = "LH"; request.ConnectionID = "0400"; request.FlightDate = "2009-07-01"; // get authorization CheckFlightAvailabilityService.XI_29ca1bec399a3542a816430312c033f1_Service service = new CheckFlightAvailability.CheckFlightAvailabilityService.XI_29ca1bec399a3542a816430312c 033f1_Service(); service.ClientCertificates.Add(GetCertificates());

// trust all CAs // System.Net.ServicePointManager.ServerCertificateValidationCallback = // ((sender, certificate, chain, sslPolicyErrors) => true);

//ServiceReference.FlightCheckAvailibilityResponse result = // service.OB_CheckFlightAvailability(request); CheckFlightAvailabilityService.FlightCheckAvailibilityResponse result = service.OB_CheckFlightAvailability(request);

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 19

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Console.WriteLine("Press any key print results. "); Console.Read(); PrintResults(result); Console.WriteLine(" "); Console.WriteLine("Press any key close application. "); Console.Read(); } catch (Exception e) { Console.WriteLine(e.ToString()); Console.Read(); } } } }

We are now ready to test the scenario.

Run the Scenario


For testing the sample application just press STRG + F5 in Microsoft Visual Studio. A list of available seats for the selected flight is displayed.

In PI you can monitor the messages in transaction sxmb_moni, since we use the Web Services Runtime and everything is processed in the AS ABAP part of PI.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 20

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Related Content
.NET Interoperability on SDN SAP NetWeaver Process Integration Security Guide SAP NetWeaver Process Integration Demo Examples Configuration (SAP EHP 1 for NetWeaver PI 7.1) Introducing SAP Enterprise Services Explorer for Microsoft .NET Consuming SAP Enterprise Services with Microsoft .NET Framework 3.0 Take It ESE! Web Services Security Interoperability between SAP NetWeaver 7.0 and Microsoft Windows Communication Foundation (WCF) Part I Web Services Security Interoperability between SAP NetWeaver 7.0 and Microsoft Windows Communication Foundation (WCF) Part II Web Services Security Interoperability between SAP NetWeaver 7.0 and Microsoft Windows Communication Foundation (WCF) Part III

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 21

Interoperability between Microsoft .Net 3.5 and EHP 1 for SAP NetWeaver PI 7.1

Copyright
Copyright 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, SAP Business ByDesign, 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 Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company. 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. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

SAP COMMUNITY NETWORK 2010 SAP AG

SDN - sdn.sap.com | BPX - bpx.sap.com | BOC - boc.sap.com | UAC - uac.sap.com 22

You might also like