PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Noms de domaine > comp.protocols.tcp-ip > Send XML request to a server with telnet.
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.protocols.tcp-ip TCP and IP network protocols.

Send XML request to a server with telnet.

Réponse
 
LinkBack Outils de la discussion
Vieux 29/04/2006, 16h30   #1
Nanar Duff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Send XML request to a server with telnet.

Hello,


I' m trying to send a XML request (with some SOAP) to a server (more
exactly a web service) by telnet. I do:

*******************************************
$ telnet <serverIp> 8080

GET /wher/I/want/to/send/my/data/ HTTP/1.1 <ENT>
<ENT>
HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Date: Sat, 29 Apr 2006 17:22:43 GMT
Connection: close

0

Connection closed by foreign host.
$
********************************************
(<ENT> = push on enter)

So i cant send my XML request .... When i try to use HTTP/1.0 instead
HTTP/1.1, server anwer me the html page associate to the webservice.

Of course, when i directly send the XML request, server returns me a bad
request....

So how to send an XML request to a server please ?


Thanks.
  Réponse avec citation
Vieux 30/04/2006, 00h43   #2
slebetman@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Send XML request to a server with telnet.


Nanar Duff wrote:
> Hello,
>
>
> I' m trying to send a XML request (with some SOAP) to a server (more
> exactly a web service) by telnet. I do:
>
> *******************************************
> $ telnet <serverIp> 8080
>
> GET /wher/I/want/to/send/my/data/ HTTP/1.1 <ENT>
> <ENT>
> HTTP/1.1 400 Bad Request
> Server: Apache-Coyote/1.1
> Transfer-Encoding: chunked
> Date: Sat, 29 Apr 2006 17:22:43 GMT
> Connection: close


This is correct. You have just sent an invalid HTTP 1.1 request.
Remember, HTTP 1.1 requires a Host: header. Not only that, HTTP 1.1
servers are REQUIRED TO REJECT requests without the Host: header with a
400 Bad Request error. Thus the minimum request should be:

GET /wher/I/want/to/send/my/data/ HTTP/1.1\r\n
Host: serverIp:8080\r\n\r\n

> Connection closed by foreign host.
> $
> ********************************************
> (<ENT> = push on enter)
>
> So i cant send my XML request .... When i try to use HTTP/1.0 instead
> HTTP/1.1, server anwer me the html page associate to the webservice.


This is also correct since HTTP 1.0 does not have any required headers.

> Of course, when i directly send the XML request, server returns me a bad
> request....
>
> So how to send an XML request to a server please ?


Typically you'd need to do a POST request with the XML document/code as
part of the message body sent to the server:

POST /wher/I/want/to/send/my/data/ HTTP/1.0\r\n
Content-Length: 46\r\n
\r\n
<xml><code><sent>to server</sent></code></xml>

  Réponse avec citation
Vieux 06/05/2006, 06h35   #3
Nanar Duff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Send XML request to a server with telnet.

slebetman@yahoo.com a écrit :
> Nanar Duff wrote:
>
>
> This is also correct since HTTP 1.0 does not have any required headers.
>
>
>
>
> Typically you'd need to do a POST request with the XML document/code as
> part of the message body sent to the server:
>
> POST /wher/I/want/to/send/my/data/ HTTP/1.0\r\n
> Content-Length: 46\r\n
> \r\n
> <xml><code><sent>to server</sent></code></xml>
>


(sorry for the late, but server was down).

Thanks for your answer, I try it by doing this:

*************************************************
$ telnet <ip address> 8080
POST /wher/I/want/to/send/my/data/ HTTP/1.1\r\n
Content-Type: text/xml; charset=utf-8\r\n
SOAPAction: ""\r\n
Content-Length: 785\r\n
Expect: 100-continue\r\n
Host: <ip address>:8080\r\n
\r\n
<xml><code><sent>to server</sent></code></xml>

HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Date: Sat, 06 May 2006 07:25:32 GMT
Connection: close

Connection closed by foreign host.
$
************************************************** *


But I' m not sure of the value of Content-Length. Is this the number of
character in the XML request ?

And maybe that my XML request is wrong. But server shouldn't send me
"data" to warn me that my request was wrong ?




Thanks.
  Réponse avec citation
Vieux 06/05/2006, 10h31   #4
Nanar Duff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Send XML request to a server with telnet.

Nanar Duff a écrit :
> Thanks for your answer, I try it by doing this:
>
> *************************************************
> $ telnet <ip address> 8080
> POST /wher/I/want/to/send/my/data/ HTTP/1.1\r\n
> Content-Type: text/xml; charset=utf-8\r\n
> SOAPAction: ""\r\n
> Content-Length: 785\r\n
> Expect: 100-continue\r\n
> Host: <ip address>:8080\r\n
> \r\n
> <xml><code><sent>to server</sent></code></xml>
>
> HTTP/1.1 400 Bad Request
> Server: Apache-Coyote/1.1
> Date: Sat, 06 May 2006 07:25:32 GMT
> Connection: close
>
> Connection closed by foreign host.
> $
> ************************************************** *
>
>
> But I' m not sure of the value of Content-Length. Is this the number of
> character in the XML request ?
>
> And maybe that my XML request is wrong. But server shouldn't send me
> "data" to warn me that my request was wrong ?


>
> Thanks.



Oops, I try request without \r\n, and its works fine.

Thanks.
  Réponse avec citation
Vieux 07/05/2006, 00h54   #5
slebetman@yahoo.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Send XML request to a server with telnet.


Nanar Duff wrote:
> Nanar Duff a écrit :
> > Thanks for your answer, I try it by doing this:
> >
> > *************************************************
> > $ telnet <ip address> 8080
> > POST /wher/I/want/to/send/my/data/ HTTP/1.1\r\n
> > Content-Type: text/xml; charset=utf-8\r\n
> > SOAPAction: ""\r\n
> > Content-Length: 785\r\n
> > Expect: 100-continue\r\n
> > Host: <ip address>:8080\r\n
> > \r\n
> > <xml><code><sent>to server</sent></code></xml>
> >
> > HTTP/1.1 400 Bad Request
> > Server: Apache-Coyote/1.1
> > Date: Sat, 06 May 2006 07:25:32 GMT
> > Connection: close
> >
> > Connection closed by foreign host.
> > $
> > ************************************************** *
> >
> >
> > But I' m not sure of the value of Content-Length. Is this the number of
> > character in the XML request ?
> >
> > And maybe that my XML request is wrong. But server shouldn't send me
> > "data" to warn me that my request was wrong ?

>
> >
> > Thanks.

>
>
> Oops, I try request without \r\n, and its works fine.
>


Yes, \r in my post refers to Carrige Return and \n refers to Linefeeds
as per C convention. For \r\n configure your telnet client to have CRLF
line endings (LF works but is not really conformant to HTTP spec) and
press the Enter key (actually the Return key which is labelled Enter on
most PC keyboard. The "real" Enter key is actually the one on the
numeric keypad).

  Réponse avec citation
Vieux 08/05/2006, 08h08   #6
Nanar Duff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Send XML request to a server with telnet.

slebetman@yahoo.com a écrit :
> Yes, \r in my post refers to Carrige Return and \n refers to Linefeeds
> as per C convention. For \r\n configure your telnet client to have CRLF
> line endings (LF works but is not really conformant to HTTP spec)



Ok, thanx for all this info


> press the Enter key (actually the Return key which is labelled Enter on
> most PC keyboard. The "real" Enter key is actually the one on the
> numeric keypad).


Ah ? But heuh... what is the difference between the Return key and the
"real" Enter key ? (just for my "general knowledge" :p )
  Réponse avec citation
Vieux 09/05/2006, 01h35   #7
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Send XML request to a server with telnet.

In article <445f0a78$0$1490$626a54ce@news.free.fr>,
Nanar Duff <_SPAMORAMA_dnanar@gmail.com> wrote:

> slebetman@yahoo.com a écrit :
> > Yes, \r in my post refers to Carrige Return and \n refers to Linefeeds
> > as per C convention. For \r\n configure your telnet client to have CRLF
> > line endings (LF works but is not really conformant to HTTP spec)

>
>
> Ok, thanx for all this info
>
>
> > press the Enter key (actually the Return key which is labelled Enter on
> > most PC keyboard. The "real" Enter key is actually the one on the
> > numeric keypad).

>
> Ah ? But heuh... what is the difference between the Return key and the
> "real" Enter key ? (just for my "general knowledge" :p )


For most applications, there's no difference.

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h35.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15498 seconds with 15 queries