From: KevinO on
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
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
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
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
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|
+------------------------------------------------------------------------+