http://www.perlmonks.org?node_id=746735


in reply to Webservices and browsers

The hibye.pl scrpt is not a CGI -- it doesn't emit HTTP headers (Content-type).

A web browser is not a SOAP client -- it doesn't emit the necessary HTTP headers (SOAPAction) or send a SOAP message.

If you want to write a CGI that's also a SOAP client, that's fine -- but you can't just throw any old executable on a webserver and expect it to work.

Try the following.

use CGI; print CGI-header; use SOAP::Lite; print SOAP::Lite -> uri('http://www.soaplite.com/Demo') -> proxy('') # set this to your SOAP service URL -> hi() -> result;

Replies are listed 'Best First'.
Re^2: Webservices and browsers
by joec_ (Scribe) on Mar 02, 2009 at 09:36 UTC
    Hi,

    Can you tell me if it is possible to consume a perl webservice from within .NET (C#)? Obviously, these simple perl web services dont use WSDLs or XML because, when for example i try to access my web service from C#, i get an error message stating that XML was expected and it "received text/plain" - this was using the example service on the soap lite site, which just returned a simple string and not a SOAP envelope?!.

    I am new to web services and think i need some clarification

    Any help appreciated

    Thanks --Joe

    -----

    Eschew obfuscation, espouse eludication!

      The text/plain thing sounds like a problem -- make sure that the CGI is actually executing, and not just the file being returned.

      I've run into a few problems when people tried consuming a SOAP::Lite service using a strictly typed language, and I had to do some work in making sure it serialized correctly -- I had a few items that were strings of numbers, and SOAP::Lite kept marking it as numbers -- I was using RPC/encoded SOAP, and not using SOAP::Data to declare what the values were, as I was getting them from another SOAP call. In the end, I replaced SOAP::Serializer to make sure it sent what I wanted.

      I believe that issues of compatibility have come up in the past on the soaplite mailing list -- you might check their archives, but it's also possible that it's no longer an issue as they've moved away from the overhead of RPC/encoded messages.