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

Re: Sending complex type from SOAP::Lite client

Expand Messages
  • nate_bowler
    I saw this thread earlier and tried its suggestions, but I didn t get it to work. This is my code incorporating the suggestions from that thread. 2 things are
    Message 1 of 3 , Jul 19, 2002
    • 0 Attachment
      I saw this thread earlier and tried its suggestions, but I didn't get
      it to work. This is my code incorporating the suggestions from that

      2 things are wrong here:

      1. The xsi-type refers to tns:User, but tns is not defined in the

      2. The User sequence elements are all out of order if I use
      the "bless" convention.

      It is logical that both of these errors are related to the same issue
      of not recognizing the 'User' type, but I'm not sure how to remedy it.

      Also, please note that I am using the WSDL service to call this


      //Perl Code:
      #!perl -w

      use SOAP::Lite;
      my $api_server = SOAP::Lite
      -> soapversion(1.2)
      -> uri('http://www.attask.com/api')
      -> service('');

      $api_server->serializer->maptype->{User} = 'APIService';

      my $sessionID = $api_server->login("admin","testing");
      print "sessionID:$sessionID\n";

      # build the call parameters
      my $uf2 = bless { 'hasError' => SOAP::Data->type(boolean => 0),
      'state' => 'UT',
      'zip' => 'null',
      'primaryContact' => 'null',
      'city' => 'null',
      'username' => 'null',
      'emailAddr' => 'null',
      'groupID' => -1,
      'address' => 'null',
      'firstName' => 'null',
      'password' => 'null',
      'lastName' => 'null',
      'companyName' => 'null',
      'userID' => -1,
      'phoneNumber' => 'null'} => 'User';

      my $userlist = $api_server->getUsersByUserFilter($sessionID, $uf2);
      print "\nusername:" . $$userlist[0]->{'username'} . "\n";


      // XML output
      <?xml version="1.0" encoding="UTF-8" ?>
      <SOAP-ENV:Envelope xmlns:SOAP-
      ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
      <String_1 xsi:type="xsd:string">92668751101027106348409</String_1>
      <User_2 xsi:type="tns:User">
      <lastName xsi:type="xsd:string">null</lastName>
      <state xsi:type="xsd:string">UT</state>
      <phoneNumber xsi:type="xsd:string">null</phoneNumber>
      <companyName xsi:type="xsd:string">null</companyName>
      <password xsi:type="xsd:string">null</password>
      <emailAddr xsi:type="xsd:string">null</emailAddr>
      <city xsi:type="xsd:string">null</city>
      <groupID xsi:type="xsd:int">-1</groupID>
      <firstName xsi:type="xsd:string">null</firstName>
      <primaryContact xsi:type="xsd:string">null</primaryContact>
      <address xsi:type="xsd:string">null</address>
      <hasError xsi:type="xsd:boolean">false</hasError>
      <zip xsi:type="xsd:string">null</zip>
      <username xsi:type="xsd:string">null</username>
      <userID xsi:type="xsd:int">-1</userID>

      --- In soaplite@y..., Duncan Cameron <dcameron@b...> wrote:
      > On 2002-07-19 nate_bowler wrote:
      > >Still stuck on this....
      > >
      > >The biggest problem I have is SOAP::Data->type() method ALWAYS
      > >up. It references a namespace that isn't delared anywere in the
      > >message. For example, if the method call inside the body declares
      > >an "xmlns:namesp2" namespace, type() method will reference an
      > >undeclared "namesp3" namespace.
      > >
      > >The following is the CLOSEST I have come to a successful call.
      > >notice the bogus parameter element name, and the invalid namespace
      > >the xml.
      > >
      > >I have included my Perl code, the incorrect XML, and a XML message
      > >that does work in hopes it may help.
      > >
      > >Can anybody offer a suggestion that would help me to generate the
      > >proper XML from my Perl client? Any help would be appreciated.
      > >
      > See this message on the list, and its follow-ups, which is a
      similar problem
      > to yours:
      > http://groups.yahoo.com/group/soaplite/message/1661
      > Regards,
      > Duncan Cameron
    Your message has been successfully submitted and would be delivered to recipients shortly.