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

1672Re: [soaplite] SOAP::Lite server returning complex types in wrong namespace?

Expand Messages
  • Paul Kulchenko
    Jul 2, 2002
    • 0 Attachment
      Hi, Randy!

      > namespace, so http://namespaces.soaplite.com/perl gets used when
      > there is no additional info.
      That's correct.

      > SOAP::Data->type('minutes')->uri('urn:SprintPCS')
      > ->value({ minutesUsed =>SOAP::Data->type(int =>
      > 1000),
      > minutesLeft =>SOAP::Data->type(int =>
      > 500)});
      it'll put the ELEMENT in 'urn:SprintPCS' namespace, but doesn't
      change the TYPE/SCHEMA namespace. To do that, you need to use
      maptype() method:

      # individual
      $server->serializer->maptype->{minutes} = 'urn:SprintPCS';

      or

      # all at once; will delete all existent mappings
      $server->serializer->maptype({minutes => 'urn:SprintPCS'});

      then in your code you just say:

      SOAP::Data->type('minutes')
      ->value({ minutesUsed =>SOAP::Data->type(int => 1000),
      minutesLeft =>SOAP::Data->type(int => 500)});

      Best wishes, Paul.

      --- rjray@... wrote:
      > You are on the right track in noting that the <minutes> element was
      > given the
      > wrong namespace for your purposes. When you don't give your
      > out-going data an
      > explicit namespace, SOAP::Lite tries to deduce one. For simple
      > types it's much
      > easier, but the complex types need *something* that goes beyond the
      > xsd
      > namespace, so http://namespaces.soaplite.com/perl gets used when
      > there is no
      > additional info.
      >
      > Good news is, this is easy to fix:
      >
      > sub getMinutes(){
      >
      > SOAP::Data->type('minutes')->uri('urn:SprintPCS')
      > ->value({ minutesUsed =>SOAP::Data->type(int =>
      > 1000),
      > minutesLeft =>SOAP::Data->type(int =>
      > 500)});
      > }
      >
      > (Apologies for the slight formatting changes, XEmacs gets a little
      > eager
      > sometimes.)
      >
      > I did take out the "return", since that isn't needed, and the extra
      > 8
      > characters make it easier to keep the code from wrapping :-).
      >
      > See if that helps.
      >
      > Randy
      > --
      >
      """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
      > Randy J. Ray
      > rjray@...
      > Campbell, CA
      > rjray@...
      > <A HREF="http://www.svsm.org">Silicon Valley Scale Modelers</A>
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Sign up for SBC Yahoo! Dial - First Month Free
      http://sbc.yahoo.com
    • Show all 8 messages in this topic