Problem with HTTP post

AitorEGAitorEG Member Posts: 342
Hi everyone,

I am creating a develepomnet, that conenct with a webService, using HTTP post, that sends and XMl file to the server.
When I first start the RTC, and try to create the connection, appears this error:

ua80jzli3xz1.png

Error in the call to System.........dispose with this message: A task can only be discarded if has a completion status

If I dont close the RTC, and I try again to communicate with the service, I see this error:


8yw5lslbqkv1.png


It looks that the request is getting "stucked", but I dont understand when, where or why. Im creating the request in this way:

HttpWebRequest := WebRequest.Create(Uri.Uri('https://xxxxxxx/shipping/ship'));

HttpWebRequest.Method := 'POST';
HttpWebRequest.ContentType := 'text/xml';
HttpWebRequest.Timeout := 120000;     //30000
HttpWebRequest.UseDefaultCredentials(FALSE);  

XMLDocDotNet := XMLDocDotNet.XmlDocument;
XMLDoc.save('C:\XML\convert\XXX.xml');
XMLDocDotNet.Load('C:\XML\convert\XXX.xml');

ByteArray := Encoding.UTF8.GetBytes(XMLDocDotNet.OuterXml);

HttpWebRequest.ContentLength := ByteArray.Length;
TryCreateRequestStream(HttpWebRequest,RequestStream); 

RequestStream.Write(ByteArray,0,ByteArray.Length);  
TryGetWebResponse(HttpWebRequest,HttpWebResponse);       
StatusCode := HttpWebResponse.StatusCode;
StatusDescription := HttpWebResponse.StatusDescription;
ResponseText := ReadHttpResponseAsText(HttpWebResponse);

Does anyone see where can the development crash?

Any help will be really appreciatd, I'm quite stucked with this.

Thank you all!

Answers

  • AitorEGAitorEG Member Posts: 342
    I have executed with the debugger, and I also see:

    ryul6kkc890e.png


    "Cannot serialize the object"
Sign In or Register to comment.