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>

Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 20 October 2023 07:10 AM UTC
  2. PowerBuilder
  3. # 1

Hi.

Are you sure the following is ok?

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/">' // A "<" seems to be missing...
ls_body += '<requestDTO />'
ls_body +='</GetAllMcDonalds>'
ls_body +='</soap:Body>'
ls_body +='</soap:Envelope>'

Andreas.

 

Comment
There are no comments made yet.
Pbuser12 Ateikon Accepted Answer Pending Moderation
  1. Friday, 20 October 2023 11:11 AM UTC
  2. PowerBuilder
  3. # 2

Dear Andreas,

 

Please find the below screenshot ..I changed the syntax.its not working ..

 

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?op=GetAllMcDonalds'

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)

 

 

Comment
  1. Arnd Schmidt
  2. Friday, 20 October 2023 14:54 PM UTC
Try to follow the example of your webpage!

ls_url = 'https://localhost:44339/McDonaldsSoapService.asmx"

// No "?op=" ...needed

and set the Request header as it is clearly shown in the example.

lo_client.SetRequestHeader("SOAPAction" , "http://tempuri.org/GetAllMcDonalds"; )

hth

Arnd
  1. Helpful
  1. Arnd Schmidt
  2. Friday, 20 October 2023 14:56 PM UTC
Wow... the ; is automatically inserted by this buggy website :-(
  1. Helpful
  1. Pbuser12 Ateikon
  2. Monday, 23 October 2023 07:57 AM UTC
Dear Schmidt ,



after changes the code ,what you said .its not working,.?..can you sugest me code for Getall Soap
  1. Helpful
There are no comments made yet.
Kevin Ridley Accepted Answer Pending Moderation
  1. Friday, 20 October 2023 20:49 PM UTC
  2. PowerBuilder
  3. # 3

As I recommended in one of your prior web service posts, were you able to get it working in SOAPUI or Postman first?  Did you inspect that HTTP code and duplicate it?  You will spend a lot more time trying to debug it if you don't first see what needs to be in the request.

 

Kevin

Comment
  1. Pbuser12 Ateikon
  2. Monday, 23 October 2023 09:20 AM UTC
Dear Kevin ,



In soap ui ..its working ..but in power builder its not working..

  1. Helpful
There are no comments made yet.
Pbuser12 Ateikon Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 08:41 AM UTC
  2. PowerBuilder
  3. # 4

Dear Kevin,

 

 

As per your suggestion i made a changes .but still its not working..

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


// 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>'

 

lo_client = Create httpClient
// Set the request headers for a SOAP GET request

lo_client.SetRequestHeader("Content-Type","text/xml; charset=utf-8") // "text/xml")
lo_client.SetRequestHeader("SOAPAction","http://tempuri.org/GetAllMcDonalds")
lo_client.SetRequestHeader("Content-Length", 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)...

 

pfa

 

Attachments (1)
Comment
  1. Andreas Mykonios
  2. Monday, 23 October 2023 09:09 AM UTC
This means you were able to call the service from postman or soapui?

Andreas.
  1. Helpful
There are no comments made yet.
Pbuser12 Ateikon Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 08:43 AM UTC
  2. PowerBuilder
  3. # 5

pfa

 

error Message :

<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=GetByIdMcDonalds">GetByIdMcDonalds</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/48d4a0a42ee54bbc8950dc180730f87c/browserLink" async="async" id="__browserLink_initializationData" data-requestId="1e8a317a48734c18aafe476ec51ae81e" data-appName="Unknown"></script>
<!-- End Browser Link -->

</body>
</html>

Comment
There are no comments made yet.
Pbuser12 Ateikon Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 09:20 AM UTC
  2. PowerBuilder
  3. # 6

Comment
  1. Pbuser12 Ateikon
  2. Monday, 23 October 2023 10:12 AM UTC
take this reference is not working..// Set the URL for the SOAP GET request

ls_url = "https://localhost:44339/McDonaldsSoapService.asmx"



ls_body =''

ls_body +='<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"; xmlns:tem="http://tempuri.org/">;'

ls_body +='<soap:Header/>'

ls_body +='<soap:Body>'

ls_body += ' <tem:GetAllMcDonalds>'

ls_body += '<tem:requestDTO/>'

ls_body += '</tem:GetAllMcDonalds>'

ls_body +='</soap:Body>'

ls_body +='</soap:Envelope>'





lo_client = Create httpClient

// Set the request headers for a SOAP GET request



lo_client.SetRequestHeader("Content-Type", "text/xml;charset=UTF-8")

lo_client.SetRequestHeader("SOAPAction", ls_soap_action)

lo_client.SetRequestHeader("Content-Length", String(len(ls_body) ))
  1. Helpful
  1. Andreas Mykonios
  2. Monday, 23 October 2023 10:37 AM UTC
Put all the code. Put also the commands you use to call the service. Also, use the tools available to place the code. If you don't know how to do that take some time to read the following post. Your questions are hard to read, because: a) you place images that most times are hard to use, b) you put sample code as part of the text you are writing.

Finally, by repeating a question you already asked, you don't increase possibilities to get an answer.

Andreas.
  1. Helpful 1
  1. Pbuser12 Ateikon
  2. Monday, 23 October 2023 10:44 AM UTC
Dear Andreas

I send the code ..what i write ..clearly..I tried post same method its working ..but in getall soap its not working



powerbuilder sytax:

integer li_ret

integer li_StatusCode

string ls_url,ls_soap_action

string ls_data

string ls_body

string ls_ret





ls_soap_action = "http://mcdonaldsapi.com/GetAllMcDonalds";

// 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 += ''

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://mcdonaldsapi.com/">;'

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("SOAPAction", ls_soap_action)

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)



