-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/soap: setting xml namespace in classmap #12411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3bc3728
ext/soap: setting xml namespace in classmap
lxShaDoWxl bbbb545
ext/soap: setting xml namespace in classmap without allocation
lxShaDoWxl e1ee150
ext/soap: fix cache
lxShaDoWxl 4a36c75
ext/soap: change by comments, init clark notation in defaultEncoding
lxShaDoWxl 5907351
Fix persistent allocation in MINIT
nielsdos 5b330bd
ext/soap: clear clark_notation in PHP_MSHUTDOWN_FUNCTION
lxShaDoWxl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--TEST-- | ||
SOAP Classmap 5: SoapClient support for classmap with namespace | ||
--EXTENSIONS-- | ||
soap | ||
--INI-- | ||
soap.wsdl_cache_enabled=0 | ||
--FILE-- | ||
<?php | ||
class TestSoapClient extends SoapClient{ | ||
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string { | ||
return <<<EOF | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nothing.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body> | ||
<ns1:dotest2Response><res xsi:type="ns1:book"> | ||
<a xsi:type="xsd:string">Blaat</a> | ||
<b xsi:type="xsd:string">aap</b> | ||
</res> | ||
</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope> | ||
EOF; | ||
} | ||
} | ||
|
||
class bookNs{ | ||
public $a="a"; | ||
public $b="c"; | ||
|
||
} | ||
|
||
$options=Array( | ||
'actor' =>'http://schema.nothing.com', | ||
'classmap' => array('{http://schemas.nothing.com}book'=>'bookNs', 'wsdltype2'=>'classname2') | ||
); | ||
|
||
$client = new TestSoapClient(__DIR__."/classmap.wsdl",$options); | ||
$ret = $client->dotest2("???"); | ||
var_dump($ret); | ||
echo "ok\n"; | ||
?> | ||
--EXPECT-- | ||
object(bookNs)#2 (2) { | ||
["a"]=> | ||
string(5) "Blaat" | ||
["b"]=> | ||
string(3) "aap" | ||
} | ||
ok |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--TEST-- | ||
SOAP Classmap 6: encoding of inherited objects with namespace | ||
--EXTENSIONS-- | ||
soap | ||
--FILE-- | ||
<?php | ||
ini_set("soap.wsdl_cache_enabled",0); | ||
|
||
class A { | ||
public $x; | ||
function __construct($a){ | ||
$this->x = $a; | ||
} | ||
} | ||
class Attest { | ||
public $x; | ||
function __construct($a){ | ||
$this->x = $a; | ||
} | ||
} | ||
class B extends A { | ||
public $y; | ||
function __construct($a){ | ||
parent::__construct($a); | ||
$this->y = $a + 1; | ||
} | ||
} | ||
|
||
function f($input){ | ||
return new B(5); | ||
} | ||
|
||
class LocalSoapClient extends SoapClient { | ||
private $server; | ||
|
||
function __construct($wsdl, $options) { | ||
parent::__construct($wsdl, $options); | ||
$this->server = new SoapServer($wsdl, $options); | ||
$this->server->addFunction("f"); | ||
} | ||
|
||
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string { | ||
ob_start(); | ||
$this->server->handle($request); | ||
$response = ob_get_contents(); | ||
ob_end_clean(); | ||
return $response; | ||
} | ||
} | ||
|
||
$client = new LocalSoapClient(__DIR__."/classmap006.wsdl", | ||
array('classmap'=>array('A'=>'A','{urn:abt}At'=>'Attest','B'=>'B'))); | ||
print_r($client->f(new Attest('test'))); | ||
?> | ||
--EXPECT-- | ||
B Object | ||
( | ||
[x] => 5 | ||
[y] => 6 | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
|
||
<!-- WSDL file generated by Zend Studio. --> | ||
|
||
<definitions name="ab" targetNamespace="urn:ab" xmlns:typens="urn:ab" xmlns:typenst="urn:abt" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"> | ||
<types> | ||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ab"> | ||
<xsd:complexType name="A"> | ||
<xsd:sequence> | ||
<xsd:element name="x" type="xsd:anyType"/> | ||
</xsd:sequence> | ||
</xsd:complexType> | ||
<xsd:complexType name="B"> | ||
<xsd:complexContent> | ||
<xsd:extension base="typens:A"> | ||
<xsd:sequence> | ||
<xsd:element name="y" type="xsd:anyType"/> | ||
</xsd:sequence> | ||
</xsd:extension> | ||
</xsd:complexContent> | ||
</xsd:complexType> | ||
</xsd:schema> | ||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:abt"> | ||
<xsd:complexType name="At"> | ||
<xsd:sequence> | ||
<xsd:element name="x" type="xsd:anyType"/> | ||
</xsd:sequence> | ||
</xsd:complexType> | ||
<xsd:complexType name="Bt"> | ||
<xsd:complexContent> | ||
<xsd:extension base="typens:A"> | ||
<xsd:sequence> | ||
<xsd:element name="y" type="xsd:anyType"/> | ||
</xsd:sequence> | ||
</xsd:extension> | ||
</xsd:complexContent> | ||
</xsd:complexType> | ||
</xsd:schema> | ||
|
||
</types> | ||
<message name="f"> | ||
<part name="fInput" type="xsd:anyType"/> | ||
</message> | ||
<message name="fResponse"> | ||
<part name="fReturn" type="typens:A"/> | ||
</message> | ||
<portType name="abServerPortType"> | ||
<operation name="f"> | ||
<input message="typens:f"/> | ||
<output message="typens:fResponse"/> | ||
</operation> | ||
</portType> | ||
<binding name="abServerBinding" type="typens:abServerPortType"> | ||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> | ||
<operation name="f"> | ||
<soap:operation soapAction="urn:abServerAction"/> | ||
<input> | ||
<soap:body namespace="urn:ab" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> | ||
</input> | ||
<output> | ||
<soap:body namespace="urn:ab" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> | ||
</output> | ||
</operation> | ||
</binding> | ||
<service name="abService"> | ||
<port name="abServerPort" binding="typens:abServerBinding"> | ||
<soap:address location="http://localhost/abServer.php"/> | ||
</port> | ||
</service> | ||
</definitions> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--TEST-- | ||
SOAP Classmap 7: encoding of inherited objects with namespace and cache wsdl | ||
--EXTENSIONS-- | ||
soap | ||
--FILE-- | ||
<?php | ||
ini_set("soap.wsdl_cache_enabled",1); | ||
|
||
class A { | ||
public $x; | ||
function __construct($a){ | ||
$this->x = $a; | ||
} | ||
} | ||
class Attest { | ||
public $x; | ||
function __construct($a){ | ||
$this->x = $a; | ||
} | ||
} | ||
class B extends A { | ||
public $y; | ||
function __construct($a){ | ||
parent::__construct($a); | ||
$this->y = $a + 1; | ||
} | ||
} | ||
|
||
function f($input){ | ||
return new B(5); | ||
} | ||
|
||
class LocalSoapClient extends SoapClient { | ||
private $server; | ||
|
||
function __construct($wsdl, $options) { | ||
parent::__construct($wsdl, $options); | ||
$this->server = new SoapServer($wsdl, $options); | ||
$this->server->addFunction("f"); | ||
} | ||
|
||
function __doRequest($request, $location, $action, $version, $one_way = 0): ?string { | ||
ob_start(); | ||
$this->server->handle($request); | ||
$response = ob_get_contents(); | ||
ob_end_clean(); | ||
return $response; | ||
} | ||
} | ||
|
||
$client = new LocalSoapClient(__DIR__."/classmap007.wsdl", | ||
array('classmap'=>array('A'=>'A','{urn:abt}At'=>'Attest','B'=>'B'))); | ||
print_r($client->f(new Attest('test'))); | ||
print_r($client->f(new Attest('test'))); | ||
?> | ||
--EXPECT-- | ||
B Object | ||
( | ||
[x] => 5 | ||
[y] => 6 | ||
) | ||
B Object | ||
( | ||
[x] => 5 | ||
[y] => 6 | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.