1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--TEST--
Bug #49144 (import of schemas from different hosts transmits original authentication details)
--SKIPIF--
<?php
require_once('skipif.inc');
###
### THIS RE-USES TESTING CODE FROM ext/standard/tests/http/, BEWARE
###
require dirname(__FILE__) . '../../../../standard/tests/http/server.inc'; http_server_skipif('tcp://127.0.0.1:12342'); ?>
?>
--FILE--
<?php
###
### THIS RE-USES TESTING CODE FROM ext/standard/tests/http/, BEWARE
###
require dirname(__FILE__) . '../../../../standard/tests/http/server.inc';

$responses = array(
	"data://text/plain,HTTP/1.1 200 OK\r\nContent-Type: application/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 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="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://agavi.org/sampleapp/types" xmlns:asa="http://agavi.org/sampleapp" name="AgaviSampleApplication" targetNamespace="http://agavi.org/sampleapp">
	<wsdl:types>
		<xsd:schema xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://agavi.org/agavi/config/parts/routing/1.0" targetNamespace="http://agavi.org/sampleapp/types">
			<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://localhost:12342/xml.xsd"/>
			<xsd:complexType name="Product">
				<xsd:sequence>
					<xsd:element name="id" type="xsd:int"/>
					<xsd:element name="name" type="xsd:string"/>
					<xsd:element name="price" type="xsd:float"/>
				</xsd:sequence>
			</xsd:complexType>
		</xsd:schema>
	</wsdl:types>
	<wsdl:portType name="AgaviSampleApplicationPortType">
		<wsdl:operation name="getProduct">
			<wsdl:input message="asa:getProductRequest"/>
			<wsdl:output message="asa:getProductResponse"/>
		</wsdl:operation>
	</wsdl:portType>
	<binding name="AgaviSampleApplicationBinding" type="asa:AgaviSampleApplicationPortType">
		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="getProduct">
			<soap:operation soapAction="http://agavi.org/sampleapp#getProduct"/>
			<wsdl:input>
				<soap:body namespace="http://agavi.org/sampleapp" use="literal"/>
			</wsdl:input>
			<wsdl:output>
				<soap:body namespace="http://agavi.org/sampleapp" use="literal"/>
			</wsdl:output>
		</wsdl:operation>
	</binding>
	<service name="AgaviSampleApplicationService">
		<port name="AgaviSampleApplicationPort" binding="asa:AgaviSampleApplicationBinding">
			<soap:address location="http://localhost/YOUR/PATH/TO/samples/pub/soap.php"/>
		</port>
	</service>
	<wsdl:message name="getProductRequest">
		<wsdl:part xmlns="http://agavi.org/agavi/config/parts/routing/1.0" name="id" type="xsd:int"/>
	</wsdl:message>
	<wsdl:message name="getProductResponse">
		<wsdl:part xmlns="http://agavi.org/agavi/config/parts/routing/1.0" name="product" type="tns:Product"/>
	</wsdl:message>
</wsdl:definitions>',
	"data://text/plain,HTTP/1.1 200 OK\r\nContent-Type: application/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<xs:attribute name="base" type="xs:anyURI" />
</xs:schema>',
);

$pid = http_server("tcp://127.0.0.1:12342", $responses, $output);

ini_set("soap.wsdl_cache_enabled", 0);
$client = new SoapClient("http://127.0.0.1:12342/bug.wsdl", array('login' => 'foo', 'password' => 'bar'));

fseek($output, 0, SEEK_SET);
var_dump(stream_get_contents($output));

http_server_kill($pid);

?>
--EXPECTF--
string(%s) "GET /bug.wsdl HTTP/1.1
Host: 127.0.0.1:12342
Authorization: Basic Zm9vOmJhcg==
Connection: close

GET /xml.xsd HTTP/1.1
Host: localhost:12342
Connection: close

"