csharp file :

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://mcdonaldsapi.com/GetAllMcDonalds";





<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://mcdonaldsapi.com/">;

<requestDTO />

</GetAllMcDonalds>

</soap:Body>

</soap:Envelope>

HTTP/1.1 200 OK

Content-Type: text/xml; charset=utf-8

Content-Length: length





<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://mcdonaldsapi.com/">;

<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>
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 11:03 AM UTC
  2. PowerBuilder
  3. # 7

The following works?

httpClient lo_client
string ls_body = '<?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>'

integer li_StatusCode, li_ret
string ls_data, ls_ret
string urlName = 'https://localhost:44339/McDonaldsSoapService.asmx'
string ls_soap_action = 'http://tempuri.org/GetAllMcDonalds'

lo_client = create httpClient

lo_client.SetRequestHeader('Content-Type', 'text/xml;charset=UTF-8')
lo_client.SetRequestHeader('SOAPAction', ls_soap_action)
lo_client.SetRequestHeader('Content-Length', String(len(ls_body)))
li_ret = lo_client.SendRequest('POST', urlName, ls_body)

if li_ret = 1 then
	if lo_client.GetResponseStatusCode() = 200 then
		if lo_client.getresponsebody(ls_data) = 1 then
			messagebox("Answer:", ls_data)
		else
			messagebox("Error:", "Error while trying to get body!")
		end if
	else
		messagebox("Error:", lo_client.GetResponseStatusText())
	end if
else
	// Here you, normally you must check the exact error.
	messagebox('Error:', 'Unable to call ' + urlName)
end if

if isvalid(lo_client) then destroy lo_client

If not what does GetResponseStatusCode and GetResponseStatusText return?

Andreas.

Comment
  1. Kevin Ridley
  2. Monday, 23 October 2023 12:21 PM UTC
Please select Andreas answer as the solution to help others. Looks like the biggest thing is you were trying to do a 'Get' instead of a 'Post' in your HTTPClient.SendRequest .
  1. Helpful
  1. Andreas Mykonios
  2. Monday, 23 October 2023 12:29 PM UTC
Actually, it was Arnd Schmidt who noticed that it was a POST request (in one of his comments in https://community.appeon.com/index.php/qna/q-a/soap-get-issue#reply-42841). I did not noticed at the beginning. And the way all those questions where written wasn't helpful at all. So much information with so much spaces...

Andreas.
  1. Helpful 1
  1. Pbuser12 Ateikon
  2. Tuesday, 24 October 2023 06:12 AM UTC
Thanks for Guiding Andreas ..Your are a Good Mentor..
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.