ID:               44469
 Updated by:       j...@php.net
 Reported By:      potyomkine at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         SOAP related
 Operating System: FreeBSD
 PHP Version:      5.2.5
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------

[2008-10-02 19:16:43] bugs dot php dot net at ceesco dot com

I think the SOAP client can't handle complex types and nested nodes.

------------------------------------------------------------------------

[2008-04-07 15:41:11] aurelien at proprenetworks dot net

Maybe the same bug here with a simple case :

The array used to construct the xml

<?php
$param_searchPlace = array(
  'idProduct'   =>'15',
  'idSite'      =>'17'
);

$param_ctx = array(
  'idUser'      =>'someUser',
  'password'    =>'somePassword',
  'language'    =>'fr',
  'arrival'     =>'2008-10-01T00:00:00+02:00',
  'duration'    =>'P5D',
  'person'      =>'4',
  'deltaArrival'        =>'3',
  'deltaDuration'       =>'2',
  'searchPlace' =>$param_searchPlace
);

$parametres = array( 'RequestCpgAvailability'   =>$param_ctx );
?>

The resulting XML :
<soap-env:body>
  <ns1:cpg_Availability>
    <RequestCpgAvailability_1>
      <idUser>someUser</idUser>
      <password>somePassword</password>
      <language>fr</language>
      <arrival>2008-10-01T00:00:00+02:00</arrival>
      <deltaArrival>3</deltAarrival>
      <deltaDuration>2</deltaDuration>
      <duration>P5D</duration>
      <person>4</person>
      <searchPlace>
        <idProduct>
          <idSite>17</idSite>
        </idProduct>
      </searchPlace>
    </RequestCpgAvailability_1>
  </ns1:cpg_Availability>
</soap-env:body>

The expected XML :
<soap-env:body>
  <ns1:cpg_Availability>
    <RequestCpgAvailability_1>
      <idUser>someUser</idUser>
      <password>somePassword</password>
      <language>fr</language>
      <arrival>2008-10-01T00:00:00+02:00</arrival>
      <deltaArrival>3</deltAarrival>
      <deltaDuration>2</deltaDuration>
      <duration>P5D</duration>
      <person>4</person>
      <searchPlace>
        <idProduct>15</idProduct>
        <idSite>17</idSite>
      </searchPlace>
    </RequestCpgAvailability_1>
  </ns1:cpg_Availability>
</soap-env:body>

------------------------------------------------------------------------

[2008-03-18 15:40:03] potyomkine at gmail dot com

Description:
------------
problem with creating xml from array 
I call function
$client = new SoapClient(WSDL);

$client->function($arr);

where var_dump($arr) === array(1) {
  ["Items"]=>
  array(1) {
    ["BatchFileItem"]=>
    array(1) {
      [0]=>
      array(9) {
        ["ProgMFG"]=>
        string(13) "progmfg-00000"
        ["ProdLine"]=>
        string(14) "prodline-00000"
        ["ArtNumber"]=>
        string(9) "art-00000"
        ["Vendor"]=>
        string(5) "Luval"
        ["Measure"]=>
        string(2) "kg"
        ["Group"]=>
        string(10) "skovorodki"
        ["Cube"]=>
        string(8) "232.5655"
        ["Weight"]=>
        string(9) "2323.2323"
        ["DescriptionList"]=>
        array(1) {
          ["LocalizedDescription"]=>
          array(3) {
            [0]=>
            array(2) {
              ["Language"]=>
              string(2) "EN"
              ["Description"]=>
              array(2) {
                ["Short"]=>
                string(15) "eng short descr"
                ["Long"]=>
                string(24) "english long description"
              }
            }
            [1]=>
            array(2) {
              ["Language"]=>
              string(2) "RU"
              ["Description"]=>
              array(2) {
                ["Short"]=>
                string(15) "rus short descr"
                ["Long"]=>
                string(24) "russian long description"
              }
            }
            [2]=>
            array(2) {
              ["Language"]=>
              string(2) "RU"
              ["Description"]=>
              array(2) {
                ["Short"]=>
                string(15) "rus short descr"
                ["Long"]=>
                string(24) "russian long description"
              }
            }
          }
        }
      }
    }
  }
}


but when I see request it is look like this

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ns1="http://localhost/";>
        <SOAP-ENV:Body>
                <ns1:function>
                        
                                <ns1:Items>
                                        <ns1:BatchFileItem>
                                                
<ns1:ProgMFG>progmfg-00000</ns1:ProgMFG>
                                                
<ns1:ProdLine>prodline-00000</ns1:ProdLine>
                                                
<ns1:ArtNumber>art-00000</ns1:ArtNumber>
                                                <ns1:Vendor>Luval</ns1:Vendor>
                                                <ns1:Measure>kg</ns1:Measure>
                                                
<ns1:Group>skovorodki</ns1:Group>
                                                <ns1:Cube>232.5655</ns1:Cube>
                                                
<ns1:Weight>2323.2323</ns1:Weight>
                                        </ns1:BatchFileItem>
                                </ns1:Items>
                        
                        </ns1:function>
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Reproduce code:
---------------
$client->function($arr);

where var_dump($arr) === array(1) {
  ["Items"]=>
  array(1) {
    ["BatchFileItem"]=>
    array(1) {
      [0]=>
      array(9) {
        ["ProgMFG"]=>
        string(13) "progmfg-00000"
        ["ProdLine"]=>
        string(14) "prodline-00000"
        ["ArtNumber"]=>
        string(9) "art-00000"
        ["Vendor"]=>
        string(5) "Luval"
        ["Measure"]=>
        string(2) "kg"
        ["Group"]=>
        string(10) "skovorodki"
        ["Cube"]=>
        string(8) "232.5655"
        ["Weight"]=>
        string(9) "2323.2323"
        ["DescriptionList"]=>
        array(1) {
          ["LocalizedDescription"]=>
          array(3) {
            [0]=>
            array(2) {
              ["Language"]=>
              string(2) "EN"
              ["Description"]=>
              array(2) {
                ["Short"]=>
                string(15) "eng short descr"
                ["Long"]=>
                string(24) "english long description"
              }
            }
            [1]=>
            array(2) {
              ["Language"]=>
              string(2) "RU"
              ["Description"]=>
              array(2) {
                ["Short"]=>
                string(15) "rus short descr"
                ["Long"]=>
                string(24) "russian long description"
              }
            }
            [2]=>
            array(2) {
              ["Language"]=>
              string(2) "RU"
              ["Description"]=>
              array(2) {
                ["Short"]=>
                string(15) "rus short descr"
                ["Long"]=>
                string(24) "russian long description"
              }
            }
          }
        }
      }
    }
  }
}


Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ns1="http://localhost/";>
 <SOAP-ENV:Body>
  <ns1:function>
    <ns1:Items>
     <ns1:BatchFileItem>
      <ns1:ProgMFG>progmfg-00000</ns1:ProgMFG>
      <ns1:ProdLine>prodline-00000</ns1:ProdLine>
      <ns1:ArtNumber>art-00000</ns1:ArtNumber>
      <ns1:Vendor>Luval</ns1:Vendor>
      <ns1:Measure>kg</ns1:Measure>
      <ns1:Group>skovorodki</ns1:Group>
      <ns1:Cube>232.5655</ns1:Cube>
      <ns1:Weight>2323.2323</ns1:Weight>
      <ns1:DescriptionList>
        <ns1:LocalizedDescription>
          <ns1:Language>EN</ns1:Language>
          <ns1:Description>
           <ns1:Short>eng short descr</ns1:Short>
           <ns1:Long>english long description</ns1:Long>
          </ns1:Description>
        </ns1:LocalizedDescription>
        <ns1:LocalizedDescription>
          <ns1:Language>RU</ns1:Language>
          <ns1:Description>
           <ns1:Short>rus short descr</ns1:Short>
           <ns1:Long>russian long description</ns1:Long>
          </ns1:Description>
        </ns1:LocalizedDescription>
        <ns1:LocalizedDescription>
          <ns1:Language>RU</ns1:Language>
          <ns1:Description>
           <ns1:Short>rus short descr</ns1:Short>
           <ns1:Long>russian long description</ns1:Long>
          </ns1:Description>
        </ns1:LocalizedDescription>

      </ns1:DescriptionList>
     </ns1:BatchFileItem>
    </ns1:Items>
  </ns1:function>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ns1="http://localhost/";>
 <SOAP-ENV:Body>
  <ns1:function>
    <ns1:Items>
     <ns1:BatchFileItem>
      <ns1:ProgMFG>progmfg-00000</ns1:ProgMFG>
      <ns1:ProdLine>prodline-00000</ns1:ProdLine>
      <ns1:ArtNumber>art-00000</ns1:ArtNumber>
      <ns1:Vendor>Luval</ns1:Vendor>
      <ns1:Measure>kg</ns1:Measure>
      <ns1:Group>skovorodki</ns1:Group>
      <ns1:Cube>232.5655</ns1:Cube>
      <ns1:Weight>2323.2323</ns1:Weight>
     </ns1:BatchFileItem>
    </ns1:Items>
  </ns1:function>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44469&edit=1

Reply via email to