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

Upgraded client, getting SOAP errors

Expand Messages
  • Tony Gravagno
    We have Perl v5.8.0 client code that has always targeted SOAP 1.2 with SOAP::Lite 0.55. It runs against a remote server with the same releases. We recently
    Message 1 of 5 , Oct 13, 2008
    • 0 Attachment
      We have Perl v5.8.0 client code that has always targeted SOAP 1.2
      with SOAP::Lite 0.55. It runs against a remote server with the same
      releases. We recently moved all of the client code to a new Linux
      system with Perl 5.8.5 and SOAP::Lite 0.710.08. Now, when
      communicating with the remote server we get error: Content-Type must
      be 'text/xml' instead of 'application/soap'

      I understand SOAP 1.2 uses this new content type over the old v1.1
      text/xml, but again, this code has been working for years. The remote
      server has not changed! We still have the old client system up and
      can do side by side testing.

      I tried changing the SOAP version to 1.1 just to send the content-
      type that it's expecting, but then other issues come up, like a
      hardcoded prefix SOAP-ENC:Array needs to be soapenc:Array.

      Can I force the content-type of a v1.2 transaction to text/xml?
      What else can be done to remedy this situation? The people who own
      the remote server will certainly not upgrade because of this.

      Thanks!
    • rahed
      ... You can change the content-type with $soap- transport- http_request- header( Content-type = text/xml ); -- Radek
      Message 2 of 5 , Oct 14, 2008
      • 0 Attachment
        > I tried changing the SOAP version to 1.1 just to send the content-
        > type that it's expecting, but then other issues come up, like a
        > hardcoded prefix SOAP-ENC:Array needs to be soapenc:Array.
        >
        > Can I force the content-type of a v1.2 transaction to text/xml?
        > What else can be done to remedy this situation? The people who own
        > the remote server will certainly not upgrade because of this.

        You can change the content-type with

        $soap->transport->http_request->header('Content-type' => 'text/xml');

        --
        Radek
      • Tony Gravagno
        ... Radek responded ... Thank you for the suggestion. This does change the header but the server is now complaining that the client is using the wrong SOAP
        Message 3 of 5 , Oct 18, 2008
        • 0 Attachment
          I wrote:
          > > I tried changing the SOAP version to 1.1 just to send the content-
          > > type that it's expecting, but then other issues come up, like a
          > > hardcoded prefix SOAP-ENC:Array needs to be soapenc:Array.
          > >
          > > Can I force the content-type of a v1.2 transaction to text/xml?
          > > What else can be done to remedy this situation? The people who own
          > > the remote server will certainly not upgrade because of this.

          Radek responded
          > You can change the content-type with
          >
          > $soap->transport->http_request->header('Content-type' => 'text/xml');

          Thank you for the suggestion. This does change the header but the
          server is now complaining that the client is using the wrong SOAP
          version. There is a major difference between the headers sent before
          and after the upgrade.

          Before upgrade:

          <SOAP-ENV:Envelope
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:SOAP-ENC="http://www.w3.org/2001/06/soap-encoding"
          xmlns:SOAP-ENV="http://www.w3.org/2001/06/soap-envelope"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          SOAP-ENV:encodingStyle="http://www.w3.org/2001/06/soap-encoding">

          After upgrade:

          <soap:Envelope
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
          xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

          It looks like the server isn't prepared for the v2003 schemas that come
          with SOAP::Lite v0.710 compared to v0.55 - and we cannot change the
          server. As mentioned in my original post, SOAP-ENC:Array is hardcoded
          into the transaction code and doesn't agree with the newer schema
          anyway.

          My current recommendation to the client is to downgrade SOAP::Lite and
          that probably involves a downgrade of Perl as well, and that may affect
          yet other dependencies. Better suggestions are welcome.

          I'm hoping for a quick solution here, but my client is willing to pay
          to get this resolved quickly if a solution needs to be more involved.
          So far I have emailed Paul Kulchenko to request compensated services
          but I have not received a response. I welcome emails from qualified
          developers with references. You must have a complete understanding of
          the situation (I believe my postings here have provided that) and a
          ready proposal for a solution, we cannot fund research or education.

          Thanks for your time.
        • Martin Kutter
          Hi Tony, the namespaces are defined in SOAP::Constants. Unfortunately they cannot be overridden at run time, because perl s peep-hole optimizer inlines
          Message 4 of 5 , Oct 19, 2008
          • 0 Attachment
            Hi Tony,

            the namespaces are defined in SOAP::Constants. Unfortunately they cannot
            be overridden at run time, because perl's peep-hole optimizer inlines
            constants.

            However, the constants are not used directly by SOAP::Lite, but through
            the following SOAP::Constants variables:

            @SUPPORTED_ENCODING_STYLES
            %XML_SCHEMAS
            %XML_SCHEMA_OF
            %SOAP_VERSIONS

            To change all occurances, do the following:

            BEGIN {
            use SOAP::Lite

            my $url_enc = "http://www.w3.org/2001/06/soap-encoding";
            my $url_env = "http://www.w3.org/2001/06/soap-envelope";

            push @SOAP::Constants::SUPPORTED_ENCODING_STYLES, $url_enc;

            $SOAP::Constants::SOAP_VERSIONS{'1.2'}->{NS_ENC} = $url_enc;
            $SOAP::Constants::SOAP_VERSIONS{'1.2'}->{NS_ENV} = $url_env;

            $SOAP::Contants::XML_SCHEMAS{$url_enc} = 'SOAP::XMLSchemaSOAP1_2';
            $SOAP::Contants::XML_SCHEMAS_OF{$url_enc} = 'XMLSchemaSOAP1_2';
            }

            This should change the (new) namespaces back to the old ones throughout
            SOAP::Lite (untested...).

            Note that SOAP::Constants variables are global - all your SOAP::Lite
            instances in the current process will be affected (may be an issue under
            mod_perl).

            Martin


            Am Samstag, den 18.10.2008, 22:57 +0000 schrieb Tony Gravagno:
            > ...
            > Thank you for the suggestion. This does change the header but the
            > server is now complaining that the client is using the wrong SOAP
            > version. There is a major difference between the headers sent before
            > and after the upgrade.
            >
            > Before upgrade:
            >
            > <SOAP-ENV:Envelope
            > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > xmlns:SOAP-ENC="http://www.w3.org/2001/06/soap-encoding"
            > xmlns:SOAP-ENV="http://www.w3.org/2001/06/soap-envelope"
            > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            > SOAP-ENV:encodingStyle="http://www.w3.org/2001/06/soap-encoding">
            >
            > After upgrade:
            >
            > <soap:Envelope
            > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding"
            > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            > soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
            > xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
            >
            > It looks like the server isn't prepared for the v2003 schemas that
            > come
            > with SOAP::Lite v0.710 compared to v0.55 - and we cannot change the
            > server. As mentioned in my original post, SOAP-ENC:Array is hardcoded
            > into the transaction code and doesn't agree with the newer schema
            > anyway.
            >
            > My current recommendation to the client is to downgrade SOAP::Lite
            > and
            > that probably involves a downgrade of Perl as well, and that may
            > affect
            > yet other dependencies. Better suggestions are welcome.
            >
            > I'm hoping for a quick solution here, but my client is willing to pay
            > to get this resolved quickly if a solution needs to be more involved.
            > So far I have emailed Paul Kulchenko to request compensated services
            > but I have not received a response. I welcome emails from qualified
            > developers with references. You must have a complete understanding of
            > the situation (I believe my postings here have provided that) and a
            > ready proposal for a solution, we cannot fund research or education.
            >
            > Thanks for your time.
            >
            >
            >
            >
            >
          • Tony Gravagno
            For anyone watching this thread, the issue was resolved for the most part with the code that Martin provided. Just add a semi-colon to the end of the using
            Message 5 of 5 , Nov 17, 2008
            • 0 Attachment
              For anyone watching this thread, the issue was resolved for the most
              part with the code that Martin provided. Just add a semi-colon to the
              end of the using statement. :) Martin, thank you very much!

              We also asked Paul Kulchenko for for-fee consultation and appreciate
              his assistance as well.
            Your message has been successfully submitted and would be delivered to recipients shortly.