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

1667SOAP::Lite authors please look at this thread

Expand Messages
  • aroth816
    Jul 1, 2002
    • 0 Attachment
      While waiting for a reply, I've tried a few other things. Ive noticed
      that the same code (wsdl,cgi,perl module) generates a different XML
      response using a windows vs a linux server. The problem we are
      dealing with is that the linux server is returning an incorrect
      namespace on the complex type -- and the C#/java/whatever client
      cannot understand it.

      The XML response in windows is returning this:


      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-
      ENC="http://schemas.xmlsoap.org/soap/encoding/" 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"
      xmlns:xmlsoap="http://xml.apache.org/xml-soap">
      <SOAP-ENV:Body>
      <namesp1:getMinutesResponse xmlns:namesp1="urn:SprintPCS">
      <namesp2:s-gensym4xmlns:namesp2="urn:SprintPCS"
      xsi:type="xmlsoap:Map">
      <item>
      <key xsi:type="xsd:string"/>
      <value xsi:type="xsd:int">500</value>
      </item>
      <item>
      <key xsi:type="xsd:string">minutesUsed</key>
      <value xsi:type="xsd:int">1000</value>
      </item>
      </namesp2:s-gensym4>
      </namesp1:getMinutesResponse><
      /SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      Notice the xsi:type="xmlsoap:Map" -- this is the difference between
      the response when returned on windows and linux. The linux server
      would return the same except for this line:

      <namesp2:s-gen sym3 xmlns:namesp2="urn:SprintPCS"
      xsi:type="namesp3:minutes">

      Summarized:
      WINDOWS SERVER: xsd:type="xmlsoap:Map"
      LINUX SERVER : xsd:type="namesp3:minutes"

      Now, the complex type is 'minutes'... so perhaps neither of these is
      right. (Why are there differences anyway??) But I have had the
      windows server work before with complex types. However, I need this
      to work on Linux. So if the SOAP authors or anybody very knowledgable
      with this, take a look at this thread and see if you could let me
      know how I can get complex types to be sent over the wire correctly>

      Thanks.
      Adam



      --- In soaplite@y..., adam roth <aroth816@y...> wrote:
      >
      > 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@b... 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@b...
      > Campbell, CA
      rjray@s...
      > <A HREF="http://www.svsm.org">Silicon Valley Scale Modelers</A>
      >
      > Yahoo! Groups SponsorADVERTISEMENT
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@y...
      >
      >
      >
      > 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