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

Re: [soaplite] returning heterogenous arrays from SOAP::lite to Axis

Expand Messages
  • Monica Bonett
    ... Hi Paul, Thanks alot for your reply. The switch to XML Schema 2001 was what I needed to encode the arrayType as anyType. This worked fine for the version
    Message 1 of 3 , May 16, 2002
    • 0 Attachment
      On Wed, 15 May 2002, Paul Kulchenko wrote:

      >Hi, Monica!
      >
      >Truly I don't see anything wrong with 'ur-type'. It's valid datatype
      >in XML Schema 1999. SOAP 1.2 is still work-in-progress and is not yet
      >supported well by SOAP toolkits.
      >
      >You can switch to XML Schema 2001 (in this case anyType type will be
      >used), but I'm not sure it'll solve your problem. Why do you think
      >Axis can handle arrays of heterogeneous elements? What type of data
      >will represent there array that you have in your Perl code?
      >

      Hi Paul,

      Thanks alot for your reply. The switch to XML Schema 2001 was what I
      needed to encode the arrayType as anyType. This worked fine for the
      version of Axis I am using. I don't know if using anyType is better for
      interoperability longer term -- maybe looking for ways to get
      Axis to accept the ur-type or experiment with other Java implementations
      would have been a better approach?

      On the Axis side, I used this code:

      // Store the returned objects into an object array
      Object [] ret = (Object []) call.invoke(new Object[] {});

      // The first object is a string
      String first = (String) ret[0];

      // The second object is a string array
      String [] second = (String[]) ret[1];

      System .out.println(first);
      System.out.println(second[0] + second[1]);

      prints what you would expect.

      Thanks and regards,
      Monica

      >To switch to XMl Schema 2001 you may use ->xmlschema(2001) method for
      >serializer in your server code, like this:
      >
      >my $daemon = SOAP::Transport::HTTP::Daemon ....
      >$daemon->serializer->xmlschema(2001);
      >$daemon->handle;
      >
      >You can also override anyTypeValue() method in any serializer class
      >(for example, in SOAP::XMLSchema1999::Serializer) to provide any name
      >you want, but in this case generated payload might be invalid.
      >
      >Hope it helps.
      >
      >Best wishes, Paul.
      >
      >--- Monica Bonett <lismab@...> wrote:
      >>
      >> I am having a problem with communication between a Perl server and
      >> a Java client. The server is using SOAP-Lite 0.55; the client
      >> is using Axis (Beta 2 version).
      >>
      >> The problem is when sending an array of heterogeneous elements, for
      >> example an array containing a string and another array. An example
      >> of the problem is where the server is building and returning the
      >> following:
      >>
      >> @mixedTypeArray = (
      >> "hello", # string
      >> ["hello", "again"] # array (ref)
      >> );
      >>
      >> return \@mixedTypeArray;
      >>
      >> On the client side, the "invoke" method is failing with the
      >> following error:
      >>
      >> org.xml.sax.SAXException: No deserializer defined for array type
      >> http://www.w3.org/1999/XMLSchema:ur-type
      >>
      >> This is the XML being sent by the server -- the top-level
      >> array is being given an ur-type encoding.
      >>
      >> HTTP/1.1 200 OK
      >> Date: Fri, 10 May 2002 14:37:55 GMT
      >> Server: Apache/1.3.12 (Unix) PHP/3.0.9
      >> SOAPServer: SOAP::Lite/Perl/0.55
      >> Content-Length: 743
      >> Connection: close
      >> Content-Type: text/xml; charset=utf-8
      >>
      >> <?xml version="1.0" encoding="UTF-8"?>
      >> <SOAP-ENV:Envelope
      >> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      >> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      >> xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      >> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      >> <SOAP-ENV:Body>
      >> <namesp1:hiResponse xmlns:namesp1="Demo">
      >> <SOAP-ENC:Array xsi:type="SOAP-ENC:Array"
      >> SOAP-ENC:arrayType="xsd:ur-type[2]">
      >> <item xsi:type="xsd:string">hello
      >> </item>
      >> <item xsi:type="SOAP-ENC:Array"
      >> SOAP-ENC:arrayType="xsd:string[2]">
      >> <item xsi:type="xsd:string">hello
      >> </item>
      >> <item xsi:type="xsd:string">again
      >> </item>
      >> </item>
      >> </SOAP-ENC:Array>
      >> , </namesp1:hiResponse>
      >> </SOAP-ENV:Body>
      >> </SOAP-ENV:Envelope>
      >>
      >> My understanding is the "ur-type" has been replaced by "anyType" in
      >> the
      >> latest version of SOAP (1.2). My guess is that the presence of the
      >> ur-type is causing the de-serializer to fail. Possible solutions
      >> seem
      >> to be:
      >>
      >> 1. Modifying/replacing the serializer used on the server;
      >> 2. Modifying/replacing the deserializer on the client; or
      >> 3. Using a different approach to sending heterogeneous data.
      >>
      >> There may be a simple option (e.g. a configuration setting) that
      >> tells
      >> the server what encoding scheme to use, but I wasn't able to locate
      >> it.
      >> I would appreciate any suggestions of how to get around this
      >> problem,
      >> and in particular if I need to modify the (de)serializer, a working
      >> example would help.
      >>
      >> Apologies if this topic has already been dealt with on the mailing
      >> list,
      >> advice/pointers to the relevant info dealing with the approach I
      >> should
      >> take would be greatly appreciated.
      >>
      >> Thanks very much for your help,
      >> Monica
      >>
      >>
      >>
      >>
      >>
      >>
      >>
      >> ------------------------ 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!?
      >LAUNCH - Your Yahoo! Music Experience
      >http://launch.yahoo.com
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.