Any clue of how to send null valued parameters to a java web service? Been
trying a few ways and each way changes the null to an empty string. I've
tried hooking both a .net client and a Flex client to the service, and they
both work fine, so this is a php issue.

----- Service Def ----- 
MyWebService::getCategories(String parentId, String functionId) returns
List<Category>


----- Example PHP -----

$cl = new SoapClient('http://myserver/services/MyWebService?wsdl');

//Standard way...
$r = $cl->getCategories(null, '1'); //parentId is received as ''

// Using SoapParam
$p = new SoapParam(null, 'parentId');
$f = new SoapParam('1', 'functionId');
$cl->getCategories($p, $f); // parentId is received as ''

// Using Assoc Array
$params['parentId'] = null;
$params['functionId'] = '1';
$cl->__soapCall('getCatgories', $params); // All jumbled up, param parentId
receives the functionId value, and functionId is ''

// Using stdClass with named method
$params = new stdClass();
$params->parentId = null;
$params->functionId = '1';
$cl->getCatgories($params); // Exception, cannot convert stdClass to string

// Using stdClass with __soapCall
$cl->__soapCall('getCategories', $params); // Exception, second param should
be array


A colleague was able to make a reallllllly dirt workaround in modifying the
actual XML of the request to include the nil property, but come on... there
has to be an easier method
// Null param working, but very cumbersome
$cl->getCatgories (new SoapVar('<ns1:parentId xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; />', XSD_ANYXML), "1")




_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to