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

821Re: [soaplite] WSDL and arrays

Expand Messages
  • Paul Kulchenko
    Sep 13, 2001
    • 0 Attachment
      Hi, Jean-Jack!

      > To make to service more fucntional, I need to pass an array of
      > strings to
      > the SOAP server. I have to following call in the client:
      >
      > my $soap = SOAP::Lite
      > -> service('http://www.ebi.ac.uk/xembl/XEMBL.wsdl');
      >
      > $result = $soap->FullSequence($FORMAT, @IDLIST);
      first of all, in most cases you need to pass an array reference
      instead of list:

      [@IDLIST] or \@IDLIST instead of @IDLIST

      It won't help in this particular case though, because support for
      complex types is limited in SOAP::Lite.

      You can however supply your own representation using SOAP::Data
      interface and it'll override settings in WSDL.

      To make it work, use simple type definition, and then do something
      like this (untested):

      my $soap = SOAP::Lite
      -> service('http://www.ebi.ac.uk/xembl/XEMBL.wsdl');

      my $idlist = SOAP::Data->name(idslist => [
      map {SOAP::Data->name(item => $_)->type('string')} @IDLIST
      ]);

      $result = $soap->FullSequence($FORMAT, $idlist);

      Future version will definitely have better support for complex types.
      Let me know if you still have any problems.

      Best wishes, Paul.

      --- "Jean-Jack M. Riethoven" <pow@...> wrote:
      >
      > Greetings,
      >
      > First of all my thanks for helping me with the WSDL file a couple
      > of days
      > ago. I was able to correct the mistakes and get the service
      > operational.
      >
      > To make to service more fucntional, I need to pass an array of
      > strings to
      > the SOAP server. I have to following call in the client:
      >
      > my $soap = SOAP::Lite
      > -> service('http://www.ebi.ac.uk/xembl/XEMBL.wsdl');
      >
      > $result = $soap->FullSequence($FORMAT, @IDLIST);
      >
      > where @IDLIST basically is a very simple array of short strings.
      >
      > I have tried two methods in the WSDL file to define the array - one
      > with
      > complexType and one with a simple element. Both do not work.
      >
      > <types>
      > <schema targetNamespace="http://www.ebi.ac.uk/XEMBL"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      > <complexType name="ArrayOfString">
      > <sequence>
      > <element name="string" type="xsd:string" minOccurs="1"
      > maxOccurs="unbounded" nillable="false" />
      > </sequence>
      > </complexType>
      > </schema>
      > </types>
      > <message name="FullSequenceRequest"
      > xmlns:tns="http://www.ebi.ac.uk/XEMBL">
      > <part name="format" type="xsd:string" />
      > <part name="ids" type="tns:ArrayOfString" />
      > </message>
      >
      > results in this error when running the client (with trace=>all):
      >
      > SOAP::Lite::new: ()
      > SOAP::Data::DESTROY: ()
      > SOAP::Data::DESTROY: ()
      > SOAP::Data::DESTROY: ()
      > SOAP::Lite::DESTROY: ()
      > SOAP::Deserializer::DESTROY: ()
      > SOAP::Parser::DESTROY: ()
      > SOAP::Serializer::DESTROY: ()
      > SOAP::Transport::DESTROY: ()
      > AFTER INIT
      >
      > SOAP::Transport::HTTP::Client::new: ()
      > Can't call method "value" on an undefined value at (eval 84) line
      > 45.
      > SOAP::Lite::DESTROY: ()
      >
      >
      > The same error happens when I use this:
      >
      > <types>
      > <schema targetNamespace="http://www.ebi.ac.uk/XEMBL"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      > <element name="XEMBL:ArrayOfString" type="xsd:string"
      > minOccurs="1"
      > maxOccurs="unbounded" nillable="false" />
      >
      > </schema>
      > </types>
      > <message name="FullSequenceRequest"
      > xmlns:tns="http://www.ebi.ac.uk/XEMBL">
      > <part name="format" type="xsd:string" />
      > <part name="ids" type="tns:ArrayOfString" />
      > </message>
      >
      >
      > For both messages, the client script dies just after the
      > $soap->FullSequence call.
      >
      > I am not sure if it is any indication, but if I pass just a normal
      > string
      > to the required ArrayOfString parameter, this error crops up:
      >
      > <?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><
      > SOAP-ENV:Fault><faultcode
      > xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultstring
      > xsi:type="xsd:string">Application failed during request
      > deserialization:
      > Unresolved prefix 'tns' for attribute value 'tns:ArrayOfString'
      > </faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
      > SOAP::Deserializer::deserialize: ()
      >
      > and it arrives normally at the end of the script. I checked some
      > other WSDL
      > files, and I do not see any problem with the tns: prefix since it
      > is
      > defined at the top of the WSDL document.
      >
      > Granted, I am new to this but I have been struggling with various
      > docs over
      > the past days. If anyone can shed a light, it would be much
      > appreciated.
      >
      > With kind regards,
      >
      > --
      > drs. Jean-Jack M. Riethoven
      >
      > EMBL Outstation - Hinxton pow@... ICQ#: 3433929
      > European Bioinformatics Institute Phone: (+44) 1223 494635
      > Wellcome Trust Genome Campus Fax : (+44) 1223 494468
      > Hinxton, Cambridge CB10 1SD URL :
      > http://industry.ebi.ac.uk/
      > UNITED KINGDOM
      >
      > Need to find bioinformatics or molecular biology web sites or
      > resources?
      > Use BioWurld at http://www.ebi.ac.uk/biowurld
      >
      >
      >
      > ------------------------ 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/
      >
      >


      __________________________________________________
      Terrorist Attacks on U.S. - How can you help?
      Donate cash, emergency relief information
      http://dailynews.yahoo.com/fc/US/Emergency_Information/
    • Show all 7 messages in this topic