SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Consume SOAP Based Web Services with SAP BTP, ABAP Environment

Consume SOAP based web services with SAP BTP, ABAP environment.

Overview

🎓 beginner 15 min. SAP BTP ABAP EnvironmentBeginnerABAP DevelopmentSAP Business Technology Platform

You will learn

  • โœ”How to save WSDL files
  • โœ”How to create ABAP package
  • โœ”How to create service consumption models
  • โœ”How to create ABAP classes
  • โœ”How to consume SOAP based web services
Merve Temel M Merve Temel March 21, 2023
Created by March 21, 2023
Contributors

Prerequisites

Prerequisites

  • You need an SAP BTP, ABAP Environment trial user or a license.

Steps

Step 1 Save WSDL file
โ€”

  1. Save following code snippet as EPM_Product_SOAP.WSDL. This WSDL file will be used in the next steps.

    WSDL
    
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://sap.com/EPM_PRODUCT_SOAP" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" targetNamespace="http://sap.com/EPM_PRODUCT_SOAP">
    <wsdl:documentation>
    <sidl:sidl xmlns:sidl="http://www.sap.com/2007/03/sidl"/>
    </wsdl:documentation>
    <wsp:UsingPolicy wsdl:required="true"/>
    <wsp:Policy wsu:Id="BN__EPM_Product_SOAP">
    <wsp:ExactlyOne>
    <wsp:All>
    <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
    <saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional="true"/>
    <wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
    </wsp:All>
    <wsp:All>
    <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
    <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" uri="http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true"/>
    <wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
    </wsp:All>
    </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="BN__EPM_Product_SOAP_soap12">
    <wsp:ExactlyOne>
    <wsp:All>
    <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
    <saptrnbnd:OptimizedMimeSerialization xmlns:saptrnbnd="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization" wsp:Optional="true"/>
    <wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
    </wsp:All>
    <wsp:All>
    <sapattahnd:Enabled xmlns:sapattahnd="http://www.sap.com/710/features/attachment/">false</sapattahnd:Enabled>
    <saptrnbnd:OptimizedXMLTransfer xmlns:saptrnbnd="http://www.sap.com/webas/710/soap/features/transportbinding/" uri="http://xml.sap.com/2006/11/esi/esp/binxml" wsp:Optional="true"/>
    <wsaw:UsingAddressing xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" wsp:Optional="true"/>
    </wsp:All>
    </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="IF__EPM_Product_SOAP">
    <wsp:ExactlyOne>
    <wsp:All>
    <sapsession:Session xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/">
    <sapsession:enableSession>false</sapsession:enableSession>
    </sapsession:Session>
    <sapcentraladmin:CentralAdministration xmlns:sapcentraladmin="http://www.sap.com/webas/700/soap/features/CentralAdministration/" wsp:Optional="true">
    <sapcentraladmin:BusinessApplicationID>0050568C901D1ED79182D1F2706880F5</sapcentraladmin:BusinessApplicationID>
    </sapcentraladmin:CentralAdministration>
    </wsp:All>
    </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="OP__get_price">
    <wsp:ExactlyOne>
    <wsp:All>
    <saptrhnw05:required xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/">no</saptrhnw05:required>
    <sapcomhnd:enableCommit xmlns:sapcomhnd="http://www.sap.com/NW05/soap/features/commit/">false</sapcomhnd:enableCommit>
    <sapblock:enableBlocking xmlns:sapblock="http://www.sap.com/NW05/soap/features/blocking/">true</sapblock:enableBlocking>
    <saprmnw05:enableWSRM xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/">false</saprmnw05:enableWSRM>
    </wsp:All>
    </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>
    <xsd:schema xmlns="http://sap.com/EPM_PRODUCT_SOAP" targetNamespace="http://sap.com/EPM_PRODUCT_SOAP">
    <xsd:element name="fault_msg_type">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="error_text" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="req_msg_type" type="req_data_type"/>
    <xsd:element name="res_msg_type" type="res_data_type"/>
    <xsd:complexType name="req_data_type">
    <xsd:sequence>
    <xsd:element name="product">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:length value="10"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="res_data_type">
    <xsd:sequence>
    <xsd:element name="price">
    <xsd:simpleType>
    <xsd:restriction base="xsd:decimal">
    <xsd:totalDigits value="15"/>
    <xsd:fractionDigits value="2"/>
    <xsd:maxInclusive value="9999999999999.99"/>
    <xsd:minInclusive value="0"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="currency">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:length value="5"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name="req_msg_type">
    <wsdl:part name="req_msg_type" element="tns:req_msg_type"/>
    </wsdl:message>
    <wsdl:message name="res_msg_type">
    <wsdl:part name="res_msg_type" element="tns:res_msg_type"/>
    </wsdl:message>
    <wsdl:message name="fault_msg_type">
    <wsdl:part name="fault_msg_type" element="tns:fault_msg_type"/>
    </wsdl:message>
    <wsdl:portType name="EPM_Product_SOAP">
    <wsp:Policy>
    <wsp:PolicyReference URI="#IF__EPM_Product_SOAP"/>
    </wsp:Policy>
    <wsdl:operation name="get_price">
    <wsp:Policy>
    <wsp:PolicyReference URI="#OP__get_price"/>
    </wsp:Policy>
    <wsdl:input message="tns:req_msg_type"/>
    <wsdl:output message="tns:res_msg_type"/>
    <wsdl:fault name="fault_msg_type" message="tns:fault_msg_type"/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="EPM_Product_SOAP" type="tns:EPM_Product_SOAP">
    <wsp:Policy>
    <wsp:PolicyReference URI="#BN__EPM_Product_SOAP"/>
    </wsp:Policy>
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <wsdl:operation name="get_price">
    <soap:operation soapAction="http://sap.com/EPM_PRODUCT_SOAP/EPM_Product_SOAP/get_priceRequest" style="document"/>
    <wsdl:input>
    <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
    <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="fault_msg_type">
    <soap:fault name="fault_msg_type" use="literal"/>
    </wsdl:fault>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="EPM_Product_SOAP_soap12" type="tns:EPM_Product_SOAP">
    <wsp:Policy>
    <wsp:PolicyReference URI="#BN__EPM_Product_SOAP_soap12"/>
    </wsp:Policy>
    <wsoap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <wsdl:operation name="get_price">
    <wsoap12:operation soapAction="http://sap.com/EPM_PRODUCT_SOAP/EPM_Product_SOAP/get_priceRequest" style="document"/>
    <wsdl:input>
    <wsoap12:body use="literal"/>
    </wsdl:input>
    <wsdl:output>
    <wsoap12:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="fault_msg_type">
    <wsoap12:fault name="fault_msg_type" use="literal"/>
    </wsdl:fault>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="EPM_Product_SOAP">
    <wsdl:port name="EPM_Product_SOAP" binding="tns:EPM_Product_SOAP">
    <soap:address location="https://sapes5.sapdevcenter.com/sap/bc/srt/xip/sap/zepm_product_soap/002/epm_product_soap/epm_product_soap"/>
    </wsdl:port>
    <wsdl:port name="EPM_Product_SOAP_soap12" binding="tns:EPM_Product_SOAP_soap12">
    <wsoap12:address location="https://sapes5.sapdevcenter.com/sap/bc/srt/xip/sap/zepm_product_soap/002/epm_product_soap/epm_product_soap"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
Step 2 Create ABAP package
+
Step 3 Create service consumption model
+
Step 4 Consume web service
+
Step 5 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Save WSDL file 2. Create ABAP package 3. Create service consumption model 4. Consume web service 5. Test yourself

Learn more →