Bug #76142 [NEW]: Error generating request when /definitions/types/schema.targetNamespace not set
| From: | VadimZelenin at gmail dot com | Date: | Fri, 23 Mar 2018 11:24:18 +0000 |
| Subject: | Bug #76142 [NEW]: Error generating request when /definitions/types/schema.targetNamespace not set | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-214448@lists.php.net to get a copy of this message | ||
From: VadimZelenin at gmail dot com
Operating system: linux
PHP version: 5.6.34
Package: SOAP related
Bug Type: Bug
Bug description:Error generating request when /definitions/types/schema.targetNamespace not set
Description:
------------
I need interoperate with service for which
/definitions/types/schema.targetNamespace is not set.
SoapUI 5.3.0 can form request template to such service -
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<AddLocation>
<id>?</id>
<placeId>?</placeId>
<!--Optional:-->
<prefix>?</prefix>
</AddLocation>
</soapenv:Body>
</soapenv:Envelope>
www.wsdl-analyzer.com too -
<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
<s11:Body>
<ns1:AddLocation xmlns:ns1=''>
<ns1:id>?XXX?</ns1:id>
<ns1:placeId>?XXX?</ns1:placeId>
<!-- optional -->
<ns1:prefix />
</ns1:AddLocation>
</s11:Body>
</s11:Envelope>
But SoapClient from php (5.6.33) can not.
Please advise workaround.
Test script:
---------------
#!/usr/bin/php
<?php
class CustomSoapClient extends SoapClient
{
public function __doRequest($aRequest, $aLocation, $aAction,
$aVersion, $aOneWay=0)
{
print_r( $aRequest );
exit(0);
}
};
$WSDL='<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:AddLocationService"
targetNamespace="urn:AddLocationService">
<wsdl:types>
<s:schema elementFormDefault="qualified">
<s:complexType name="AddLocationRequest">
<s:sequence>
<s:element name="id" type="s:string"/>
<s:element name="placeId" type="s:string"/>
<s:element minOccurs="0" name="prefix"/>
</s:sequence>
</s:complexType>
<s:element name="AddLocation" type="AddLocationRequest"/>
</s:schema>
</wsdl:types>
<wsdl:message name="AddLocationSoapIn">
<wsdl:part name="parameters" element="AddLocation"/>
</wsdl:message>
<wsdl:message name="AddLocationSoapOut"/>
<wsdl:portType name="ERLocationScheduleServiceSoap">
<wsdl:operation name="AddLocation">
<wsdl:input message="tns:AddLocationSoapIn"/>
<wsdl:output message="tns:AddLocationSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ERLocationScheduleServiceSoap"
type="tns:ERLocationScheduleServiceSoap">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="AddLocation">
<soap:operation soapAction="" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ERLocationScheduleService">
<wsdl:port name="ERLocationScheduleServiceSoap"
binding="tns:ERLocationScheduleServiceSoap">
<soap:address location="http://private.serv/bogus.cls"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>';
ini_set('soap.wsdl_cache_enabled', 0);
$client = new CustomSoapClient('data:application/wsdl+xml;base64,' .
base64_encode($WSDL));
$request = array( 'id'=>'1',
'placeId' => '123',
'prefix' => 'xyz',
);
$client->AddLocation($request);
?>
Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<AddLocation>
<id>1</ns1:id>
<placeId>123</ns1:placeId>
<prefix>xyz</ns1:prefix>
</AddLocation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<parameters>
<item>
<key>id</key>
<value>1</value>
</item>
<item>
<key>placeId</key>
<value>123</value>
</item>
<item>
<key>prefix</key>
<value>xyz</value>
</item>
</parameters>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--
Edit bug report at https://bugs.php.net/bug.php?id=76142&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76142&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76142&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76142&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76142&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76142&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76142&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76142&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76142&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76142&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76142&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76142&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76142&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76142&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76142&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76142&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76142&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76142&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76142&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76142&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76142&r=mysqlcfg