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

SOAP::Lite namespace problem

Expand Messages
  • Ovid
    When I explicitly set the URI on a SOAP::Lite object to to some value, the resulting request XML differs from what I am expecting.
    Message 1 of 4 , Oct 15, 2004
    • 0 Attachment
      When I explicitly set the URI on a SOAP::Lite object to to some value,
      the resulting request XML differs from what I am expecting.

      $soap->uri(''http://www.some.com/websvcs/')

      When I do that, the XML has a line that looks like this:

      <namesp1:GetCircuits xmlns:namesp1="http://www.some.com/websvcs/"/>

      Where the heck did 'namesp1' come from?

      What I really need is this:

      <GetCircuits xmlns="http://www.some.com/websvcs/"/>

      The only way I've found to get around this is to specifically override
      the SOAP::Serializer::gen_ns function:

      *SOAP::Serializer::gen_ns = sub {''};

      That solves the problem by not generating the 'namesp1', but I'd rather
      have some external way of setting this behavior. I can't just subclass
      SOAP::Serializer because this is called as a function and not a method.

      Cheers,
      Ovid

      =====
      Silence is Evil http://users.easystreet.com/ovid/philosophy/decency.html
      Ovid http://www.perlmonks.org/index.pl?node_id=17000
      Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/
    • Duncan Cameron
      ... The two pieces of XML are equivalent, so it may be an idea to ask the developers of the web services that you are connecting to why they do not handle the
      Message 2 of 4 , Oct 16, 2004
      • 0 Attachment
        On 2004-10-15 at 23:55:04 Ovid wrote:

        >When I explicitly set the URI on a SOAP::Lite object to to some value,
        >the resulting request XML differs from what I am expecting.
        >
        > $soap->uri(''http://www.some.com/websvcs/')
        >
        >When I do that, the XML has a line that looks like this:
        >
        > <namesp1:GetCircuits xmlns:namesp1="http://www.some.com/websvcs/"/>
        >
        >Where the heck did 'namesp1' come from?
        >
        >What I really need is this:
        >
        > <GetCircuits xmlns="http://www.some.com/websvcs/"/>
        >
        The two pieces of XML are equivalent, so it may be an idea to ask the
        developers of the web services that you are connecting to why they do
        not handle the first one.

        However, this approach may help you

        my $method = SOAP::Data
        ->name('GetCircuits')
        ->attr({xmlns => $soap->uri});

        my $r = $soap->call($method);

        >The only way I've found to get around this is to specifically override
        >the SOAP::Serializer::gen_ns function:
        >
        > *SOAP::Serializer::gen_ns = sub {''};
        >
        I think what you are asking for is SOAP::Lite to treat the namespace of
        the root element as the default namespace. Sounds nice, but I don't
        think that it can be done.

        Regards
        Duncan
      • Byrne Reese
        This has been a common refrain on mine recently, but no matter... This functionality can be found in the next release of SOAP:Lite - version 0.65. Three
        Message 3 of 4 , Oct 16, 2004
        • 0 Attachment
          This has been a common refrain on mine recently, but no matter...

          This functionality can be found in the next release of SOAP:Lite -
          version 0.65.

          Three methods of interest have been added that have to do with
          namespaces and the like:

          1. use_prefix - turns on and off the use of default namespaces
          2. register_ns - allow users to more easily register a global namespace
          that will be placed in soap:Envelope
          3. find_ns - Pass in a prefix and retrieve the URI for that namespace

          Duncan Cameron wrote:

          >On 2004-10-15 at 23:55:04 Ovid wrote:
          >
          >
          >
          >>When I explicitly set the URI on a SOAP::Lite object to to some value,
          >>the resulting request XML differs from what I am expecting.
          >>
          >> $soap->uri(''http://www.some.com/websvcs/')
          >>
          >>When I do that, the XML has a line that looks like this:
          >>
          >> <namesp1:GetCircuits xmlns:namesp1="http://www.some.com/websvcs/"/>
          >>
          >>Where the heck did 'namesp1' come from?
          >>
          >>What I really need is this:
          >>
          >> <GetCircuits xmlns="http://www.some.com/websvcs/"/>
          >>
          >>
          >>
          >The two pieces of XML are equivalent, so it may be an idea to ask the
          >developers of the web services that you are connecting to why they do
          >not handle the first one.
          >
          >However, this approach may help you
          >
          > my $method = SOAP::Data
          > ->name('GetCircuits')
          > ->attr({xmlns => $soap->uri});
          >
          > my $r = $soap->call($method);
          >
          >
          >
          >>The only way I've found to get around this is to specifically override
          >>the SOAP::Serializer::gen_ns function:
          >>
          >> *SOAP::Serializer::gen_ns = sub {''};
          >>
          >>
          >>
          >I think what you are asking for is SOAP::Lite to treat the namespace of
          >the root element as the default namespace. Sounds nice, but I don't
          >think that it can be done.
          >
          >Regards
          >Duncan
          >
          >
          >
        • Ovid
          ... I will definitely look forward to that! ... they ... Thanks. I ll do that, but I don t hold out much hope. They tend to not be very responsive and their
          Message 4 of 4 , Oct 16, 2004
          • 0 Attachment
            --- Byrne Reese <byrne@...> wrote:
            > This has been a common refrain on mine recently, but no matter...
            >
            > This functionality can be found in the next release of SOAP:Lite -
            > version 0.65.

            I will definitely look forward to that!

            > Duncan Cameron wrote:
            > >The two pieces of XML are equivalent, so it may be an idea to ask
            > >the developers of the web services that you are connecting to why
            they
            > >do not handle the first one.

            Thanks. I'll do that, but I don't hold out much hope. They tend to
            not be very responsive and their service is via ASP.net. I think they
            guy on the other end knows as little about SOAP as I do :)

            Cheers,
            Ovid

            =====
            Silence is Evil http://users.easystreet.com/ovid/philosophy/decency.html
            Ovid http://www.perlmonks.org/index.pl?node_id=17000
            Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/
          Your message has been successfully submitted and would be delivered to recipients shortly.