|
From: KevinO on 26 Jun 2008 14:20 Hi I need to convert the following information to a Tcl/http POST: POST /X/Y/Serial.asmx HTTP/1.1 Host: xyz.net Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://uri.org/getSerialNumber" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope Bla.../"> <soap:Body> <getSerialNumber xmlns="http://uri.org/"> <serialNumber>int</serialNumber> </getSerialNumber> </soap:Body> </soap:Envelope> (Yes, it is SOAP, but I prefer to use http and not tclSOAP.) Here is what I have done (unsuccessfully, of course): set Form [ subst {<?xml version="1.0" encoding="utf-8"?> <soap:Envelope Bla.../"> <soap:Body> <GetTicketStatus xmlns="http://tempuri.org/"> <ticketNumber>12345678</ticketNumber> </GetTicketStatus> </soap:Body> </soap:Envelope>} ] set formLen [ string length $Form ] set token [ ::http::geturl $Proxy \ -headers [ list SOAPAction "http://tempuri.org/ GetTicketStatus" ] \ -headers [ list Content-Type {text/xml; charset=utf-8} ] \ -headers [ list Content-Length $formLen ] -query $formData I get a variety of error messages depending on the experiment I am conducting... If it is not clear already, I am a total novice in http, xml, soap. Can someone please put me on the path to success here...? Many thanks KO
From: KevinO on 26 Jun 2008 14:27 On Jun 26, 2:20 pm, KevinO <kevin...(a)yahoo.com> wrote: > Hi > > I need to convert the following information to a Tcl/http POST: > > POST /X/Y/Serial.asmx HTTP/1.1 > Host: xyz.net > Content-Type: text/xml; charset=utf-8 > Content-Length: length > SOAPAction: "http://uri.org/getSerialNumber" > > <?xml version="1.0" encoding="utf-8"?> > <soap:Envelope Bla.../"> > <soap:Body> > <getSerialNumber xmlns="http://uri.org/"> > <serialNumber>int</serialNumber> > </getSerialNumber> > </soap:Body> > </soap:Envelope> > > (Yes, it is SOAP, but I prefer to use http and not tclSOAP.) > > Here is what I have done (unsuccessfully, of course): > > set Form [ subst {<?xml version="1.0" encoding="utf-8"?> > <soap:Envelope Bla.../"> > <soap:Body> > <GetTicketStatus xmlns="http://tempuri.org/"> > <ticketNumber>12345678</ticketNumber> > </GetTicketStatus> > </soap:Body> > </soap:Envelope>} ] > > set formLen [ string length $Form ] > > set token [ ::http::geturl $Proxy \ > -headers [ list SOAPAction "http://tempuri.org/ > GetTicketStatus" ] \ > -headers [ list Content-Type {text/xml; charset=utf-8} ] \ > -headers [ list Content-Length $formLen ] > -query $formData > > I get a variety of error messages depending on the experiment I am > conducting... > If it is not clear already, I am a total novice in http, xml, soap. > > Can someone please put me on the path to success here...? > > Many thanks > KO Please ignore minor discrepancies, these are equal: GetTicketStatus = getSerialNumber ticketNumber = serialNumber etc.. Thanks again.
From: Gerald W. Lester on 26 Jun 2008 14:43 Kevin, Without more details about the errors, it is awful hard to help you. Is this for a web service that has a WSDL? If so you might want to have a look at Web Services for Tcl (the client side), available at http://code.google.com/p/tclws. You may want to look at the details of what it does with the ::http::* calls even if you don't use the package (because they successfully make SOAP calls). KevinO wrote: > Hi > > I need to convert the following information to a Tcl/http POST: > > POST /X/Y/Serial.asmx HTTP/1.1 > Host: xyz.net > Content-Type: text/xml; charset=utf-8 > Content-Length: length > SOAPAction: "http://uri.org/getSerialNumber" > > <?xml version="1.0" encoding="utf-8"?> > <soap:Envelope Bla.../"> > <soap:Body> > <getSerialNumber xmlns="http://uri.org/"> > <serialNumber>int</serialNumber> > </getSerialNumber> > </soap:Body> > </soap:Envelope> > > (Yes, it is SOAP, but I prefer to use http and not tclSOAP.) > > Here is what I have done (unsuccessfully, of course): > > set Form [ subst {<?xml version="1.0" encoding="utf-8"?> > <soap:Envelope Bla.../"> > <soap:Body> > <GetTicketStatus xmlns="http://tempuri.org/"> > <ticketNumber>12345678</ticketNumber> > </GetTicketStatus> > </soap:Body> > </soap:Envelope>} ] > > set formLen [ string length $Form ] > > set token [ ::http::geturl $Proxy \ > -headers [ list SOAPAction "http://tempuri.org/ > GetTicketStatus" ] \ > -headers [ list Content-Type {text/xml; charset=utf-8} ] \ > -headers [ list Content-Length $formLen ] > -query $formData > > I get a variety of error messages depending on the experiment I am > conducting... > If it is not clear already, I am a total novice in http, xml, soap. > > Can someone please put me on the path to success here...? > > Many thanks > KO -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+
From: KevinO on 26 Jun 2008 14:49 On Jun 26, 2:43 pm, "Gerald W. Lester" <Gerald.Les...(a)cox.net> wrote: > Kevin, > > Without more details about the errors, it is awful hard to help you. > > Is this for a web service that has a WSDL? > > If so you might want to have a look at Web Services for Tcl (the client > side), available athttp://code.google.com/p/tclws. > > You may want to look at the details of what it does with the ::http::* calls > even if you don't use the package (because they successfully make SOAP calls). > > > > KevinO wrote: > > Hi > > > I need to convert the following information to a Tcl/http POST: > > > POST /X/Y/Serial.asmx HTTP/1.1 > > Host: xyz.net > > Content-Type: text/xml; charset=utf-8 > > Content-Length: length > > SOAPAction: "http://uri.org/getSerialNumber" > > > <?xml version="1.0" encoding="utf-8"?> > > <soap:Envelope Bla.../"> > > <soap:Body> > > <getSerialNumber xmlns="http://uri.org/"> > > <serialNumber>int</serialNumber> > > </getSerialNumber> > > </soap:Body> > > </soap:Envelope> > > > (Yes, it is SOAP, but I prefer to use http and not tclSOAP.) > > > Here is what I have done (unsuccessfully, of course): > > > set Form [ subst {<?xml version="1.0" encoding="utf-8"?> > > <soap:Envelope Bla.../"> > > <soap:Body> > > <GetTicketStatus xmlns="http://tempuri.org/"> > > <ticketNumber>12345678</ticketNumber> > > </GetTicketStatus> > > </soap:Body> > > </soap:Envelope>} ] > > > set formLen [ string length $Form ] > > > set token [ ::http::geturl $Proxy \ > > -headers [ list SOAPAction "http://tempuri.org/ > > GetTicketStatus" ] \ > > -headers [ list Content-Type {text/xml; charset=utf-8} ] \ > > -headers [ list Content-Length $formLen ] > > -query $formData > > > I get a variety of error messages depending on the experiment I am > > conducting... > > If it is not clear already, I am a total novice in http, xml, soap. > > > Can someone please put me on the path to success here...? > > > Many thanks > > KO > > -- > +--------------------------------+---------------------------------------+ > | Gerald W. Lester | > |"The man who fights for his ideals is the man who is alive." - Cervantes| > +------------------------------------------------------------------------+ Gerald I will look at the information in the site, thanks for that and for replying. My code, as provided above, produces this error message: <h1>Bad Request (Invalid Header Name)</h1> Thanks KO
From: Gerald W. Lester on 26 Jun 2008 15:26 KevinO wrote: > On Jun 26, 2:43 pm, "Gerald W. Lester" <Gerald.Les...(a)cox.net> wrote: >> Kevin, >> >> Without more details about the errors, it is awful hard to help you. >> >> Is this for a web service that has a WSDL? >> >> If so you might want to have a look at Web Services for Tcl (the client >> side), available athttp://code.google.com/p/tclws. >> >> You may want to look at the details of what it does with the ::http::* calls >> even if you don't use the package (because they successfully make SOAP calls). >> >> >> >> KevinO wrote: >>> Hi >>> I need to convert the following information to a Tcl/http POST: >>> POST /X/Y/Serial.asmx HTTP/1.1 >>> Host: xyz.net >>> Content-Type: text/xml; charset=utf-8 >>> Content-Length: length >>> SOAPAction: "http://uri.org/getSerialNumber" >>> <?xml version="1.0" encoding="utf-8"?> >>> <soap:Envelope Bla.../"> >>> <soap:Body> >>> <getSerialNumber xmlns="http://uri.org/"> >>> <serialNumber>int</serialNumber> >>> </getSerialNumber> >>> </soap:Body> >>> </soap:Envelope> >>> (Yes, it is SOAP, but I prefer to use http and not tclSOAP.) >>> Here is what I have done (unsuccessfully, of course): >>> set Form [ subst {<?xml version="1.0" encoding="utf-8"?> >>> <soap:Envelope Bla.../"> >>> <soap:Body> >>> <GetTicketStatus xmlns="http://tempuri.org/"> >>> <ticketNumber>12345678</ticketNumber> >>> </GetTicketStatus> >>> </soap:Body> >>> </soap:Envelope>} ] >>> set formLen [ string length $Form ] >>> set token [ ::http::geturl $Proxy \ >>> -headers [ list SOAPAction "http://tempuri.org/ >>> GetTicketStatus" ] \ >>> -headers [ list Content-Type {text/xml; charset=utf-8} ] \ >>> -headers [ list Content-Length $formLen ] >>> -query $formData >>> I get a variety of error messages depending on the experiment I am >>> conducting... >>> If it is not clear already, I am a total novice in http, xml, soap. >>> Can someone please put me on the path to success here...? >>> Many thanks >>> KO >> -- >> +--------------------------------+---------------------------------------+ >> | Gerald W. Lester | >> |"The man who fights for his ideals is the man who is alive." - Cervantes| >> +------------------------------------------------------------------------+ > > Gerald > > I will look at the information in the site, thanks for that and for > replying. > My code, as provided above, produces this error message: > > <h1>Bad Request (Invalid Header Name)</h1> First off, you do not need to have the Content-Type or Content-Lenght headers, try removing them -- but do put a " -type text/xml" on the geturl call. If that does not work, then it most likely means that it did not like the value of SOAPAction. -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+
|
Next
|
Last
Pages: 1 2 Prev: Tcl-URL! - weekly Tcl news and links (Jun 26) Next: timeout for "socket"? |