Loading ...
Sorry, an error occurred while loading the content.

Unexpected Content-Type '' returned

Expand Messages
  • Martin Shears
    Hi all I am using Apache and CGI as the SOAP transport and just yesterday I started getting the odd SOAP connection fail and print to STDERR: Unexpected
    Message 1 of 2 , Nov 17, 2003
    • 0 Attachment
      Hi all

      I am using Apache and CGI as the SOAP transport and just yesterday I started
      getting the odd SOAP connection fail and print to STDERR:
      "Unexpected Content-Type '' returned"

      That is a "die" (stop of program execution) and not a catchable error. I
      would have thought the better way to handle that would be in the soap fault
      handling.

      Obviously there are some server (or network) problems there but I need to be
      able to write a client that can handle those problems. Here is some test code
      I used and its output. It dies randomly, sometimes after 1 attempt,
      sometimes 100 attempts.

      ---- code snip
      my $soap = SOAP::Lite
      -> uri($soapURI)
      -> proxy($soapProxy);

      for (my $attempt=0; $attempt< 100; $attempt++ ) {
      print "$attempt\n";
      my $som = $soap->test();
      }
      ---- code snip

      --- output
      > perl test2.pl
      0
      1
      2
      3
      4
      5
      6
      7
      8
      9
      Unexpected Content-Type '' returned
      --- output


      Now the only way I have found around this (i dont want my code just dying) is
      to set:

      $SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE = 1;

      and then test that $som is defined. $som will be undefined if the content
      type is wrong. This is a hacky way to solve the problem though ... is there
      something I am overlooking here?

      Cheers
      --
      Marty <martin@...>
    • Bob
      Hello I am trying to get the simple hibye client (cut n pasted from the cookbook) to work. I am using https. The client code is : #!/usr/bin/perl -w use
      Message 2 of 2 , Jul 22, 2004
      • 0 Attachment
        Hello

        I am trying to get the simple hibye client (cut'n'pasted from
        the cookbook) to work. I am using https.

        The client code is :

        #!/usr/bin/perl -w
        use strict;
        use SOAP::Lite;
        #$SOAP::Constants::DO_NOT_CHECK_CONTENT_TYPE = 1;
        use SOAP::Lite on_debug => sub{print@_};

        print SOAP::Lite
        -> proxy('https://localhost:9443/perl/hibye.pl')
        -> uri('https://localhost:9443/Demo')
        -> hi()
        -> result;

        As output I get: (save for the munged email address)

        POST https://localhost:9443/perl/hibye.pl
        Accept: text/xml
        Accept: multipart/*
        Content-Length: 449
        Content-Type: text/xml; charset=utf-8
        SOAPAction: "https://localhost:9443/Demo#hi"

        <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
        xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:hi
        xmlns:namesp1="https://localhost:9443/Demo"/></SOAP-ENV:Body></SOAP-ENV:Envelope>
        HTTP/0.9 200 (OK) Assumed OK
        Client-Date: Thu, 22 Jul 2004 23:27:07 GMT
        Client-Peer: 127.0.0.1:9443
        Client-Response-Num: 1
        Client-SSL-Cert-Issuer:
        /C=GB/ST=Kent/L=Ashford/O=fourtheye.org/CN=www.fourtheye.org/emailAddress=bob^fourtheye.org
        Client-SSL-Cert-Subject:
        /C=GB/ST=Kent/L=Ashford/O=fourtheye.org/CN=www.fourtheye.org/emailAddress=bob^fourtheye.org
        Client-SSL-Cipher: AES256-SHA
        Client-SSL-Warning: Peer certificate not verified

        Status: 200 OK
        Content-Length: 542
        Content-Type: text/xml; charset=utf-8
        SOAPServer: SOAP::Lite/Perl/0.55

        <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
        xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:hiResponse
        xmlns:namesp1="https://localhost:9443/Demo"><s-gensym3
        xsi:type="xsd:string">hello, italy, world
        </s-gensym3></namesp1:hiResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
        Unexpected Content-Type '' returned

        It does work if I set DO_NOT_USE_CHARSET=1, what I don't understand is
        why it deosn't work without this line uncommented.

        It looks as though the Content-Type is text/xml - which should be OK?

        Bob
      Your message has been successfully submitted and would be delivered to recipients shortly.