PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Web Services » SOAP » Bug #5841

namespaces in params and minOccurs=0

Details

Submitted2005-11-01 16:13 UTC
Frommartin at malditainternet dot com
StatusNo Feedback
PackageSOAP
PHP Version4.4.0
OSlinux
Roadmaps(Not assigned)

Comments

[2005-11-01 16:13 UTC] martin at malditainternet dot com

Description:
------------
Microsoft Sharepoint webservices don't like this requests
<SOAP-ENV:Body>

<ns4:GetList>

<listName xsi:type="xsd:string">{B38BE491-96F6-4DC5-9CC4-92440322F02E}</listName></ns4:GetList>

</SOAP-ENV:Body>

but do like this ones:

<SOAP-ENV:Body>

<ns4:GetList>

<ns4:listName xsi:type="xsd:string">{B38BE491-96F6-4DC5-9CC4-92440322F02E}</ns4:listName></ns4:GetList>

</SOAP-ENV:Body>

I've added a "use_explicit_namespaces" property to Client to create this kind of messages

Also, I found a bug where parameters where the class warned for missing parameters even if the param had minOccurs=0. I fixed that, too

Test script:
---------------
--- SOAP_orig/Client.php 2005-05-30 18:55:00.000000000 -0300
+++ SOAP/Client.php 2005-11-01 11:53:20.000000000 -0300
@@ -164,6 +164,14 @@

var $_soap_transport = null;

+ /**
+ * Add an explicit namespace for each param in the request
+ *
+ * This needed to speak with some soap implementations, like Microsoft Sharepoint
+ *
+ * @var $use_explicit_namespaces bool
+ */
+ var $use_explicit_namespaces = false;
/**
* Constructor.
*
@@ -505,13 +513,13 @@
if (isset($params[$name]) ||
$this->_wsdl->getDataHandler($name, $part['namespace'])) {
$nparams[$name] =& $params[$name];
- } else {
+ } elseif($part['minOccurs'] > 0) {
// We now force an associative array for
// parameters if using WSDL.
return $this->_raiseSoapFault("The named parameter $name is not in the call parameters.");
}
- if (gettype($nparams[$name]) != 'object' ||
- !is_a($nparams[$name], 'SOAP_Value')) {
+ if (isset($nparams[$name]) && (gettype($nparams[$name]) != 'object' ||
+ !is_a($nparams[$name], 'SOAP_Value'))) {
// Type is likely a qname, split it apart, and get
// the type namespace from WSDL.
$qname =& new QName($part['type']);
@@ -527,7 +535,9 @@
$pqname = $name;
if ($xmlns) {
$pqname = '{' . $xmlns . '}' . $name;
- }
+ }elseif(!empty($this->use_explicit_namespaces)){
+ $pqname = '{' . $namespace . '}' . $name;
+ }
$nparams[$name] =& new SOAP_Value($pqname,
$qname->fqn(),
$nparams[$name],