SOAP client delphi 2010 parse [Edit]

I'm desperately trying to use SOAP services. I
 had no problems to import the structure by WSDL import. 
The code I use to the service call is as follows: 

 var 
    ser: SearchContrattoInDTO; 
    att: attestazioniSoaPortType; 
    s: String; 
begin 
  ser: = SearchContrattoInDTO.Create; 
  ser.codiceSOA: = '10 '; 
  ser.numContratto: = '002 '; 

  att: = GetattestazioniSoaPortType (false,'', HTTPRIO1); 
  try 
    s: = att.getContrattoFull (ser).messaggio; 
    except on E: Exception do 
          MessageDlg (E. Message, mtError [Mboka], 0); 
  end; 

 It generates an exception of type 

 EDOMParseError: "Invalid at the top level of document  Line 1 --MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073 " 

 The response is still correct. This is the reply received. 

--MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073
Content-Type: application/soap+xml; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-ID: <0.urn:uuid:2BBB929C9F381AC14C1299861024074@apache.org>

<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:getContrattoFullResponse xmlns:ns="http://services.at.avcp.it"><ns:return xmlns:ax21="http://in.dto.at.avcp.it/xsd" xmlns:ax23="http://out.dto.at.avcp.it/xsd" xmlns:ax24="http://dto.at.avcp.it/xsd" type="it.avcp.at.dto.out.ContrattiOutDTO"><ax23:contratto xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" /><ax23:codice>getContrattoFull</ax23:codice><ax23:esit
o>-1</ax23:esito><ax23:messaggio>getContrattoFull:: Il contratto non e' stato trovato</ax23:messaggio></ns:return></ns:getContrattoFullResponse></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073--

I think the Parser does not work because  the answer is interpreted as a 
attachmentche really is not or something like that .. 

It 's the first time i use the SOAP web services. 
Please help...

Edited by: Bruno Lorenzo on Mar 11, 2011 8:38 AM
0
Bruno
3/11/2011 4:40:29 PM
embarcadero.delphi.webservices 976 articles. 0 followers. Follow

9 Replies
1325 Views

Similar Articles

[PageSpeed] 18

Hello,
> It generates an exception of type
>
> EDOMParseError: "Invalid at the top level of document  Line 
> 1 --MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073 "
>
> The response is still correct. This is the reply received.
>
> --MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073
> Content-Type: application/soap+xml; charset=utf-8
> Content-Transfer-Encoding: 8bit
> Content-ID: <0.urn:uuid:2BBB929C9F381AC14C1299861024074@apache.org>
>
> <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope 
> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:getContrattoFullResponse 
> xmlns:ns="http://services.at.avcp.it"><ns:return 
> xmlns:ax21="http://in.dto.at.avcp.it/xsd" 
> xmlns:ax23="http://out.dto.at.avcp.it/xsd" 
> xmlns:ax24="http://dto.at.avcp.it/xsd" 
> type="it.avcp.at.dto.out.ContrattiOutDTO"><ax23:contratto 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" 
> /><ax23:codice>getContrattoFull</ax23:codice><ax23:esit
> o>-1</ax23:esito><ax23:messaggio>getContrattoFull:: Il contratto non e' 
> stato 
> trovato</ax23:messaggio></ns:return></ns:getContrattoFullResponse></soapenv:Body></soapenv:Envelope>
> --MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073--
>
> I think the Parser does not work because  the answer is interpreted as a
> attachmentche really is not or something like that ..
>

It seems that it's the other way: the SOAP runtime is not expecting 
MultiPart/MIME but that's what the Service is sending back. I wish we could 
see the whole response - i.e. with the HTTP headers. That's how the Delphi 
runtime will try to determine if the response is MultiPart or not. 
Interestingly I don't see the reason why the Server sent the response this 
way because the XML response (which is always in the first part) does not 
make any references to other parts.

Two questions:
===========
1. Can you capture the whole response - include HTTP headers - using 
something like WireShark/Ethereal. You can even use something like 
proxyTrace and configure WinInet to use it. I'd like to see the HTTP headers 
that came back with the response to determine why the Delphi runtime did not 
detect multipart and instead pass the whole thing to the XML parser [which, 
as expected, did not like the MIME boundary].

2. If the above does not work, can you point me to the WSDL of the Service? 
I'd like to see there's any hint there about Attachments/MTOM/??

If possible, do post the signature that the importer gave you for that 
method. Thank you.

Cheers,

