Bug #62817 [Opn]: elementFormDefault="qualified" without uri fails
| From: | ken at readywireless dot com | Date: | Tue, 14 Aug 2012 16:02:33 +0000 |
| Subject: | Bug #62817 [Opn]: elementFormDefault="qualified" without uri fails | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172601@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62817&edit=1
ID: 62817
User updated by: ken at readywireless dot com
Reported by: ken at readywireless dot com
Summary: elementFormDefault="qualified" without uri fails
Status: Open
Type: Bug
Package: SOAP related
Operating System: Windows XP
PHP Version: 5.4.5
Block user comment: N
Private report: N
New Comment:
The bad code does send a SOAP request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="" xmlns:ns2="http://wsdl.idt.b2bapi.net/"><SOAP-ENV:Body><ns2:GetProducts><GetProductsRequest><ns1:UserInfo
UserName="user_name" Password="password"/><ns1:ClientReferenceData
Service="pinless_dialing"/></GetProductsRequest></ns2:GetProducts></SOAP-ENV:Body></SOAP-ENV:Envelope>
Notice the ns1: namespace elements, which refer to a blank namespace.
Previous Comments:
------------------------------------------------------------------------
[2012-08-14 15:01:46] ken at readywireless dot com
Description:
------------
When using the SOAP client with a WSDL that defines a portion of the schema with
elementFormDefault="qualified", but without a URI for the namespace, using _soapCall()
fails for any request that contains complex elements from that portion of the schema. It appears
that direct children are handled correctly (left in the default namespace), but further ancestors
are being prefixed with a namespace that has a blank URI. This is conjecture, as all I can see is a
soapfault of Bad Request.
Test script:
---------------
<?php
$_WsdlUri='http://169.132.165.178/b2bapi/b2bservice.asmx?WSDL';
$Server=new SoapClient($_WsdlUri, array('trace' => true));
$sessionstart->UserInfo->UserName = 'user_name';
$sessionstart->UserInfo->Password = 'password';
$result = $Server->__soapCall('SessionStart', array($sessionstart));
print_r($result);
$getproducts->GetProductsRequest->UserInfo->UserName = 'user_name';
$getproducts->GetProductsRequest->UserInfo->Password = 'password';
$getproducts->GetProductsRequest->ClientReferenceData->Service =
'pinless_dialing';
$result = $Server->__soapCall('GetProducts', array($getproducts));
print_r($result);
?>
Expected result:
----------------
SOAP responses (albeit login failures for both in the example above)
Actual result:
--------------
SOAP response for SessionStart, 'BAD REQUEST' error for GetProducts
Replacing the example WSDL with the URI to the following script generates correct behavior:
<?php
$url ='http://169.132.165.178/b2bapi/b2bservice.asmx?WSDL';
$wsdl = file_get_contents($url);
$pattern = '#<s:schema elementFormDefault="qualified">#';
$wsdl = preg_replace($pattern, '<s:schema>', $wsdl);
print ($wsdl);
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62817&edit=1