Professional Documents
Culture Documents
Applies to:
SAP EHP 1 for SAP NetWeaver 7.0. For more information, visit the ABAP homepage.
Summary
This document focuses on the steps for the consumption of external web service (a freely available web
service from internet) into SAP environment. It will also focus on the basic troubleshooting while consuming
the external web service.
Author:
Animesh Sundriyal
Author Bio
I am SAP ABAP and Webdynpro consultant with 3 years and 10 months of experience
currently working in the integration of ABAP Webdnpro and MDM.
Table of Contents
Overview ............................................................................................................................................................. 3
Illustration ........................................................................................................................................................ 3
PROGRAM ................................................................................................................................................................ 27
Troubleshooting ................................................................................................................................................ 29
Related Content ................................................................................................................................................ 30
Disclaimer and Liability Notice .......................................................................................................................... 31
Overview
Lets try using an external webservice into the SAP platform. By external webservice I mean the webservice
which are hosted from the foreign system other than the system in which we are trying to consume the
webservice. Let me take the example from the internet by using a freely available
Illustration
Lets open the website http://www.webservicex.net/ws/default.aspx from where we take the wsdl specification
of a freely available webservice currency convertor.
Now lets see the XML specification of the Currency Convertor Webservice and we can easily make out that
multiple bindings are present with the multiple ports. Lets keep the operation
<wsdl:operation name="ConversionRate"> and the respective binding
<wsdl:binding name="CurrencyConvertorSoap" type="tns:CurrencyConvertorSoap"> and
the respective port
<wsdl:port name="CurrencyConvertorSoap" binding="tns:CurrencyConvertorSoap">
I mean copy the WSDL file and edit it in a notepad. keep the parts which are mentioned above and remove
the following. Finally save it with the extention .wsdl.
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://www.webserviceX.NET/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://www.webserviceX.NET/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified"
targetNamespace="http://www.webserviceX.NET/">
- <s:element name="ConversionRate">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="FromCurrency" type="tns:Currency" />
<s:element minOccurs="1" maxOccurs="1" name="ToCurrency" type="tns:Currency" />
</s:sequence>
</s:complexType>
</s:element>
- <s:simpleType name="Currency">
- <s:restriction base="s:string">
<s:enumeration value="AFA" />
<s:enumeration value="ALL" />
<s:enumeration value="DZD" />
<s:enumeration value="ARS" />
<s:enumeration value="AWG" />
<s:enumeration value="AUD" />
<s:enumeration value="BSD" />
<s:enumeration value="BHD" />
- <wsdl:portType name="CurrencyConvertorSoap">
- <wsdl:operation name="ConversionRate">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><br><b>Get
conversion rate from one currency to another currency <b><br><p><b><font
color='#000080' size='1' face='Verdana'><u>Differenct currency Code and Names
around the world</u></font></b></p><blockquote><p><font face='Verdana'
size='1'>AFA-Afghanistan Afghani<br>ALL-Albanian Lek<br>DZD-Algerian
Dinar<br>ARS-Argentine Peso<br>AWG-Aruba Florin<br>AUD-Australian
Dollar<br>BSD-Bahamian Dollar<br>BHD-Bahraini Dinar<br>BDT-Bangladesh
Taka<br>BBD-Barbados Dollar<br>BZD-Belize Dollar<br>BMD-Bermuda
Dollar<br>BTN-Bhutan Ngultrum<br>BOB-Bolivian Boliviano<br>BWP-Botswana
Pula<br>BRL-Brazilian Real<br>GBP-British Pound<br>BND-Brunei Dollar<br>BIFBurundi Franc<br>XOF-CFA Franc (BCEAO)<br>XAF-CFA Franc (BEAC)<br>KHRCambodia Riel<br>CAD-Canadian Dollar<br>CVE-Cape Verde Escudo<br>KYDCayman Islands Dollar<br>CLP-Chilean Peso<br>CNY-Chinese Yuan<br>COPColombian Peso<br>KMF-Comoros Franc<br>CRC-Costa Rica Colon<br>HRKCroatian Kuna<br>CUP-Cuban Peso<br>CYP-Cyprus Pound<br>CZK-Czech
Koruna<br>DKK-Danish Krone<br>DJF-Dijibouti Franc<br>DOP-Dominican
Peso<br>XCD-East Caribbean Dollar<br>EGP-Egyptian Pound<br>SVC-El Salvador
Colon<br>EEK-Estonian Kroon<br>ETB-Ethiopian Birr<br>EUR-Euro<br>FKPFalkland Islands Pound<br>GMD-Gambian Dalasi<br>GHC-Ghanian Cedi<br>GIPGibraltar Pound<br>XAU-Gold Ounces<br>GTQ-Guatemala Quetzal<br>GNF-Guinea
Franc<br>GYD-Guyana Dollar<br>HTG-Haiti Gourde<br>HNL-Honduras
Lempira<br>HKD-Hong Kong Dollar<br>HUF-Hungarian Forint<br>ISK-Iceland
Krona<br>INR-Indian Rupee<br>IDR-Indonesian Rupiah<br>IQD-Iraqi
Dinar<br>ILS-Israeli Shekel<br>JMD-Jamaican Dollar<br>JPY-Japanese
Yen<br>JOD-Jordanian Dinar<br>KZT-Kazakhstan Tenge<br>KES-Kenyan
Shilling<br>KRW-Korean Won<br>KWD-Kuwaiti Dinar<br>LAK-Lao Kip<br>LVLLatvian Lat<br>LBP-Lebanese Pound<br>LSL-Lesotho Loti<br>LRD-Liberian
Dollar<br>LYD-Libyan Dinar<br>LTL-Lithuanian Lita<br>MOP-Macau
Pataca<br>MKD-Macedonian Denar<br>MGF-Malagasy Franc<br>MWK-Malawi
Kwacha<br>MYR-Malaysian Ringgit<br>MVR-Maldives Rufiyaa<br>MTL-Maltese
Lira<br>MRO-Mauritania Ougulya<br>MUR-Mauritius Rupee<br>MXN-Mexican
Peso<br>MDL-Moldovan Leu<br>MNT-Mongolian Tugrik<br>MAD-Moroccan
Dirham<br>MZM-Mozambique Metical<br>MMK-Myanmar Kyat<br>NAD-Namibian
Dollar<br>NPR-Nepalese Rupee<br>ANG-Neth Antilles Guilder<br>NZD-New
Zealand Dollar<br>NIO-Nicaragua Cordoba<br>NGN-Nigerian Naira<br>KPW-North
Korean Won<br>NOK-Norwegian Krone<br>OMR-Omani Rial<br>XPF-Pacific
Franc<br>PKR-Pakistani Rupee<br>XPD-Palladium Ounces<br>PAB-Panama
Balboa<br>PGK-Papua New Guinea Kina<br>PYG-Paraguayan Guarani<br>PENPeruvian Nuevo Sol<br>PHP-Philippine Peso<br>XPT-Platinum Ounces<br>PLNPolish Zloty<br>QAR-Qatar Rial<br>ROL-Romanian Leu<br>RUB-Russian
Rouble<br>WST-Samoa Tala<br>STD-Sao Tome Dobra<br>SAR-Saudi Arabian
Riyal<br>SCR-Seychelles Rupee<br>SLL-Sierra Leone Leone<br>XAG-Silver
Ounces<br>SGD-Singapore Dollar<br>SKK-Slovak Koruna<br>SIT-Slovenian
Tolar<br>SBD-Solomon Islands Dollar<br>SOS-Somali Shilling<br>ZAR-South
African Rand<br>LKR-Sri Lanka Rupee<br>SHP-St Helena Pound<br>SDD-Sudanese
Dinar<br>SRG-Surinam Guilder<br>SZL-Swaziland Lilageni<br>SEK-Swedish
Krona<br>TRY-Turkey Lira<br>CHF-Swiss Franc<br>SYP-Syrian Pound<br>TWDTaiwan Dollar<br>TZS-Tanzanian Shilling<br>THB-Thai Baht<br>TOP-Tonga
Pa'anga<br>TTD-Trinidad&amp;Tobago Dollar<br>TND-Tunisian
Dinar<br>TRL-Turkish Lira<br>USD-U.S. Dollar<br>AED-UAE Dirham<br>UGXUgandan Shilling<br>UAH-Ukraine Hryvnia<br>UYU-Uruguayan New Peso<br>VUVVanuatu Vatu<br>VEB-Venezuelan Bolivar<br>VND-Vietnam Dong<br>YER-Yemen
</wsdl:binding>
Open SE80 transaction and follow the steps shown in the screenshot below to create consumer proxy.
Now we go to SOAMANAGER and create a logical end point for the consumer proxy. Follow the screenshots
for the same.
SOAMANGER opens the transaction in a browser, perform the below mentioned steps.
Actually in some organizations the internet communication is via proxy, get the proxy and port respectively
and fill the above parameters if required.\
PROGRAM
*&---------------------------------------------------------------------*
*& Report YTEST1
*&
*&---------------------------------------------------------------------*
*& Program to test webservice
*&
*&---------------------------------------------------------------------*
REPORT
YTEST1.
endtry.
* Declare the variable from consumer proxy class CONVERSION_RATE method
interface
data : input type ZASCONVERSION_RATE_SOAP_IN,
output type ZASCONVERSION_RATE_SOAP_OUT.
input-FROM_CURRENCY = 'USD'.
input-TO_CURRENCY = 'INR'.
try.
* Call method CONVERSION_RATE
call method testobj->CONVERSION_RATE
exporting
input = input
importing
output = output.
catch cx_ai_system_fault into sys_fault.
l_exception_msg = sys_fault->get_text( ).
write :/ 'System Error', l_exception_msg.
exit.
catch cx_ai_application_fault into app_fault.
l_exception_msg = app_fault->get_text( ).
write :/ 'Application Error', l_exception_msg.
exit.
endtry.
* print the result
write : output-CONVERSION_RATE_RESULT.
Troubleshooting
Now let's focus on some basic troubleshooting.
ICM_HTTP_TIMEOUT
ICM_HTTP_CONNECTION_FAILED
This error comes when we forget to mention proxy and port in logical endpoint.
SOAP FAULTCODE : 1
This error comes if MESSAGE ID PROTOCOL value is wrongly choosen in the logical end point creation.
Please refer the below references for more explanation on troubleshooting.
Related Content
https://cw.sdn.sap.com/cw/docs/DOC-106375
http://forums.sdn.sap.com/message.jspa?messageID=5686394