Bruneau
0
Jean
3/11/2011 10:44:13 PM
> {quote:title=Jean-Marie Babet wrote:}{quote}
> Hello,
> > It generates an exception of type
> >
> > EDOMParseError: "Invalid at the top level of document  Line 
> > 1 --MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073 "
> >
> > The response is still correct. This is the reply received.
> >
> > --MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073
> > Content-Type: application/soap+xml; charset=utf-8
> > Content-Transfer-Encoding: 8bit
> > Content-ID: <0.urn:uuid:2BBB929C9F381AC14C1299861024074@apache.org>
> >
> > <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope 
> > xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:getContrattoFullResponse 
> > xmlns:ns="http://services.at.avcp.it"><ns:return 
> > xmlns:ax21="http://in.dto.at.avcp.it/xsd" 
> > xmlns:ax23="http://out.dto.at.avcp.it/xsd" 
> > xmlns:ax24="http://dto.at.avcp.it/xsd" 
> > type="it.avcp.at.dto.out.ContrattiOutDTO"><ax23:contratto 
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" 
> > /><ax23:codice>getContrattoFull</ax23:codice><ax23:esit
> > o>-1</ax23:esito><ax23:messaggio>getContrattoFull:: Il contratto non e' 
> > stato 
> > trovato</ax23:messaggio></ns:return></ns:getContrattoFullResponse></soapenv:Body></soapenv:Envelope>
> > --MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1299861024073--
> >
> > I think the Parser does not work because  the answer is interpreted as a
> > attachmentche really is not or something like that ..
> >
> 
> It seems that it's the other way: the SOAP runtime is not expecting 
> MultiPart/MIME but that's what the Service is sending back. I wish we could 
> see the whole response - i.e. with the HTTP headers. That's how the Delphi 
> runtime will try to determine if the response is MultiPart or not. 
> Interestingly I don't see the reason why the Server sent the response this 
> way because the XML response (which is always in the first part) does not 
> make any references to other parts.
> 
> Two questions:
> ===========
> 1. Can you capture the whole response - include HTTP headers - using 
> something like WireShark/Ethereal. You can even use something like 
> proxyTrace and configure WinInet to use it. I'd like to see the HTTP headers 
> that came back with the response to determine why the Delphi runtime did not 
> detect multipart and instead pass the whole thing to the XML parser [which, 
> as expected, did not like the MIME boundary].
> 
> 2. If the above does not work, can you point me to the WSDL of the Service? 
> I'd like to see there's any hint there about Attachments/MTOM/??
> 
> If possible, do post the signature that the importer gave you for that 
> method. Thank you.
> 
> Cheers,
> 
> Bruneau

Hello,
Thank you very much for your interest, sorry for the delay but I was abroad in those days. 

From wireShark:

+This is the request+ 
6	0.057956	sviluppo.domattesta.attesta.lc	ppp188-1-13-151-13as58mi1.iunet.it	HTTP/XML	POST /attestazioniWS_1.2/services/attestazioniSoa.attestazioniSoaHttpSoap12Endpoint/ HTTP/1.1 

POST /attestazioniWS_1.2/services/attestazioniSoa.attestazioniSoaHttpSoap12Endpoint/ HTTP/1.1
SOAPAction: "urn:getContrattoFull"
Content-Type: text/xml; charset="utf-8"
User-Agent: CodeGear SOAP 1.3
Host: servizisoa.avcp.it:8080
Content-Length: 727
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: JSESSIONID=AED4CEFF9EC81B08380217564FEEBB6F
Authorization: Basic TU5URE5DNzRBMDdFOTg2Qjpkb21lVlNyaw==

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="http://in.dto.at.avcp.it/xsd"><NS1:getContrattoFull xmlns:NS1="http://services.at.avcp.it"><searchCriteria href="#1"/></NS1:getContrattoFull><NS2:SearchContrattoInDTO id="1" xsi:typ
e="NS2:SearchContrattoInDTO"><codiceSOA xsi:type="xsd:string">7</codiceSOA><numContratto xsi:type="xsd:string">001</numContratto></NS2:SearchContrattoInDTO></SOAP-ENV:Body></SOAP-ENV:Envelope>

+This is the response+

11	0.178707	ppp188-1-13-151-13as58mi1.iunet.it	sviluppo.domattesta.attesta.lc	HTTP/XML	HTTP/1.1 200 OK 

HHTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1300207907109; type="text/xml"; start="<0.urn:uuid:2BBB929C9F381AC14C1300207907110@apache.org>"

Transfer-Encoding: chunked

Date: Tue, 15 Mar 2011 16:51:46 GMT



379

--MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1300207907109

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

Content-Transfer-Encoding: 8bit

Content-ID: <0.urn:uuid:2BBB929C9F381AC14C1300207907110@apache.org>



<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:getContrattoFullResponse xmlns:ns="http://services.at.avcp.it"><ns:return xmlns:ax21="http://in.dto.at.avcp.it/xsd" xmlns:ax23="http://out.dto.at.avcp.it/xsd" xmlns:ax24="http://dto.at.avcp.it/xsd" type="it.avcp.at.dto.out.ContrattiOutDTO"><ax23:contratto xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" /><ax23:codice>getContrattoFull</ax23:codice><ax23:es
ito>-1</ax23:esito><ax23:messaggio>getContrattoFull:: Il contratto non e' stato trovato</ax23:messaggio></ns:return></ns:getContrattoFullResponse></soapenv:Body></soapenv:Envelope>

