Salesforce

Is it possible to connect to a SOAP-based WebService without WSDL from ABL client?

« Go Back

Information

 
TitleIs it possible to connect to a SOAP-based WebService without WSDL from ABL client?
URL NameIs-it-possible-to-connect-to-a-SOAP-based-WebService-without-WSDL-from-ABL-client
Article Number000165279
EnvironmentProduct: OpenEdge
Version: 10.2B, 11.x, 12.x
OS: Windows
Question/Problem Description
Is it possible to connect WebService from ABL client without using -WSDL option in the connect statement?

Is it possible to connect to a  SOAP-based WebService without WSDL from ABL client?

Is it possible to connect to a SOAP-based WebService using the ABL HTTP Client?
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
Use the HTTP Client (OpenEdge.Net.pl library) available from OpenEdge 11.5.1 and later. 
Customers running on versions lower than 11.5.1 may be able to use the .NET HttpClient to achieve similar results. See the Workaround section of article# 000060873 for more information.

The following ABL procedure shows how to send a SOAP request to consume a WebService
 
USING OpenEdge.Core.*.
USING OpenEdge.Net.HTTP.*.
USING OpenEdge.Net.HTTP.Lib.ClientLibraryBuilder.
USING OpenEdge.Net.URI.

DEFINE VARIABLE oRequest                 AS IHttpRequest                 NO-UNDO.
DEFINE VARIABLE oResponse                AS IHttpResponse                NO-UNDO.
DEFINE VARIABLE oURI                     AS URI                          NO-UNDO.
DEFINE VARIABLE oRequestBody             AS OpenEdge.Core.String         NO-UNDO.
DEFINE VARIABLE hXMLHandle               AS HANDLE                       NO-UNDO.
DEFINE VARIABLE lcXML                    AS LONGCHAR                     NO-UNDO.

/* Web Service based on this public WS http://www.dneonline.com/calculator.asmx . It consumes the WebService executing the Add Operation. */

oRequestBody =  NEW OpenEdge.Core.String(
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">' + 
'<soapenv:Header/>' + 
'<soapenv:Body>' +       
'<tem:Add>' +          
'<tem:intA>1</tem:intA>' +          
'<tem:intB>2</tem:intB>' +       
'</tem:Add>' +    
'</soapenv:Body>' + 
'</soapenv:Envelope>'
).

oURI = URI:Parse("http://www.dneonline.com/calculator.asmx").
oRequest = RequestBuilder:Post(oUri, oRequestBody)
                         :ContentType('text/xml;charset=UTF-8')
                         :AcceptAll()
                         :AddHeader('SOAPAction', 'http://tempuri.org/Add')
                         :Request.

oResponse = ClientBuilder:Build()
                         :Client:Execute(oRequest).

IF oResponse:StatusCode <> 200 THEN
   DO:
    MESSAGE "http error: " oResponse:StatusCode VIEW-AS ALERT-BOX. 
    RETURN ERROR "Request Error: " + STRING(oResponse:StatusCode).
   END.
ELSE
  DO:
    hXMLHandle = CAST(oResponse:Entity,WidgetHandle):Value.
    hXMLHandle:SAVE('LONGCHAR',lcXML).
    MESSAGE STRING(lcXML) VIEW-AS ALERT-BOX. 
 END.

- The definition of the SOAP Web Service should be known to the consumer since the WSDL is the one giving the information on how the WebService is defined and to be consumed.

- If the WSDL is not used then the SOAP envelope, SOAP Body and the complete XML request have to be built manually. There is no parsing to validate if the XML is valid. One option would be to create the XML using the XML DOM and pass it to the WebService. See the sample code in article# 000072154 for more information.

- If the WSDL is available (http://www.dneonline.com/calculator.asmx?WSDL) then there are third-party tools, such as SOAP UI to find how the WebService works and more details on the SOAP requests used for a Web Service.

- <DLC>\tty\netlib\OpenEdge.Net.pl or <DLC>\gui\netlib\OpenEdge.Net.pl library needs to be added to the Propath if running with the Procedure Editor. If the Developer Studio is used to write the code, no need to add this library, it is added by default.
Workaround
Notes
Keyword Phrase
Last Modified Date3/21/2023 5:50 PM

Powered by