Bug #76142 [Opn]: Error generating request when /definitions/types/schema.targetNamespace not set
| From: | VadimZelenin at gmail dot com | Date: | Fri, 23 Mar 2018 14:27:22 +0000 |
| Subject: | Bug #76142 [Opn]: Error generating request when /definitions/types/schema.targetNamespace not set | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214455@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76142&edit=1
ID: 76142
User updated by: VadimZelenin at gmail dot com
Reported by: VadimZelenin at gmail dot com
Summary: Error generating request when
/definitions/types/schema.targetNamespace not set
Status: Open
Type: Bug
Package: SOAP related
Operating System: linux
PHP Version: 5.6.34
Block user comment: N
Private report: N
New Comment:
oops, Expected result must be:
----------------
<?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</id>
<placeId>123</placeId>
<prefix>xyz</prefix>
</AddLocation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Previous Comments:
------------------------------------------------------------------------
[2018-03-23 11:24:15] VadimZelenin at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=76142&edit=1