38



--MIMEBoundaryurn_uuid_2BBB929C9F381AC14C1300207907109

2

--

0

This is the wsdl location http://servizisoa.avcp.it:8080/attestazioniWS_1.2/services/attestazioniSoa?wsdl

I've noticed that the wdsl importer give me this adresses

 // ************************************************************************ //
  // Namespace : http://services.at.avcp.it
  // soapAction: urn:%operationName%
  // transport : http://schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : attestazioniSoaSoap12Binding
  // service   : attestazioniSoa
  // port      : attestazioniSoaHttpSoap12Endpoint
  // URL       : *http://10.119.128.211*:8080/attestazioniWS_1.2/services/attestazioniSoa.attestazioniSoaHttpSoap12Endpoint/
but 10.119.128.211 is a local address, so i've to change the const defURL  in the function GetattestazioniSoaPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): attestazioniSoaPortType;  from 10.119.128.211  to "services.at.avcp.it" and use something like 
"att:=GetattestazioniSoaPortType(false,'',HTTPRIO1);"
and not  "att:=GetattestazioniSoaPortType;"  as it can't work. I do not know if this really matter however..

Cheers
Bruno

Edited by: Bruno Lorenzo on Mar 15, 2011 10:07 AM
0
Bruno
3/15/2011 5:07:32 PM
Hello,

Thanks for the additional information. The issue in this case is that the 
runtime is not expecting the response in multipart/related format. But it 
should be handle to handle it and simply extract the SOAP envelope from the 
first part. If time allows could you try the following and let me know what 
you find out as I'm trying to locate the failure point:

