1. Pbuser12 Ateikon
  2. PowerBuilder
  3. Friday, 20 October 2023 06:56 AM UTC

Iam doing a getAll soap api in power builder. I got status is 200 and ok..but i didnot get the response .can any one help me ..

 

 

Code sytax:

 

integer li_ret
integer li_StatusCode
string ls_url,ls_soap_action
string ls_data
string ls_body
string ls_ret

// Create an HTTP client object
httpClient lo_client
lo_client = Create httpClient

// Set the URL for the SOAP GET request
ls_url = "https://localhost:44339/McDonaldsSoapService.asmx"

ls_body ='<?xml version="1.0" encoding="utf-8"?>'
ls_body +='<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
ls_body +='<soap:Body>'
ls_body +='GetAllMcDonalds xmlns="http://tempuri.org/">'
ls_body += '<requestDTO />'
ls_body +='</GetAllMcDonalds>'
ls_body +='</soap:Body>'
ls_body +='</soap:Envelope>'

// Set the request headers for a SOAP GET request
lo_client.SetRequestHeader("Content-Type", "text/xml; charset=utf-8")
lo_client.SetRequestHeader("Content-Length", String(Len(ls_body)))

//// Send the SOAP GET request
lo_client.sendrequest('GET', ls_url, ls_body)
li_StatusCode = lo_client.GetResponseStatusCode()
ls_ret = lo_client.GetResponseStatusText()
li_ret = lo_client.getresponsebody(ls_data)


destroy lo_client


messagebox("Service response", ls_data).

 

I will provide soap wsdl file:

GetAllMcDonalds

 

Test

The test form is only available for methods with primitive types as parameters.

SOAP 1.1

The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.

POST /McDonaldsSoapService.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetAllMcDonalds"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetAllMcDonalds xmlns="http://tempuri.org/">
      <requestDTO />
    </GetAllMcDonalds>
  </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetAllMcDonaldsResponse xmlns="http://tempuri.org/">
      <GetAllMcDonaldsResult>
        <GetAllMcDonaldsResponseDTO>
          <ID>string</ID>
          <MENU>string</MENU>
          <PRICE>string</PRICE>
          <DESCRIPTION>string</DESCRIPTION>
        </GetAllMcDonaldsResponseDTO>
        <GetAllMcDonaldsResponseDTO>
          <ID>string</ID>
          <MENU>string</MENU>
          <PRICE>string</PRICE>
          <DESCRIPTION>string</DESCRIPTION>
        </GetAllMcDonaldsResponseDTO>
      </GetAllMcDonaldsResult>
    </GetAllMcDonaldsResponse>
  </soap:Body>
</soap:Envelope>

Error message:

li_ret = lo_client.getresponsebody(ls_data) :in this line i got error..

<html>

<head><link rel="alternate" type="text/xml" href="/McDonaldsSoapService.asmx?disco" />

<style type="text/css">

BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; }
#content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; }
A:link { color: #336699; font-weight: bold; text-decoration: underline; }
A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; }
A:active { color: #336699; font-weight: bold; text-decoration: underline; }
A:hover { color: cc3300; font-weight: bold; text-decoration: underline; }
P { color: #000000; margin-top: 0px; margin-bottom: 12px; font-family: Verdana; }
pre { background-color: #e5e5cc; padding: 5px; font-family: Courier New; font-size: x-small; margin-top: -5px; border: 1px #f0f0e0 solid; }
td { color: #000000; font-family: Verdana; font-size: .7em; }
h2 { font-size: 1.5em; font-weight: bold; margin-top: 25px; margin-bottom: 10px; border-top: 1px solid #003366; margin-left: -15px; color: #003366; }
h3 { font-size: 1.1em; color: #000000; margin-left: -15px; margin-top: 10px; margin-bottom: 10px; }
ul { margin-top: 10px; margin-left: 20px; }
ol { margin-top: 10px; margin-left: 20px; }
li { margin-top: 10px; color: #000000; }
font.value { color: darkblue; font: bold; }
font.key { color: darkgreen; font: bold; }
font.error { color: darkred; font: bold; }
.heading1 { color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal; background-color: #003366; margin-top: 0px; margin-bottom: 0px; margin-left: -30px; padding-top: 10px; padding-bottom: 3px; padding-left: 15px; width: 105%; }
.button { background-color: #dcdcdc; font-family: Verdana; font-size: 1em; border-top: #cccccc 1px solid; border-bottom: #666666 1px solid; border-left: #cccccc 1px solid; border-right: #666666 1px solid; }
.frmheader { color: #000000; background: #dcdcdc; font-family: Verdana; font-size: .7em; font-weight: normal; border-bottom: 1px solid #dcdcdc; padding-top: 2px; padding-bottom: 2px; }
.frmtext { font-family: Verdana; font-size: .7em; margin-top: 8px; margin-bottom: 0px; margin-left: 32px; }
.frmInput { font-family: Verdana; font-size: 1em; }
.intro { margin-left: -15px; }

</style>

<title>
McDonaldsSoapService Web Service
</title></head>

<body>

<div id="content">

<p class="heading1">McDonaldsSoapService</p><br>

 

<span>

<p class="intro">The following operations are supported. For a formal definition, please review the <a href="/McDonaldsSoapService.asmx?WSDL">Service Description</a>. </p>


<ul>

<li>
<a href="/McDonaldsSoapService.asmx?op=GetAllMcDonalds">GetAllMcDonalds</a>


</li>
<p>

<li>
<a href="/McDonaldsSoapService.asmx?op=InsertMcdonalds">InsertMcdonalds</a>


</li>
<p>

</ul>

</span>

 

<span>

</span>

<span>
<hr>
<h3>This web service is using http://tempuri.org/ as its default namespace.</h3>
<h3>Recommendation: Change the default namespace before the XML Web service is made public.</h3>
<p class="intro">Each XML Web service needs a unique namespace in order for client applications to distinguish it from other services on the Web. http://tempuri.org/ is available for XML Web services that are under development, but published XML Web services should use a more permanent namespace.</p>
<p class="intro">Your XML Web service should be identified by a namespace that you control. For example, you can use your company's Internet domain name as part of the namespace. Although many XML Web service namespaces look like URLs, they need not point to actual resources on the Web. (XML Web service namespaces are URIs.)</p>
<p class="intro">For XML Web services creating using ASP.NET, the default namespace can be changed using the WebService attribute's Namespace property. The WebService attribute is an attribute applied to the class that contains the XML Web service methods. Below is a code example that sets the namespace to "http://microsoft.com/webservices/":</p>
<p class="intro">C#</p>
<pre>[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
// implementation
}</pre>
<p class="intro">Visual Basic</p>
<pre>&lt;WebService(Namespace:="http://microsoft.com/webservices/")&gt; Public Class MyWebService
' implementation
End Class</pre>

<p class="intro">C++</p>
<pre>[WebService(Namespace="http://microsoft.com/webservices/")]
public ref class MyWebService {
// implementation
};</pre>
<p class="intro">For more details on XML namespaces, see the W3C recommendation on <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</A>.</p>
<p class="intro">For more details on WSDL, see the <a href="http://www.w3.org/TR/wsdl">WSDL Specification</a>.</p>
<p class="intro">For more details on URIs, see <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>.</p>
</span>

 



<!-- Visual Studio Browser Link -->
<script type="text/javascript" src="https://localhost:44399/600af583361b4e6b80adad702446c17c/browserLink" async="async" id="__browserLink_initializationData" data-requestId="6f848c93883c426bac074f34f0f6c658" data-appName="Unknown"></script>
<!-- End Browser Link -->

</body>
</html>


Responses (7)
  1. Likes
  2. Latest
  3. Oldest
Loading...

Find Questions by Tag

.EXE .NET 6.0 .NET Assembly .NET Core 3.1 .NET Core Framework .NET DataStore .NET Std Framework 32-bit 64-bit ADO.NET AEM AI Algorithm Amazon AWS Android Apache API APK App Store App Store (Apple) Appeon Workspace Appeon Xcelerator Plug-in Architecture Array ASE Asynchronous Methods Authentication AutoBuild AutoCompiler Automated Testing Automation AutoScript Azure Barcode Base64 Batch BigData BLOB Branch & Merge Browser Bug Build Button C# C# Class Importer C# Editor C# Model generator Calendar Camera Certificate Chrome Citrix Class Client Client/Server Cloud Cluster Collection COM Command Line Compiler Compression Computed Field Configuration Controls Cookies Cordova Crash Cross-Platform Crosstab CSharpAssembly CSharpObject CSS CSV Cursor Data Database Database Driver Database Painter Database Profile Database Provider DataObject DataSource DataStore DataStore (C#) DataStore (PS) DataType DataWindow DATE DATETIME DB2 Debug Debugger Debugging Deployment Design DLL DO-WHILE Dockable Docker Documentation DOUBLE Download DragDrop Edge Edit Style Editor Elevate Conference Email Embedded SQL Emulator Encoding Encryption Enhancement Request Entity Entity Framework ERP Error Event Event Handler Event Handling Excel Exception Export Expression External Functions F# Field File File Access Filter Firefox Firewall Font FOR-NEXT Foreground Format Function Garbage Collection GeoLocation Git Graph HANA Hash Header HTML/5 HTTP/S HTTPClient Icon IDE Identity IIS IMAPI Import InfoMaker Inheritance Installation Integer IntelliSense Interface Internet Internet Explorer iOS IPA iPad iPhone IWA J# Java JavaScript JBoss JDBC JOIN JSON JSONGenerator JSONParser Kestrel Label Lambda Large File LDAP Library License LINQ Linux OS Load Balancing Localization Localized PBVM Log In Log Out Logging LONG LONGLONG macOS MAPI Maps MDI Memory Memory Leak Menu Merge MessageBox Messagging Method Migration MIME TYPE Mobile Model ModelStore ModelStore (C#) MSOLEDBSQL Multi Threading MVC MySQL n-Tier Namespace NativePDF NVO OAuth ODATA ODBC Office Offline OLE OLEDB Online Open Source OpenAPI OpenSSL Oracle OrcaScript Other Outlook Output Package Parameter Patch PayPal PB Classic PB Native PB.NET PBC PBD PBDOM PBG PBJVM PBL PBNI PBORCA PBVM PBX PDF Performance Permission PFC Picture Pipeline Play Store (Google) Plugin Popup Port POST PostgreSQL PowerBuilder PowerBuilder (Appeon) PowerBuilder (SAP) PowerBuilder Compiler PowerBuilder Runtime PowerClient PowerScript (PS) PowerScript IDE PowerScript Migrator PowerServer PowerServer Mobile PowerServer Toolkit PowerServer Web PowerServerLabel Print Properties Proxy Publish PULL PUSH Query Regression Release Renew Resize Response REST Retrieve RibbonBar RibbonBar Builder Rich Text Roadmap RPC Runtime Packager SaaS Scaffolding Script SDI SDK Security Server Service Session Single Sign-on Size SMTP SMTPClient SnapDevelop SOAP Sort Source Code Speech Recognition SQL SQL Anywhere SQL Server SqlBuilder SqlExecutor SQLite SqlModelMapper Storage Stored Procedure Subscription SVN Swagger Syntax TabbedBar TabbedView Tablet TabPage Target TE Control Testing Text TFS Theme TIME Timer TLS/SSL Tomcat TortoiseGit TortoiseSVN Transaction Transparency Trial Trigger TRY-CATCH TX Control Type UI ULONG UltraLite Uninstall Unit Test Unit Testing UNIX OS Update Upgrade Upload URL User Center User Object UWP Validation VARCHAR Variable Versioning Visual Studio Visual Studio Code VM Voice Warning WCF Web API Web Extensions Web Service WebBrowser WebForms WebLogic WebSphere WildFly WinAPI Window Windows OS WinForms Wizard Workgroup Workspace WPF XCODE XHTML XML Zoom

Helpful?

If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.