Thursday, May 09, 2019

Connect to your on-premises SAP system from Azure Logic Apps (III)

In this post, we will invoke directly to a RFC on our on-premises SAP from our Logic App. This post continues the series of SAP Connector for Azure Logic Apps.

You can see the previous post:
In the last post:
  • We configure a SAP connection through On-Premise Data Gateway
  • We create a Logic App to export schemas from a Logic App through the SAP connection.

In this post we will invoke the RFC from SAP SLDAG_GET_MESSAGE_SERVER_INFO. First we get the schemas for this operation using a similar Logic App that we developed in Connect to your on-premises SAP system from Azure Logic Apps (II) 

The exported schema is this:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://Microsoft.LobServices.Sap/2007/03/Rfc/" version="1.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <fileNameHint
        xmlns="http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd">Rfc
      </fileNameHint>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="SLDAG_GET_MESSAGE_SERVER_INFO">
    <xs:annotation>
      <xs:documentation>
        <doc:action
          xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">http://Microsoft.LobServices.Sap/2007/03/Rfc/SLDAG_GET_MESSAGE_SERVER_INFO
        </doc:action>
        <doc:description
          xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">The Metadata for this RFC was generated using the .Net Connector.
        </doc:description>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence />
    </xs:complexType>
  </xs:element>
  <xs:element name="SLDAG_GET_MESSAGE_SERVER_INFOResponse">
    <xs:annotation>
      <xs:documentation>
        <doc:action
          xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">http://Microsoft.LobServices.Sap/2007/03/Rfc/SLDAG_GET_MESSAGE_SERVER_INFO/response
        </doc:action>
        <doc:description
          xmlns:doc="http://schemas.microsoft.com/servicemodel/adapters/metadata/documentation">The Metadata for this RFC was generated using the .Net Connector.
        </doc:description>
      </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="1" name="HOSTNAME" nillable="true">
          <xs:annotation>
            <xs:documentation>Interface Parameter for SLD Agents: Single Value</xs:documentation>
          </xs:annotation>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:maxLength value="255" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="1" maxOccurs="1" name="PORTNUMBER" nillable="true">
          <xs:annotation>
            <xs:documentation>Interface Parameter for SLD Agents: Single Value</xs:documentation>
          </xs:annotation>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:maxLength value="255" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element minOccurs="1" maxOccurs="1" name="SERVICENAME" nillable="true">
          <xs:annotation>
            <xs:documentation>Interface Parameter for SLD Agents: Single Value</xs:documentation>
          </xs:annotation>
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:maxLength value="255" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

As you can see, this operation hasn't input parameters and returns HOSTNAME, PORTNUMBER and SERVICENAME.

Then, if we want to invoke, we have to use SAP - Send message to SAP (preview) connector with these parameters:
  • SAP Action:
http://Microsoft.LobServices.Sap/2007/03/Rfc/SLDAG_GET_MESSAGE_SERVER_INFO
  • Input Message:
<SLDAG_GET_MESSAGE_SERVER_INFO xmlns="http://Microsoft.LobServices.Sap/2007/03/Rfc/" />



If we want to return the response for this RFC in our HTTP Respose, in the response shape we set as Body = @body('Send_message_to_SAP').


Now we can try this HTTP Request-Response operation from Postman, for example and this is the response:


<SLDAG_GET_MESSAGE_SERVER_INFOResponse xmlns="http://Microsoft.LobServices.Sap/2007/03/Rfc/">
    <HOSTNAME>myhostname</HOSTNAME>
    <PORTNUMBER>3600</PORTNUMBER>
    <SERVICENAME>sapmsPPP</SERVICENAME>
</SLDAG_GET_MESSAGE_SERVER_INFOResponse>

In the next post I will explain troubleshooting with this connector.

No comments: