Re: SOAP via HTTP



On Jun 26, 3:26 pm, "Gerald W. Lester" <Gerald.Les...@xxxxxxx> wrote:
KevinO wrote:
On Jun 26, 2:43 pm, "Gerald W. Lester" <Gerald.Les...@xxxxxxx> 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|
+------------------------------------------------------------------------+

Gerald

I followed your advices and you were right !!!
For the record, and hopefully someone will find it useful, here is my
working SOAP http POST:

set Proxy http://x.y.net/a/b/Serial.asmx
set SOAPAction getSerialNumber
set TMOUT 10000

set token [ ::http::geturl $Proxy \
-type "text/xml" \
-headers [ list SOAPAction "http://uri.org/$SOAPAction"; ]
\
-query $Form -timeout $TMOUT ]

Once again, a million thanks !!!
KO
.



Relevant Pages

  • Re: SOAP client via plugin
    ... After some test with the SOAP package, ... server, and should run using the TCL plugin. ...
    (comp.lang.tcl)
  • Re: SOAP client via plugin
    ... After some test with the SOAP package, ... server, and should run using the TCL plugin. ...
    (comp.lang.tcl)
  • Re: How may I use webAPIS like Soap (and others) with Dolphin?
    ... It has a list of web apis for all sorts of things including search ... I know there is an old SOAP package for dolphin. ... extra work to get it working. ...
    (comp.lang.smalltalk.dolphin)
  • Re: SOAP client via plugin
    ... After some test with the SOAP package, ... the next step I've tried is to run the SOAP client with the TCL ... server, and should run using the TCL plugin. ...
    (comp.lang.tcl)
  • PHP and SOAP calls
    ... I have been using nusoap to development a client that makes SOAP calls to a server. ... I have however been stuck on a small issue but can't seem to solve it and therefore I need to relook at using another package to get a solution. ... Now Im running PHP 4.4xxx and I need to get this up and running ASAP. ...
    (php.general)