Skip to content

Commit 47389e3

Browse files
committed
+1 test
1 parent ed2346d commit 47389e3

File tree

4 files changed

+64
-18
lines changed

4 files changed

+64
-18
lines changed

ext/soap/tests/wss/T01.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
SOAP CLIENT WSS: WSS 1.0 SHA1 echo
2+
SOAP CLIENT WSS: SOAP 1.1 / WSS 1.0 SHA1 echo
33
--EXTENSIONS--
44
soap
55
--INI--

ext/soap/tests/wss/T04.phpt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
SOAP CLIENT WSS: WSS 1.1 SHA256 with timestamp and random id echo
2+
SOAP CLIENT WSS: SOAP 1.2 / WSS 1.1 SHA256 with timestamp and random id echo
33
--EXTENSIONS--
44
soap
55
--INI--
@@ -8,7 +8,9 @@ soap.wsdl_cache_enabled=0
88
<?php
99
include __DIR__.DIRECTORY_SEPARATOR."wss-test.inc";
1010

11-
$client = new LocalSoapClient(__DIR__.DIRECTORY_SEPARATOR."wss-test.wsdl");
11+
$client = new LocalSoapClient(__DIR__.DIRECTORY_SEPARATOR."wss-test.wsdl",array(
12+
"soap_version" => SOAP_1_2
13+
));
1214

1315
$client->__setWSS(array(
1416
"add_timestamp" => true,
@@ -28,26 +30,26 @@ $client->testFunction(array(
2830
?>
2931
--EXPECTF--
3032
<?xml version="1.0" encoding="UTF-8"?>
31-
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
32-
%w<SOAP-ENV:Header>
33-
%w<wsse11:Security SOAP-ENV:mustUnderstand="1">
34-
%w<wsu:Timestamp wsu:Id="TimestampID-%i">
35-
%w<wsu:Created>%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c</wsu:Created>
36-
%w<wsu:Expires>%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c</wsu:Expires>
33+
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://localhost/" xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
34+
%w<env:Header>
35+
%w<wsse11:Security env:mustUnderstand="true">
36+
%w<wsu:Timestamp wsu:Id="TimestampID-%d">
37+
%w<wsu:Created>%r([0-9]{4})%r-%r([0-9]{2})%r-%r([0-9]{2})%rT%r([0-9]{2})%r:%r([0-9]{2})%r:%r([0-9]{2})%rZ</wsu:Created>
38+
%w<wsu:Expires>%r([0-9]{4})%r-%r([0-9]{2})%r-%r([0-9]{2})%rT%r([0-9]{2})%r:%r([0-9]{2})%r:%r([0-9]{2})%rZ</wsu:Expires>
3739
%w</wsu:Timestamp>
38-
%w<wsse11:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="TokenID-%i">%s</wsse11:BinarySecurityToken>
40+
%w<wsse11:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="TokenID-%d">%s</wsse11:BinarySecurityToken>
3941
%w<ds:Signature>
4042
%w<ds:SignedInfo>
4143
%w<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
4244
%w<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
43-
%w<ds:Reference URI="#TimestampID-%i">
45+
%w<ds:Reference URI="#TimestampID-%d">
4446
%w<ds:Transforms>
4547
%w<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
4648
%w</ds:Transforms>
4749
%w<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
4850
%w<ds:DigestValue>%s</ds:DigestValue>
4951
%w</ds:Reference>
50-
%w<ds:Reference URI="#BodyID-%i">
52+
%w<ds:Reference URI="#BodyID-%d">
5153
%w<ds:Transforms>
5254
%w<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
5355
%w</ds:Transforms>
@@ -58,16 +60,16 @@ $client->testFunction(array(
5860
%w<ds:SignatureValue>%s</ds:SignatureValue>
5961
%w<ds:KeyInfo>
6062
%w<wsse11:SecurityTokenReference>
61-
%w<wsse11:Reference URI="#TokenID-%i" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
63+
%w<wsse11:Reference URI="#TokenID-%d" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
6264
%w</wsse11:SecurityTokenReference>
6365
%w</ds:KeyInfo>
6466
%w</ds:Signature>
6567
%w</wsse11:Security>
66-
%w</SOAP-ENV:Header>
67-
%w<SOAP-ENV:Body wsu:Id="BodyID-%i">
68+
%w</env:Header>
69+
%w<env:Body wsu:Id="BodyID-%d">
6870
%w<ns1:testFunctionIn>
6971
%w<ns1:Param1>foo</ns1:Param1>
7072
%w<ns1:Param2>bar</ns1:Param2>
7173
%w</ns1:testFunctionIn>
72-
%w</SOAP-ENV:Body>
73-
</SOAP-ENV:Envelope>
74+
%w</env:Body>
75+
</env:Envelope>

ext/soap/tests/wss/T05.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
SOAP CLIENT WSS: WSS 1.1 SHA512 with additional header echo
2+
SOAP CLIENT WSS: SOAP 1.1 / WSS 1.1 SHA512 with additional header echo
33
--EXTENSIONS--
44
soap
55
--INI--

ext/soap/tests/wss/T06.phpt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
SOAP CLIENT WSS: Only additional headers, no WSS headers echo
3+
--EXTENSIONS--
4+
soap
5+
--INI--
6+
soap.wsdl_cache_enabled=0
7+
--FILE--
8+
<?php
9+
include __DIR__.DIRECTORY_SEPARATOR."wss-test.inc";
10+
11+
$client = new LocalSoapClient(__DIR__.DIRECTORY_SEPARATOR."wss-test.wsdl");
12+
13+
$client->__setSoapHeaders(array(
14+
new SoapHeader(
15+
'http://localhost/header/',
16+
'TestHeader1',
17+
'Hello'
18+
),
19+
new SoapHeader(
20+
'http://localhost/header/',
21+
'TestHeader2',
22+
'World'
23+
),
24+
));
25+
26+
$client->testFunction(array(
27+
"Param1" => "foo",
28+
"Param2" => "bar"
29+
));
30+
?>
31+
--EXPECTF--
32+
<?xml version="1.0" encoding="UTF-8"?>
33+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/" xmlns:ns2="http://localhost/header/">
34+
%w<SOAP-ENV:Header>
35+
%w<ns2:TestHeader1>Hello</ns2:TestHeader1>
36+
%w<ns2:TestHeader2>World</ns2:TestHeader2>
37+
%w</SOAP-ENV:Header>
38+
%w<SOAP-ENV:Body>
39+
%w<ns1:testFunctionIn>
40+
%w<ns1:Param1>foo</ns1:Param1>
41+
%w<ns1:Param2>bar</ns1:Param2>
42+
%w</ns1:testFunctionIn>
43+
%w</SOAP-ENV:Body>
44+
</SOAP-ENV:Envelope>

0 commit comments

Comments
 (0)