Complex type failing

"JONES, ROBERT E CTR USAF AETC TTMS/TTMS" <[email protected]> Mon, 10 Oct 2011 15:16:35 -0500
Newsgroups gmane.comp.lang.perl.xml
Message-ID <2E69B12F0EF78E4395724555B03337ACE13506C443@52VEJX-MV08-01.AREA52.AFNOAPPS.USAF.MIL>
  Having a bit of trouble with complex types.  Below is the SOAP output I'm trying to achieve:

SOAPAction: Receive_Data

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:urna="urna:URNA-ID"
    xmlns:urnb="urnb:URNB-ID">
    xmlns:urnc="urnc:URNC-ID"
  <soap:Header>
    <urna:outbound>
      <urna:message>JUI98-685</urna:message>
    </urna:outbound>
  </soap:Header>
  <soap:Body>
    <urnb:datastructure UserId="testuser" UserRole="testrole">
     <urnc:date>2000-10-10T00:00:00</urnc:date>
     <urnc:source>field test</urnc:source>
    </urnb:datastructure>
  </soap:Body>
</soap:Envelope>

  Here's my coding example below for peer reviewing:

use SOAP::Lite +debug;
use SOAP::Lite on_fault => sub { my ($client, $res) = @_;
                           die ref $res ? $res->faultstring : $client->transport->status, "\n"; };

$proxy = 'http://testingservice.location/webservice.svc';
$uri   = 'http://testinguri.location';

$client = SOAP::Lite
 ->readable(1)
 ->autotype(0)
 ->uri($uri)
 ->proxy($proxy);

$client->ns('urna:URNA-ID','urna');
$client->ns('urnb:URNB-ID','urnb');
$client->ns('urnc:URNC-ID','urnc');

  ## Create the SOAP Headers ##

$origdata = SOAP::Header->name('message')
                        ->prefix('urna')
                        ->value('JUI98-685');

$header = SOAP::Header->name('outbound') 
                      ->prefix('urna')
                      ->value(\SOAP::Header->value($origdata));

  ## Create the SOAP Body ##

$data1 = SOAP::Data->name('date')
                   ->prefix('urnc')
                   ->value('2000-10-10T00:00:00');

$data2 = SOAP::Data->name('source')
                   ->prefix('urnc')
                   ->value('field test');

@inner = ($data1,$data2);

$top = SOAP::Data->name('datastructure')
                 ->prefix('urnb')
                 ->attr({'UserId'   => 'testuser',
                         'UserRole' => 'testrole'})
                 ->value(\SOAP::Data->value(@inner));

  ## Pass data to the web service ##

$client->on_action(sub { sprintf 'Receive_Data' });
$response = $client->call($top,$header);


  What I'm getting from my output is the following where only the top level is being created:

SOAPAction: Receive_Data

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
    soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:urna="urna:URNA-ID"
    xmlns:urnb="urnb:URNB-ID">
    xmlns:urnc="urnc:URNC-ID"
  <soap:Header>
    <urna:outbound>
      <urna:message>JUI98-685</urna:message>
    </urna:outbound>
  </soap:Header>
  <soap:Body>
    <urnb:datastructure UserId="testuser" UserRole="testrole" />
  </soap:Body>
</soap:Envelope>


Robert Jones, BSP, BSCS
Keesler AFB

_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs