php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62817 elementFormDefault="qualified" without uri fails
Submitted: 2012-08-14 15:01 UTC Modified: 2012-08-14 16:02 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: ken at readywireless dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.4.5 OS: Windows XP
Private report: No CVE-ID: None
 [2012-08-14 15:01 UTC] 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);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-14 16:02 UTC] ken at readywireless dot com
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.
 [2013-08-28 19:54 UTC] msajadi824 at hotmail dot com
Use this wsdl instead of previous wsdl:
https://b2btest.idt.net/b2bapi/b2bsvc.asmx?WSDL

this wdsl has not problem and work prefect.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC