Java MapEntry data types through SOAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've been working with a soap web service method through the php soap
extension which expects an array of a java specific data type, MapEntry, as
a parameter. No matter what value I pass, as long as it's an array, I don't
get any errors. Unfortunately, it doesn't seem to be able to read the values
either.

Each MapEntry object should contain key/value pairs, like a php associative
array. At first I tried passing a php associative array:

$soapClient->theMethod(array('value1' => 'bla', 'value2' => 'blabla'));

Then I tried passing it like so:

$soapClient->theMethod(array(array('value' => 'bla'), array('value' =>
'blabla')));

Again, no luck. Finally, I tried creating a php MapEntry object and passing
that:

class MapEntry
{
    public $key;
    
    public $value;
    
    public function setKey($key)
    {
        $this->key = $key;
    }
    
    public function setValue($value)
    {
        $this->value = $value;
    }
}

$params = array();
$params[0] = new MapEntry();
$params[0]->setKey('value1');
$params[0]->setValue('bla');
$params[1] = new MapEntry();
$params[1]->setKey('value2');
$params[1]->setValue('blabla');

$soapClient->theMethod($params);

I've seen a lot of talk about the php soap extension having issues with
handling arrays and arrays of objects. I'm not sure if that's where my
problem lies or if it's related to the use of the Java data type MapEntry.

Here is the pertinent section describing this parameter (I think) from the
wsdl:

<complexType name="MapEntry">
    <sequence>
        <element name="key" nillable="true" type="xsd:anyType"/>
        <element name="value" nillable="true" type="xsd:anyType"/>
    </sequence>
</complexType>
<complexType name="ArrayOfMapEntry">
    <complexContent>
        <restriction base="soapenc:Array">
            <attribute ref="soapenc:arrayType"
wsdl:arrayType="impl:MapEntry[]"/>
        </restriction>
    </complexContent>
</complexType>

And here's the pertinent parts of the request actually sent:

<SOAP-ENV:Body>
    <ns1:someMethod>
        <predata SOAP-ENC:arrayType="ns1:MapEntry[1]"
xsi:type="ns1:ArrayOfMapEntry">
            <item xsi:type="ns1:MapEntry">
                <key xsi:type="xsd:string">value1</key>
                <value xsi:type="xsd:string">bla</value>
            </item>
            <item xsi:type="ns1:MapEntry">
                <key xsi:type="xsd:string">value2</key>
                <value xsi:type="xsd:string">blabla</value>
            </item>                
        </predata>
    </ns1:someMethod>
</SOAP-ENV:Body>

So is this an issue with the MapEntry data type or with the use of arrays
themselves? If it's an issue with the java data type, is there a way to
properly pass non-php data types through soap? If it's an issue with the use
of arrays, has anyone come up with a solution yet? I've looked, but found
nothing.
-- 
View this message in context: http://www.nabble.com/Java-MapEntry-data-types-through-SOAP-tp19520454p19520454.html
Sent from the Php - Soap mailing list archive at Nabble.com.


-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux