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

847Returning structure

Expand Messages
  • Weidong Wang
    Sep 20, 2001
    • 0 Attachment
      Two questions regarding how to return a structure:
       
      1. I want the wire data to look like:
       
      ...
       <s:Body>
          <g:TestResponse xmlns:g="someuri">
            <g:TestResult>
              <g:Acct>abc</g:Acct>
              <Devices>
                <Device>device1</Device>
                <Device>device2</Device>
                <Device>device3</Device>
              </Device>
            </g:TestResult>
          </g:RestResponse>
        </s:Body>
      ...
       
      My code does:
       
          $devices = {
       Device => 'device1',
       Device => 'device2',
       Device => 'device3'
       };
       
          return
            SOAP::Data->name(TestResult)->type('ordered_hash' => [Acct => 'abc', Devices => $devices]);
      But it only returns 'device3'. I suppose it treats $devices as a hash. And since the index is the same, it keeps the last one. How do I do?
       
      2. I want the wire data to look like:
       
      ...
       <s:Body>
          <g:TestResponse xmlns:g="someuri">
            <g:TestResult>
              <g:FileName>abc</g:FileName>
              <g:FileData SOAP-ENC:base64>kjadhflkjahf==</g:FileData>
            </g:TestResult>
          </g:RestResponse>
        </s:Body>
      ...
       
      and my code does:
       
          return 
            SOAP::Data->name(TestResult)->type('ordered_hash' => [FileName => 'abc', FileData => [map {SOAP::Data->type(base64)->value($_)} 'This is a test file content'] ] );
      But the result is that "FileData" is serialized as an array with the first element containing the base64'ed content.
      How do I do?
       
      Thanks.
       
      Weidong
       
    • Show all 2 messages in this topic