Jump to content
ertank

Help needed with SOAP error: DocumentElement http://schemas.xmlsoap.org/soap/envelope/:Envelope expected, :Envelope found

Recommended Posts

Hello,

 

I am using Delphi 10.3.3, targeting Win32 executable.

 

There is a SOAP web service that I have build a class for it. That class runs just fine on a test project. However, when I put it in my main project, I get below error

DocumentElement http://schemas.xmlsoap.org/soap/envelope/:Envelope expected, :Envelope found

I checked, there is only one single unit for this web service in my whole computer and both projects are using that unit.

 

I have used different SOAP web services in the past. Some of them rarely raise "HTML found" kind of error messages, but never got ":Envelope found" until now. None of my web searches lead me to same error message that I receive.

 

I have all requests and responses saved in text files. Comparing them I can see no difference. It is only number of records returned changes due to filter parameters. I also used Fiddler Telerik and captured whole response using both test project and main project. They are identical as far as I can tell.

 

Test project response starts as:

HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
Connection: keep-alive
Set-Cookie: JSESSIONIDSSO=529DA436282217EF9D8D9F21515121D3; Path=/; Secure
Set-Cookie: JSESSIONID=82E5260FE1737AA7C77DCE37D71B7132; Path=/listingapi/ws; Secure
Server-Timing: intid;desc=d2369e80a9274e5b
Date: Sun, 06 Jun 2021 19:41:44 GMT
Vary: Accept-Encoding
Content-Length: 15213
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
  <env:Header/>
  <env:Body>
    <ns1:getSalesByDateRangeResponse xmlns:ns1='http://sale.individual.ws.listingapi.gg.com'>
      <return>
        <ackCode>success</ackCode>
        <responseTime>06/06/2021 22:41:44</responseTime>
        <timeElapsed>1 ms</timeElapsed>
        <saleCount>11</saleCount>
        <sales>
          <sale>

 

Main project response starts as:

HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
Connection: keep-alive
Set-Cookie: JSESSIONIDSSO=7A2E4B6940B5E0E44F86FF95BBCD6C3D; Path=/; Secure
Set-Cookie: JSESSIONID=0ED54949FAC10990F8F24B27B9174216; Path=/listingapi/ws; Secure
Server-Timing: intid;desc=1a968daea7e9c9d9
Date: Sun, 06 Jun 2021 19:41:17 GMT
Vary: Accept-Encoding
Content-Length: 9877
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
  <env:Header/>
  <env:Body>
    <ns1:getSalesByDateRangeResponse xmlns:ns1='http://sale.individual.ws.listingapi.gg.com'>
      <return>
        <ackCode>success</ackCode>
        <responseTime>06/06/2021 22:41:17</responseTime>
        <timeElapsed>225 ms</timeElapsed>
        <saleCount>7</saleCount>
        <sales>
          <sale>

Web service WSDL can be reached from: https://dev.gittigidiyor.com:8443/listingapi/ws/IndividualSaleService?wsdl

 

I appreciate any help, please.

 

Thanks & Regards,

Ertan

Share this post


Link to post

One additional information I should add is this main project where I am receiving error is using more than one soap web services.

Thinking of that it maybe related with that RegisterInterface() or RegisterXSClass() functions used in WSDL generated web service units I tried to switch unit creation. That did not help, too.

One of the web services returning its envelope as below

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP-ENV:Header/>
	<SOAP-ENV:Body>

Problematic one returning its envelope as below

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
	<env:Header/>
	<env:Body>

There is this "SOAP-ENV" and "env" difference. But, they both seem to be defined properly. Moreover, I have no problem using problematic web service in a single project.

 

Any help is appreciated.

 

Thanks & Regards,

Ertan

Share this post


Link to post
On 6/6/2021 at 11:50 PM, ertank said:

Hello,

 

I am using Delphi 10.3.3, targeting Win32 executable.

 

There is a SOAP web service that I have build a class for it. That class runs just fine on a test project. However, when I put it in my main project, I get below error


DocumentElement http://schemas.xmlsoap.org/soap/envelope/:Envelope expected, :Envelope found

I checked, there is only one single unit for this web service in my whole computer and both projects are using that unit.

  

I have used different SOAP web services in the past. Some of them rarely raise "HTML found" kind of error messages, but never got ":Envelope found" until now. None of my web searches lead me to same error message that I receive.

  

I have all requests and responses saved in text files. Comparing them I can see no difference. It is only number of records returned changes due to filter parameters. I also used Fiddler Telerik and captured whole response using both test project and main project. They are identical as far as I can tell.

  

Test project response starts as:


HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
Connection: keep-alive
Set-Cookie: JSESSIONIDSSO=529DA436282217EF9D8D9F21515121D3; Path=/; Secure
Set-Cookie: JSESSIONID=82E5260FE1737AA7C77DCE37D71B7132; Path=/listingapi/ws; Secure
Server-Timing: intid;desc=d2369e80a9274e5b
Date: Sun, 06 Jun 2021 19:41:44 GMT
Vary: Accept-Encoding
Content-Length: 15213
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
  <env:Header/>
  <env:Body>
    <ns1:getSalesByDateRangeResponse xmlns:ns1='http://sale.individual.ws.listingapi.gg.com'>
      <return>
        <ackCode>success</ackCode>
        <responseTime>06/06/2021 22:41:44</responseTime>
        <timeElapsed>1 ms</timeElapsed>
        <saleCount>11</saleCount>
        <sales>
          <sale>

 

Main project response starts as:


HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
Connection: keep-alive
Set-Cookie: JSESSIONIDSSO=7A2E4B6940B5E0E44F86FF95BBCD6C3D; Path=/; Secure
Set-Cookie: JSESSIONID=0ED54949FAC10990F8F24B27B9174216; Path=/listingapi/ws; Secure
Server-Timing: intid;desc=1a968daea7e9c9d9
Date: Sun, 06 Jun 2021 19:41:17 GMT
Vary: Accept-Encoding
Content-Length: 9877
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
  <env:Header/>
  <env:Body>
    <ns1:getSalesByDateRangeResponse xmlns:ns1='http://sale.individual.ws.listingapi.gg.com'>
      <return>
        <ackCode>success</ackCode>
        <responseTime>06/06/2021 22:41:17</responseTime>
        <timeElapsed>225 ms</timeElapsed>
        <saleCount>7</saleCount>
        <sales>
          <sale>

Web service WSDL can be reached from: https://dev.gittigidiyor.com:8443/listingapi/ws/IndividualSaleService?wsdl

 

I appreciate any help, please.

 

Thanks & Regards,

Ertan

Hi,

 

If you had sent the entire request, I could have responded more accurately. Fiddler etc. Compare an application with the requests in the test and production version. If there is a difference and there is a problem with Envelope, you can interfere with the XML request with the help of the code below;

 

procedure OnBeforeExecute(const MethodName: string; SOAPRequest: TStream);
var
  G: TStringList;
begin
  SOAPRequest.Position := 0;
  G := TStringList.Create;
  try
    G.LoadFromStream(SOAPRequest);
    ///You have to do the operations here.
    SOAPRequest.Size := 0;
    SOAPRequest.Position := 0;
    G.SaveToStream(SOAPRequest);
  finally
    G.Free;
  end;
end;

This is a code snippet for the HTTPRio OnBeforeExecute event. I'm assuming you are using WSDL imports. If you add healthy requests in the subject, I may have the opportunity to examine it.

 

Best regards.

Share this post


Link to post
3 hours ago, Halil Han Badem said:

Compare an application with the requests in the test and production version

Both projects are working on production. There is no test environment.

3 hours ago, Halil Han Badem said:

HTTPRio OnBeforeExecute

I do not have problem "sending" the request. Error is raised when I receive the response. I shared both projects raw response beginnings (taken using Fiddler) to show there is no difference that would result in such an error. However, single SOAP web service project works OK. Double SOAP web service project (this and another web service supported in a single project) raises mentioned error.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×