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

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

Expand Messages
  • adam roth
    Jun 30, 2002
    • 0 Attachment

       I've had trouble with the submission form, so I've sent this again:
      ---------------------------------------------------------------------------------------------

      Adding ->uri('urn:SprintPCS') is doing something -- as you can see below,
      but the 'minutes' element is still bound to a new namesp3 -- which is set to:
      http://namespaces.soaplite.com/perl -- and that puts us back to the beginning.

      Any ideas on how to set the minutes element to the urn:SprintPCS namespace?
      (the code you gave me looks like it should work, but the XML response disagrees)

      Thanks,
      ADam

      ##########################
      # Updated Perl Module Code  #
      ##########################


      sub getMinutes(){

      shift;

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

      ##########################
      # Updated XML Response      #
      ##########################

      <?xml version="1.0" encoding="UTF-8" ?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:namesp3="http://namespaces.soaplite.com/perl"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema">

       <SOAP-ENV:Body>
        <namesp1:getMinutesResponse xmlns:namesp1="urn:SprintPCS">
         <namesp2:s-gensym3 xmlns:namesp2="urn:SprintPCS" xsi:type="namesp3:minutes">
          <minutesLeft xsi:type="xsd:int">500</minutesLeft>
          <minutesUsed xsi:type="xsd:int">1000</minutesUsed>
         </namesp2:s-gensym3>
        </namesp1:getMinutesResponse>
       </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
        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>


      To unsubscribe from this group, send an email to:
      soaplite-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



      Do You Yahoo!?
      Sign-up for Video Highlights of 2002 FIFA World Cup

    • Show all 8 messages in this topic