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

1686SOAP::Lite client passing complexType to Java JAXRPC server

Expand Messages
  • nate_bowler
    Jul 10 10:13 AM
    • 0 Attachment
      I'm unable to pass a complexType to a Java web service running Sun's
      JAXRPC.

      I've noticed several differences between the traces of my Java and
      perl client (code and XML traces are added at bottom)

      2 questions:

      1. Using a WSDL file, is there an easy way to work with custom types,
      i.e. is SOAP::Data (or some other object) smart enough to serialize
      uninitialized fields of a custom type?

      2. If not, what is required of SOAP::Data to properly serialize this
      value? Namespace in particular is causing me pain.

      Any help or examples of calling a JAXRPC web service with a
      complexType from a SOAP::Lite client would be appreciated.

      Thanks,
      Nate Bowler

      <CODE>
      #!perl -w
      #!d:\perl\bin\perl.exe

      use SOAP::Lite;

      my $api_server = SOAP::Lite
      -> soapversion(1.2)
      -> service('http://63.228.219.51:8080/attask/APIService.wsdl');



      my $sessionID = $api_server->login("admin","user");
      my $userFilter = { 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 => 'null',
      phoneNumber => 'null' };

      my $userlist = $api_server->getUsersByUserFilter($sessionID,
      SOAP::Data->type('User')->uri('http://www.attask.com/api')->value
      ($userFilter));
      print "\nusername:" . $$userlist[0]->{'username'} . "\n";

      $api_server->logout($sessionID);
      </CODE>


      ##############################################
      # Java JAXRPC Client Trace
      <?xml version="1.0" encoding="UTF-8" ?>
      - <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns0="http://www.attask.com/api"
      env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      - <env:Body>
      - <ns0:getUsersByUserFilter>
      <String_1 xsi:type="xsd:string">admin311026319613520</String_1>
      <User_2 href="#ID1" />
      </ns0:getUsersByUserFilter>
      - <ns0:User id="ID1" xsi:type="ns0:User">
      <hasError xsi:type="xsd:boolean">false</hasError>
      <state xsi:type="xsd:string">UT</state>
      <zip xsi:type="xsd:string">null</zip>
      <primaryContact xsi:type="xsd:string">null</primaryContact>
      <city xsi:type="xsd:string">null</city>
      <username xsi:type="xsd:string">null</username>
      <emailAddr xsi:type="xsd:string">null</emailAddr>
      <groupID xsi:type="xsd:int">-1</groupID>
      <address xsi:type="xsd:string">null</address>
      <firstName xsi:type="xsd:string">null</firstName>
      <password xsi:type="xsd:string">null</password>
      <lastName xsi:type="xsd:string">null</lastName>
      <companyName xsi:type="xsd:string">null</companyName>
      <userID xsi:type="xsd:string">null</userID>
      <phoneNumber xsi:type="xsd:string">null</phoneNumber>
      </ns0:User>
      </env:Body>
      </env:Envelope>

      ##############################################
      # SOAP::Lite trace
      # notice the namespace and ordering of elements

      <?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
      ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      - <SOAP-ENV:Body>
      - <namesp4:getUsersByUserFilter
      xmlns:namesp4="http://www.attask.com/api">
      <String_1 xsi:type="xsd:string">admin321026319656442</String_1>
      - <namesp5:User_2 xmlns:namesp5="http://www.attask.com/api"
      xsi:type="namesp5: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:string">null</userID>
      </namesp5:User_2>
      </namesp4:getUsersByUserFilter>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>