Re: [twsocket] THttpCli and XML...
> >François has written a Universal Plug and Play component > > Yeah I tried it first and the device does not respond. It needs a > "discover" verb to respond. Windows uses "All", IIRC. Typical Microsoft, half baked APIs. Probably explains why it does not find all my devices, although I do tend to disable uPnP if I can. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] THttpCli and XML...
> > and I conclude that is doesn't [fully] support HTTP. > > I concur. It is a hybrid. It requires all the formatting of HTTP > ("Gets" to the device via THttpCli work without error) and XML > but, does not fully implement all the requirements. In which most of the capabilities of THttpCli are unneeded, just compose your complete HTTP request with minimal headers and XML and use a simple WSocket connection to send it (assuming no SSL), and receive the response in LineMode. > It uses SSDP and UDP to be discovered and how it is implemented > is a bit different than usual. François has written a Universal Plug and Play component using Windows APIs, not using TWSocket, that discovers uPnP devices and their capabilities, if it helps. Angus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] THttpCli and XML...
> I switched to a TWSocket and sent the complete post URL, parameters and XML data in one send > and the server responded without error. So, the header data the THttpCli component was adding > to the XML document was not allowed by the server. Only the XML data. This makes me thinking your server doesn't use HTTP protocol. Instead it uses a simple TCP session (Something like telnet). If the server support HTTP, it will for sure return an error if you don't send a HTTP request! You said the server is OK with the XML data sent thru a TCP session and I conclude that is doesn't support HTTP. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] THttpCli and XML...
It would be interesting to know what header(s) in particular is/are causing the problem. You may use the OnBeforeHeaderSend event to remove any of the headers, before the headers are sent. Or just temporary comment the code related to each of the header lines being sent, under the OverbyteIcsHttpProt.pas THttpCli.SendRequest(const Method, Version: String); method, until you get a positive response. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] THttpCli and XML...
Hi, I switched to a TWSocket and sent the complete post URL, parameters and XML data in one send and the server responded without error. So, the header data the THttpCli component was adding to the XML document was not allowed by the server. Only the XML data. Joy! Thanks for your time, Mark -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] THttpCli and XML...
I use ContentTypePost = application/x-www-form-urlencoded I don't use XML however. Jarek Karciarz -Original Message- From: TWSocket [mailto:twsocket-boun...@lists.elists.org] On Behalf Of RTT Sent: Sunday, March 6, 2016 9:12 PM To: ICS support mailing Subject: Re: [twsocket] THttpCli and XML... > I must be doing something wrong. > Are you setting the THttpCli.ContentTypePost property to the Content-Type (in your case "application/xml", I suppose) the server is expecting ? http://stackoverflow.com/questions/3272534/what-content-type-value-should-i- send-for-my-xml-sitemap -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] THttpCli and XML...
I must be doing something wrong. Are you setting the THttpCli.ContentTypePost property to the Content-Type (in your case "application/xml", I suppose) the server is expecting ? http://stackoverflow.com/questions/3272534/what-content-type-value-should-i-send-for-my-xml-sitemap -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] THttpCli and XML...
Hi, Can you show your code please? I am using code like this: void __fastcall TSocketClientModule::HttpPost(UnicodeString sUrl, UnicodeString sData, int iTimeout, int iPort) { HttpClient->URL=sUrl; HttpClient->Timeout=iTimeout; HttpClient->SocksPort=iPort; OutData=new TMemoryStream(); OutData->Write(sData.c_str(), sData.Length()); OutData->Seek(0, soFromBeginning); HttpClient->SendStream=OutData; InData=new TMemoryStream(); HttpClient->RcvdStream=InData; HttpClient->PostASync(); } My sData is not XML but this should not make big difference. Did you test posting with 3rd party tools like for example Chrome advanced REST client? Simply to be sure that your request URL and data are correct. Regards Jarek Karciarz -Original Message- From: TWSocket [mailto:twsocket-boun...@lists.elists.org] On Behalf Of zayin Sent: Sunday, March 6, 2016 7:33 PM To: twsoc...@elists.org Subject: [twsocket] THttpCli and XML... Hello, Version 7.25 For the first time I need to send an XML document to the server. I setup the URL for all the data. I put the XML document in a stream and set the index to 0. I call PostASync. Looking at Wireshark the URL data is all there and correct. The XML has stuff added to the front which messes up what the server expects and reports an error. For example the "Accept" value is added to the front of the XML data. I must be doing something wrong. Maybe I should not be using THttpCli and just use TWSocket, connect and send? Ciao, Mark -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be