1. Add SOAPHTTPTrans.pas and RIO.pas to your project (you might want to copy 
these files from $(BDS)\source\soap to your project's directory).

2. See a breakpoint in THTTPReqResp.Receive (SOAPHTTPTrans.pas) on this 
line:


{code}
  { Ask for Content-Type }
  Size := MaxContentType;
  SetLength(FContentType, MaxContentType);
  HttpQueryInfo(Pointer(Context), HTTP_QUERY_CONTENT_TYPE, @FContentType[1], 
Size, Index);
  SetLength(FContentType, Size div sizeof(Char));

  { Extract Mime-Boundary }
  FMimeBoundary := GetMimeBoundaryFromType(FContentType);   /// BREAKPOINT 
HERE

  { Read data }
{code}

On my setup it's line 758. I'm curious about the value of FContentType and 
whether we correctly retrieve a MimeBoundary. If yes, the code in RIO should 
proceed with multipart handling. I suspect we fail there. But it's not clear 
to me whether that's the case or not.

3. The next relevant point, if the above succeeds in retrieve a 
MIMEBoundary, would be in RIO.pas:


{code}
{$IFDEF ATTACHMENT_SUPPORT}
          { If we're expecting MIME parts, process 'em }
          if FWebNode.MimeBoundary <> '' then    // BREAKPOINT HERE
          begin
            AttachHandler.ProcessMultiPartForm(Resp, XMLStream, 
FWebNode.MimeBoundary, Nil,
                                               FConverter.Attachments, 
FConverter.TempDir);
            { Now point RespXML to Envelope }
            RespXML := XMLStream;
          end;
{$ENDIF}
          FConverter.ProcessResponse(RespXML, IntfMD, MethMD, FContext, 
FHeadersInbound);
{code}


That's on line 961 on my setup. Let me know if you go through 
ProcessMultipPartForm and reset the RespXML stream.

Thank you!

Cheers,

Bruneau
0
Jean
3/17/2011 11:39:54 PM
> {quote:title=Jean-Marie Babet wrote:}{quote}
> Hello,
> 
> Thanks for the additional information. The issue in this case is that the 
> runtime is not expecting the response in multipart/related format. But it 
> should be handle to handle it and simply extract the SOAP envelope from the 
> first part. If time allows could you try the following and let me know what 
> you find out as I'm trying to locate the failure point:
> 
> 1. Add SOAPHTTPTrans.pas and RIO.pas to your project (you might want to copy 
> these files from $(BDS)\source\soap to your project's directory).
> 
> 2. See a breakpoint in THTTPReqResp.Receive (SOAPHTTPTrans.pas) on this 
> line:
> 
> 
> {code}
>   { Ask for Content-Type }
>   Size := MaxContentType;
>   SetLength(FContentType, MaxContentType);
>   HttpQueryInfo(Pointer(Context), HTTP_QUERY_CONTENT_TYPE, @FContentType[1], 
> Size, Index);
>   SetLength(FContentType, Size div sizeof(Char));
> 
>   { Extract Mime-Boundary }
>   FMimeBoundary := GetMimeBoundaryFromType(FContentType);   /// BREAKPOINT 
> HERE
> 
>   { Read data }
> {code}
> 
> On my setup it's line 758. I'm curious about the value of FContentType and 
> whether we correctly retrieve a MimeBoundary. If yes, the code in RIO should 
> proceed with multipart handling. I suspect we fail there. But it's not clear 
> to me whether that's the case or not.
> 
> 3. The next relevant point, if the above succeeds in retrieve a 
> MIMEBoundary, would be in RIO.pas:
> 
> 
> {code}
> {$IFDEF ATTACHMENT_SUPPORT}
>           { If we're expecting MIME parts, process 'em }
>           if FWebNode.MimeBoundary <> '' then    // BREAKPOINT HERE
>           begin
>             AttachHandler.ProcessMultiPartForm(Resp, XMLStream, 
> FWebNode.MimeBoundary, Nil,
>                                                FConverter.Attachments, 
> FConverter.TempDir);
>             { Now point RespXML to Envelope }
>             RespXML := XMLStream;
>           end;
> {$ENDIF}
>           FConverter.ProcessResponse(RespXML, IntfMD, MethMD, FContext, 
> FHeadersInbound);
> {code}
> 
> 
> That's on line 961 on my setup. Let me know if you go through 
> ProcessMultipPartForm and reset the RespXML stream.
> 
> Thank you!
> 
> Cheers,
> 
> Bruneau

Hello, 
I really thank you for your interest.
 
Summary:
 
I'm using delphi2010 and source files SOAPHTTPTrans.pas and RIO.pas seems not distributed in source code. 

However, I've tried to write code using Delphi 2007.
 
Incredibly, with Delphi 2007 it works perfectly!! The parser  returns the correct answers. 

Now, I would not, however,  downgrade my project to 2007, obviously there is some problem in delphi 2010, i've also tried with a new demo version of delphiXE and there is the same problem.

But I can't put those breakpoints as I do not have the source code for  SOAPHTTPTrans and  RIO. 

I also tried to use the file generated by wsdl importer of Delphi 2007 into my Delphi 2010 project, but it do not work.

 the object HTTPRIO1 are identical in delphi 2007 and delphi 2010:

 object HTTPRIO1: THTTPRIO
    OnAfterExecute = HTTPRIO1AfterExecute
    OnBeforeExecute = HTTPRIO1BeforeExecute
    WSDLLocation =
      'http://servizisoa.avcp.it:8080/attestazioniWS_1.2/services/attes' +
      'tazioniSoa?wsdl'
    Service = 'attestazioniSoa'
    Port = 'attestazioniSoaHttpSoap12Endpoint'
    HTTPWebNode.UserName = 'pincopallo'
    HTTPWebNode.Password = 'testsoa'
    HTTPWebNode.UseUTF8InHeader = True
    HTTPWebNode.InvokeOptions = [soIgnoreInvalidCerts, soAutoCheckAccessPointViaUDDI]
    Converter.Options = [soSendMultiRefObj, soTryAllSchema, soRootRefNodesToBody, soCacheMimeResponse, soUTF8EncodeXML]

Thank you!

Cheers,

Bruno
0
Bruno
3/18/2011 4:37:06 PM
Hello,


> However, I've tried to write code using Delphi 2007.
>
> Incredibly, with Delphi 2007 it works perfectly!! The parser  returns the 
> correct answers.

Ummm... this makes me suspect that you might be running in the SOAPAttach 
problem I noticed recently and mentioned here:

  https://forums.embarcadero.com/message.jspa?messageID=328727#328727

In that particular case, the problem was a Delphi Service not properly 
handling a MultiPart request but it's the same code that's used by a Client 
to handle a MultiPart response. The reason I'm suspecting this issue is 
because the problem that I found is that during the switch from Ansi to 
Unicode strings (i.e. 2007 -> 2009), the logic to process the MIME parts was 
incorrectly done... It's not easy to *see* the problem because the bug in 
the Sender was cancelled by another bug in the receiving logic. However, 
once you interact with a non-Delphi framework passing MIME around, the 
problem shows up.


> I'm using delphi2010 and source files SOAPHTTPTrans.pas and RIO.pas seems 
> not distributed in source code.

This surprises me but maybe that's the case. I thought we always provided 
the source for the SOAP runtime. If you don't find the SOAP sources, I'd be 
happy to make them available. Could you grab the files I've posted here:

  https://forums.embarcadero.com/thread.jspa?messageID=332155&tstart=0#332155

And add them to your project. The key files to add are probably 
SOAPAttach.pas, SOAPHTTPTrans.pas and RIO.pas (but you may add more/all). 
Once, that's done, rebuild the project. The bug that I ran into while 
looking at the other thread mentioned above was related to the ReadContent 
method in SOAPAttach.pas (around line 616). The version you have probably 
reads:

{code}
  procedure ReadContent(ADestStream: TStream);
  var
    SLine: String;
  begin
    SLine := UTF8ToString(ReadLine(MimeStream.SourceStream));
    while (MimeStream.SourceStream.Position <= MimeStream.SourceStream.Size) 
and
          (not SameMimeBoundary(SLine, MimeBoundary)) do
    begin
      ADestStream.Write(SLine[1], Length(SLine));
      SLine := UTF8ToString(ReadLine(MimeStream.SourceStream));
      if Length(SLine) = 0 then
        Raise Exception.Create(SMimeReadError);
    end;
    FLastMimeBoundary := sLine;
  end;
{code}

And that's wrong because SLine is a 'string' which means we will be writing 
double-byte characters into the stream. The correct version would be:

{code}
  procedure ReadContent(ADestStream: TStream);
  var
    SLine: AnsiString;
  begin
    SLine := ReadLine(MimeStream.SourceStream);
    while (MimeStream.SourceStream.Position <= MimeStream.SourceStream.Size) 
and
          (not SameMimeBoundary(SLine, MimeBoundary)) do
    begin
      ADestStream.Write(SLine[1], Length(SLine));
      SLine := ReadLine(MimeStream.SourceStream);
      if Length(SLine) = 0 then
        Raise Exception.Create(SMimeReadError);
    end;
    FLastMimeBoundary := sLine;
  end;
{code}

IOW, SLine should be an AnsiString.

Try the above and let me know if any of that is relevant to your case. Thank 
you.

Cheers,

Bruneau
0
Jean
3/19/2011 5:01:26 AM
> {quote:title=Jean-Marie Babet wrote:}{quote}
> Hello,
> 
> 
> > However, I've tried to write code using Delphi 2007.
> >
> > Incredibly, with Delphi 2007 it works perfectly!! The parser  returns the 
> > correct answers.
> 
> Ummm... this makes me suspect that you might be running in the SOAPAttach 
> problem I noticed recently and mentioned here:
> 
>   https://forums.embarcadero.com/message.jspa?messageID=328727#328727
> 
> In that particular case, the problem was a Delphi Service not properly 
> handling a MultiPart request but it's the same code that's used by a Client 
> to handle a MultiPart response. The reason I'm suspecting this issue is 
> because the problem that I found is that during the switch from Ansi to 
> Unicode strings (i.e. 2007 -> 2009), the logic to process the MIME parts was 
> incorrectly done... It's not easy to *see* the problem because the bug in 
> the Sender was cancelled by another bug in the receiving logic. However, 
> once you interact with a non-Delphi framework passing MIME around, the 
> problem shows up.
> 
> 
> > I'm using delphi2010 and source files SOAPHTTPTrans.pas and RIO.pas seems 
> > not distributed in source code.
> 
> This surprises me but maybe that's the case. I thought we always provided 
> the source for the SOAP runtime. If you don't find the SOAP sources, I'd be 
> happy to make them available. Could you grab the files I've posted here:
> 
>   https://forums.embarcadero.com/thread.jspa?messageID=332155&tstart=0#332155
> 
> And add them to your project. The key files to add are probably 
> SOAPAttach.pas, SOAPHTTPTrans.pas and RIO.pas (but you may add more/all). 
> Once, that's done, rebuild the project. The bug that I ran into while 
> looking at the other thread mentioned above was related to the ReadContent 
> method in SOAPAttach.pas (around line 616). The version you have probably 
> reads:
> 
> {code}
>   procedure ReadContent(ADestStream: TStream);
>   var
>     SLine: String;
>   begin
>     SLine := UTF8ToString(ReadLine(MimeStream.SourceStream));
>     while (MimeStream.SourceStream.Position <= MimeStream.SourceStream.Size) 
> and
>           (not SameMimeBoundary(SLine, MimeBoundary)) do
>     begin
>       ADestStream.Write(SLine[1], Length(SLine));
>       SLine := UTF8ToString(ReadLine(MimeStream.SourceStream));
>       if Length(SLine) = 0 then
>         Raise Exception.Create(SMimeReadError);
>     end;
>     FLastMimeBoundary := sLine;
>   end;
> {code}
> 
> And that's wrong because SLine is a 'string' which means we will be writing 
> double-byte characters into the stream. The correct version would be:
> 
> {code}
>   procedure ReadContent(ADestStream: TStream);
>   var
>     SLine: AnsiString;
>   begin
>     SLine := ReadLine(MimeStream.SourceStream);
>     while (MimeStream.SourceStream.Position <= MimeStream.SourceStream.Size) 
> and
>           (not SameMimeBoundary(SLine, MimeBoundary)) do
>     begin
>       ADestStream.Write(SLine[1], Length(SLine));
>       SLine := ReadLine(MimeStream.SourceStream);
>       if Length(SLine) = 0 then
>         Raise Exception.Create(SMimeReadError);
>     end;
>     FLastMimeBoundary := sLine;
>   end;
> {code}
> 
> IOW, SLine should be an AnsiString.
> 
> Try the above and let me know if any of that is relevant to your case. Thank 
> you.
> 
> Cheers,
> 
> Bruneau

Hello, 
the web server has been down these days so I could not do the tests. 
Howevere now It's  back on line.
 
Thanks for the sources. 

 
The procedure ReadContent (ADestStream: TStream); is never called. 

I've noticed this differences:

In THTTPReqResp.Send(const ASrc: TStream): Integer;

the value of the variabile  ContentHeader differs: 

delphi 2007:
        "Content type: text/xml; Charset ="utf-8";
delphi 2010:
         "Content type: application+soap/xml; Charset ="utf-8"; action="urn:getContrattoFull"

But the real problem is  in the unit SOAPAttach.pas in funtcion  GetMimeBoundaryFromType(const ContentType: string): string; 
where ContentType passed is wrong.

In delphi 2007 it has: ContentType 'multipart/related; boundary=MIMEBoundaryurn_uuid_9686357FA57BD537381301077406041; type="text/xml"; start="<0.urn:uuid:9686357FA57BD537381301077406042@apache.org>"'
In delphi 2010 non sense character.

Cheers
Bruno
0
Bruno
3/25/2011 6:31:18 PM
Hi Bruno,

did you get your programm to work? I think I've got the same problem here. I got an response as multipart, but the variable FContentType doesn't contain a valid content-type. It only contains hieroglyphics.

Best regards

Robin
0
Robin
10/7/2011 11:27:13 AM
Hello,
i using THttpRIO component in Delphi 2010 (Rad studio 2010 version 14.0.3615.26342) for a web service client application.

My WSDL Location is:
https://ws-telematicoprova.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService/META-INF/wsdl/TelematicoFtp.wsdl

I put these setting for Thttprio component:

WSDLLocation=https://ws-telematicoprova.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService/META-INF/wsdl/TelematicoFtp.wsdl
Port=TelematicoFtpWsBindingImpl (automatically obtained in design time)
Service=TelematicoFtpWsBindingImplService (automatically obtained in design time)
HTTPWebNode.UserName=XXXXXX
HTTPWebNode.Password=YYYYYY

i generated code with WSDL Importer with these settings:

WSDL Source:
https://ws-telematicoprova.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService/META-INF/wsdl/TelematicoFtp.wsdl
User Name: XXXXXX
Password: YYYYYY
Proxy: [blank]
Automatic SOAP Versioning. (Recommended)
Other: as default

It seems to connect in a right way, but As soon as i call one of the functions i have the same exception:

EDOMParseError  "Invalid at the top level of document Line: 1 --MIMEBoundaryurn_uuid_847C5CE04B841C7BA"

I get this httprio component response in OnAfterExecute event:

------------------------------------------------------------------------------------------------------
--MIMEBoundaryurn_uuid_847C5CE04B841C7BA01339434035856
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:847C5CE04B841C7BA01339434035857@apache.org>

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault><faultcode>soapenv:Server</faultcode>
<faultstring>java.lang.NullPointerException</faultstring>
</soapenv:Fault></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_847C5CE04B841C7BA01339434035856--
------------------------------------------------------------------------------------------------------

i generated again code with WSDL Importer with same settings but changing the option:

- Process only WSDL Binding extensions for the SOAP 1.1 Protocol

instead of

-Automatic SOAP Versioning. (Recommended)

and had the same exception.

Finally i generated again code with WSDL Importer with same settings but changing the option:

- Process only WSDL Binding extensions for the SOAP 1.2 Protocol

and in this case i had another  exception:

ESOAPHTTPException 
"Unable to retrieve the URL endpoint for Service/Port 'TelematicoFtpWsBindingImplService/TelematicoFtpWsBindingImpl' 
from WSDL https://ws-telematicoprova.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService/META-INF/wsdl/TelematicoFtp.wsdl"


I tested the web service with same setting with SoapUI 4.5.0 and is running ok.
I tested the application whit another web service and it running ok

please help me 

cheers
Enzo Rubino
0
Enzo
6/11/2012 6:00:43 PM
Do you have found a solution?
I have Delphi XE2 and the same problem.

Thank you
Alessandro
0
Alessandro
10/4/2012 4:02:50 PM
Reply:

Similar Artilces:

Delphi 2010 webservice consumer pass null strings to webservice [Edit]
Hello, I need to consume a webservice that is developed in java ( thas all that I know ). I have a HTTPRIO componente and have import the webservice file win the WSDL importer. Til here everything is allright but when I run the application all the parameters reach the webservice as null. I have made some webservice and consumers but I never have had problems ( I make the server and the client ) I test to do the same with prism and c++ bilder and it go allright, but I need it to do in delphi Thanks PD: Pleas be patient, my English is not good Edited by: Adrian Zussino on Sep 8, 2010 3...

Code works in Delphi 7 but not in Delphi 2010 [Edit]
hello, i have a procedure that open's a file by passing the file name as the parameter to the executable. something like this {code} C : \ P r o g r a m F i l e s \ Da c k e r \ D r a c k e r . e x e " G : \ D E l p h i 7 \ D e l p h i 7 A p p _ l o g . t " {code} The source code is {code} procedure OpenFileWithExe var hReg: HKEY; Ret: Longint; RegDataType, RegDataSize: DWORD; CmdLine: array [0..560] of Char; Len: Integer; SInfo: TStartupInfo; PInfo: TProcessInformation; begin Ret := windows.RegOpenKeyEx(HKEY_CURRENT_USER, ...

Update Delphi 2005 to Delphi 2010, which do i need? [Edit]
Hello, we have one Delphi 2005 Professional here and want to upgrade to Delphi 2010, but we are a bit confused. Our distributor in Germany, ingram-micro offers several upgrade products: UPG DELPHI 2010 PRO - NAMED USER UPG DELPHI 2010 PRO - NAMED USER ELS UPG DELPHI 2010 PRO - NAMED USER FLEX RAD STUDIO 2010 PRO - UPG UPG RAD STUDIO 2010 PRO - NAMED ELC UPG RAD STUDIO 2010 PRO - NAMED FLEX UPG DELPHI 2010 PRO - CONCURRENT ELS UPG DELPHI 2010 PRO - CONCURRENT FLEX What do they mean exactly and which one do i need? At the moment delphi is installed on two PCs and we want to use ...

Delphi 2010 produces much larger binaries than Delphi 2009 [Edit]
When I compile my project with Delphi 2010 the resulting executable is about 30% larger than the one compiled with Delphi 2009. Both binaries are compiled with the same source code and project options. The size of individual DCU files increases by 5-20%. Has anybody experienced similar results? Has anybody an idea what could cause this? It surprises me, as the changes in syntax and VCL have not been that big. Best regards, Joachim Edited by: Joachim Marder on Sep 25, 2009 6:07 AM "Joachim Marder" wrote in message news:166152@forums.codegear.com... > When I compi...

Delphi XE / Delphi 2010
Hello! I noticed that Embarcadero® Delphi® 2010 Version is not on the list of products on Embarcadero page. Or is it still possible to buy it? Will RAD Studio XE compile programs written in Delphi 2010 without problems.? Thanks. Am 13.09.2010 09:04, schrieb Petra Nemec: > Will RAD Studio XE compile programs written in Delphi 2010 without problems.? As always you will probably have to recreate the projects as the import is still a bit -- special. Christian Hello! Does anybody know if it is still possible to get a Delphi2010 trial version (if yes where)? ...

from delphi 6 to delphi 2010
Hi. It is possible, with component RX, dxforumlibrary, InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. Thank by comments. excequiel arostica wrote: >Hi. > It is possible, with component RX, dxforumlibrary, >InfoPower3000Pro, StringAlignGrid. Accepts communication BDE. > >Thank by comments. Rx is dead and sources are taken over by jcl/jvcl. I dont know about the rest of the components and i have no experiences with bde over the last 9 years. excequiel arostica wrote: > Hi. > It is possible, with component RX, dxforumlibrary,...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi 2010 - SOAP Client With Attachement
I'm facing a problem on how to set the Content-ID when sending attachment file over Web-Service Delphi always generate the Content-ID automatically, for example : --MIME_boundaryB0R9532143182121 *Content-ID: <F22087C9-8E78-4CC0-B88D-47432AD1B4A7>* Content-Length: 4766 Content-Type: text/plain; charset="utf-8" Content-transfer-encoding: binary > {quote:title=Cheong Soon Chai wrote:}{quote} > I'm facing a problem on how to set the Content-ID when sending attachment file over Web-Service > > Delphi always generate the Content-ID automatically, f...

Price of upgrade from Delphi 2010 Professional to Delphi 2010 Enterprise?
It's weird, but I could not find the answer on so simple question not in Embarcadero Shop, neither by the forum search. For example, the shop info about Enterprise upgrade says: The Upgrade product is available to registered owners of 2006-2009 versions, blah-blah... So, if I'm Delphi 2010 Professional user, I even not eligible for upgrade? I have to buy a new version of Enterprise??? But if I'm Delphi 2006 Professional user, I can upgrade. Please clarify this nonsense for me. Exact question is in the subject. Thanks! Hi Dmitri, > It's weird, but I could not...

Unchanged SOAP code not works after migrating XE2 from Delphi 2010 [Edit]
Hi there! I have a horrible issue since days now and unfortunately, I haven't overcome it yet. We have a Java webservice in the middleware, and we consume it with Delphi. It was generated in Delphi 2010 with wsdlImporter, and with the default options. When I call the webservice, Delphi produces an XML like this: {code} <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <calculateThmByC...

ANN: DataSnap-like Client-Server JSON RESTful Services in Delphi 7-2010 [Edit]
How to implement a very useful service... say... adding two numbers? In our framework, you code Server-Side: {code} function TSQLRestServerTest.Sum(aRecord: TSQLRecord; aParameters: PUTF8Char; const aSentData: RawUTF8; var aResp, aHead: RawUTF8): Integer; var a,b: Extended; begin if not UrlDecodeNeedParameters(aParameters,'A,B') then begin result := 404; // invalid Request exit; end; while aParameters<>nil do begin UrlDecodeExtended(aParameters,'A=',a); UrlDecodeExtended(aParameters,'B=',b,@aParameters); end; aRes...

Migrate from Delphi 2007 to Delphi 2010
Hi All, Thanks in advance for your help. Below is my query, Currently I am using Delphi 2007 and i want to migrate to Delphi 2010. 1. What all things i need to take care while doing this? 2. What all third party components will get impacted? 3. Any known issues in Delphi 2010 which might impact the cause? 4. Any changes in database operation required as i am using Oracle? Hope I have post this query under correct category. If not sorry for the trouble and could you please suggest me the correct category for this? Looking forward for your response. Have a great day. Th...

Delphi 2010 w Delphi 2007
I have D2007 installed on my laptop (XP sp3 running on dual core Athlon). Can I install D2010 on this machine without it affecting D2007? Will D2010 affect D2007 in any way? Thanks, Randall Carpenter > {quote:title=Randall Carpenter wrote:}{quote} > I have D2007 installed on my laptop (XP sp3 running on dual core Athlon). > Can I install D2010 on this machine without it affecting D2007? Will D2010 > affect D2007 in any way? Won't hurt a thing. I have D7, RAD Studio 2007, RAD Studio 2009, and RAD Studio 2010 all on my desktop system and they coexist fine. Jus...

delphi 2006 code in delphi 2010
hello, is there any option to make delphi 2006 code work in delphi 2010? something like in java IDEs where you can define the code level you like to use? the problem is, that i made a project with 2006 and sent it to my customer. they got 2010 and it compiles fine, but it just doesn't work. it deals with en-/decryption of text, we assumed, that it has something to do with ansi vs. unicode strings... but we cant find the exact position where the error occurs. i am a bit dissapointed, because everywhere i read that the new IDE will always be downwards compatible and so on.. but in ...

Web resources about - SOAP client delphi 2010 parse [Edit] - embarcadero.delphi.webservices

MUD client - Wikipedia, the free encyclopedia
A MUD client is a computer application used to connect to a MUD , a type of multiplayer online game . Generally, a MUD client is a very basic ...

3Q Digital Offers Peek At 3Q Facebook Ad Performance By Its Largest Clients
With Facebook set to report its third-quarter earnings Wednesday , digital marketing agency 3Q Digital offered some insight on how the social ...

Gallop Labs hires former Facebook Client Partner as Director of Sales
Gallop Labs , a social marketing and analytics firm, announced that it has hired former Facebook Client Partner Andrew Peebles as the company’s ...

Sydney builder Bill Issa convicted of attacking clients who complained about his work
... to fix up rundown family homes and transform them into something flashy and new. "It will feel like a new home," he promised one client. "It ...

Client’s “Great Thanksgiving Listen” Campaign Featured on Google Homepage
We love when our clients are successful, and StoryCorps and their amazing Thanksgiving Listen campaign being featured on Google’s homepage certainly ...

In Search Of Client Portals: Rocket Matter
Technology columnist Sean Doherty continues his search for client portals in practice management software-as-a-service offerings, this time checking ...

Agencies Should Follow Clients' Lead on Diversity
A few weeks ago, PepsiCo's Brad Jakeman called out advertising agencies for not evolving with the times. Most important, he criticized them for ...

Dropbox is shutting down Mailbox, the popular email client
Dropbox acquired Mailbox, the extremely popular email client, way back in 2013, and unfortunately it's now time to say goodbye. That's right, ...

Guggenheim Securities' clients - Business Insider Deutschland
The 16-year-old firm has been an adviser on 5 massive transactions in what has been one of the busiest years for mergers and acquisitions on ...

Lawyer defends cop who shot teen 16 times, says client feared for life
The lawyer for the Chicago police officer who fatally shot 17-year-old Laquan McDonald defended his client Friday, saying the officer feared ...

Resources last updated: 12/10/2015 12:37:11 PM