Re: SOAPClient authentication problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24.07.2009, at 12:48, David Zülke wrote:

Yes, thanks, I realize that, but I need to test it in a .phpt unit test, which is a bit trickier. But as I said, I already have an idea. Will do it this later and open a ticket.

Issue: http://bugs.php.net/49144
.phpt: http://pastie.org/569897 (also attached)

- David

--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

"



Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux