SOAPClient authentication problem

View: New views
9 Messages — Rating Filter:   Alert me  

SOAPClient authentication problem

by Davide Romanini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Today I found a nasty problem with a simple php SOAP client. Never had
problems before, but today I have the following error at SOAPClient
constructor line:

SoapClient::SoapClient(http://www.w3.org/2001/xml.xsd): failed to open
stream: HTTP request failed! HTTP/1.1 401 Authorization Required

The source is as simple as:

$client = new SoapClient("http://my.host.com/my_web_service?wsdl",
                         array( 'trace' => TRUE,
                                'login'=>'mylogin',
                                'password'=>'secret'
                              )
                        );

It seems that the php xml parser tries to fetch the url
http://www.w3.org/2001/xml.xsd at wsdl parsing time. Sniffing the
network operations I found that php uses my login and password (for the
web service) also to access external references! :-O

GET /2001/xml.xsd HTTP/1.0
Authorization: Basic bXlsb2dpbjpzZWNyZXQ=
Host: www.w3.org

In the past probably w3.org just ignored the issue, but now I receive an
HTTP 401 Unauthorized error in response...

In any case it is a serious security issue if SOAPClient sends password
around the web, when the intent is that they are used only for the web
service host!

I tried the following PHP versions:

PHP 5.2.3-1ubuntu6.5 (cli) (built: Feb 11 2009 19:55:53)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

PHP 5.2.8 (cli) (built: Dec 17 2008 00:54:27)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by
Zend Technologies
    with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend
Technologies
    with Zend Debugger v5.2.2, Copyright (c) 1999-2006, by Zend Technologies


Regards,
Davide

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Fwd: SOAPClient authentication problem

by David Zülke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This sounds like a serious issue, but I'm not sure if it's in libxml  
or in ext/soap. Will have a look later; but maybe Dmitry or someone  
else knows off the top of their heads?

- David


Begin forwarded message:

> From: Davide Romanini <davide.romanini@...>
> Date: 30. Juni 2009 11:49:30 MESZ
> To: soap@...
> Subject: [SOAP] SOAPClient authentication problem
> Reply-To: d.romanini@...
>
> Hi,
>
> Today I found a nasty problem with a simple php SOAP client. Never had
> problems before, but today I have the following error at SOAPClient
> constructor line:
>
> SoapClient::SoapClient(http://www.w3.org/2001/xml.xsd): failed to open
> stream: HTTP request failed! HTTP/1.1 401 Authorization Required
>
> The source is as simple as:
>
> $client = new SoapClient("http://my.host.com/my_web_service?wsdl",
>                         array( 'trace' => TRUE,
>                                'login'=>'mylogin',
>                                'password'=>'secret'
>                              )
>                        );
>
> It seems that the php xml parser tries to fetch the url
> http://www.w3.org/2001/xml.xsd at wsdl parsing time. Sniffing the
> network operations I found that php uses my login and password (for  
> the
> web service) also to access external references! :-O
>
> GET /2001/xml.xsd HTTP/1.0
> Authorization: Basic bXlsb2dpbjpzZWNyZXQ=
> Host: www.w3.org
>
> In the past probably w3.org just ignored the issue, but now I  
> receive an
> HTTP 401 Unauthorized error in response...
>
> In any case it is a serious security issue if SOAPClient sends  
> password
> around the web, when the intent is that they are used only for the web
> service host!
>
> I tried the following PHP versions:
>
> PHP 5.2.3-1ubuntu6.5 (cli) (built: Feb 11 2009 19:55:53)
> Copyright (c) 1997-2007 The PHP Group
> Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
>
> PHP 5.2.8 (cli) (built: Dec 17 2008 00:54:27)
> Copyright (c) 1997-2008 The PHP Group
> Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
>    with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by
> Zend Technologies
>    with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend
> Technologies
>    with Zend Debugger v5.2.2, Copyright (c) 1999-2006, by Zend  
> Technologies
>
>
> Regards,
> Davide
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


smime.p7s (3K) Download Attachment

Re: Fwd: SOAPClient authentication problem

by Dmitry Stogov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi David,

Please report a bug on bugs.php.net (assign it to dmitry).
I'll look into it later.

Thanks. Dmitry.

David Zülke wrote:

> This sounds like a serious issue, but I'm not sure if it's in libxml or
> in ext/soap. Will have a look later; but maybe Dmitry or someone else
> knows off the top of their heads?
>
> - David
>
>
> Begin forwarded message:
>
>> From: Davide Romanini <davide.romanini@...>
>> Date: 30. Juni 2009 11:49:30 MESZ
>> To: soap@...
>> Subject: [SOAP] SOAPClient authentication problem
>> Reply-To: d.romanini@...
>>
>> Hi,
>>
>> Today I found a nasty problem with a simple php SOAP client. Never had
>> problems before, but today I have the following error at SOAPClient
>> constructor line:
>>
>> SoapClient::SoapClient(http://www.w3.org/2001/xml.xsd): failed to open
>> stream: HTTP request failed! HTTP/1.1 401 Authorization Required
>>
>> The source is as simple as:
>>
>> $client = new SoapClient("http://my.host.com/my_web_service?wsdl",
>>                         array( 'trace' => TRUE,
>>                                'login'=>'mylogin',
>>                                'password'=>'secret'
>>                              )
>>                        );
>>
>> It seems that the php xml parser tries to fetch the url
>> http://www.w3.org/2001/xml.xsd at wsdl parsing time. Sniffing the
>> network operations I found that php uses my login and password (for the
>> web service) also to access external references! :-O
>>
>> GET /2001/xml.xsd HTTP/1.0
>> Authorization: Basic bXlsb2dpbjpzZWNyZXQ=
>> Host: www.w3.org
>>
>> In the past probably w3.org just ignored the issue, but now I receive an
>> HTTP 401 Unauthorized error in response...
>>
>> In any case it is a serious security issue if SOAPClient sends password
>> around the web, when the intent is that they are used only for the web
>> service host!
>>
>> I tried the following PHP versions:
>>
>> PHP 5.2.3-1ubuntu6.5 (cli) (built: Feb 11 2009 19:55:53)
>> Copyright (c) 1997-2007 The PHP Group
>> Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
>>
>> PHP 5.2.8 (cli) (built: Dec 17 2008 00:54:27)
>> Copyright (c) 1997-2008 The PHP Group
>> Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
>>    with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by
>> Zend Technologies
>>    with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend
>> Technologies
>>    with Zend Debugger v5.2.2, Copyright (c) 1999-2006, by Zend
>> Technologies
>>
>>
>> Regards,
>> Davide
>>
>> --
>> PHP Soap Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: SOAPClient authentication problem

by David Zülke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can do, but I wanted to figure out a way to create a reproduce case  
first (I already have an idea).

- David



On 24.07.2009, at 12:20, Dmitry Stogov wrote:

> Hi David,
>
> Please report a bug on bugs.php.net (assign it to dmitry).
> I'll look into it later.
>
> Thanks. Dmitry.
>
> David Zülke wrote:
>> This sounds like a serious issue, but I'm not sure if it's in  
>> libxml or
>> in ext/soap. Will have a look later; but maybe Dmitry or someone else
>> knows off the top of their heads?
>>
>> - David
>>
>>
>> Begin forwarded message:
>>
>>> From: Davide Romanini <davide.romanini@...>
>>> Date: 30. Juni 2009 11:49:30 MESZ
>>> To: soap@...
>>> Subject: [SOAP] SOAPClient authentication problem
>>> Reply-To: d.romanini@...
>>>
>>> Hi,
>>>
>>> Today I found a nasty problem with a simple php SOAP client. Never  
>>> had
>>> problems before, but today I have the following error at SOAPClient
>>> constructor line:
>>>
>>> SoapClient::SoapClient(http://www.w3.org/2001/xml.xsd): failed to  
>>> open
>>> stream: HTTP request failed! HTTP/1.1 401 Authorization Required
>>>
>>> The source is as simple as:
>>>
>>> $client = new SoapClient("http://my.host.com/my_web_service?wsdl",
>>>                        array( 'trace' => TRUE,
>>>                               'login'=>'mylogin',
>>>                               'password'=>'secret'
>>>                             )
>>>                       );
>>>
>>> It seems that the php xml parser tries to fetch the url
>>> http://www.w3.org/2001/xml.xsd at wsdl parsing time. Sniffing the
>>> network operations I found that php uses my login and password  
>>> (for the
>>> web service) also to access external references! :-O
>>>
>>> GET /2001/xml.xsd HTTP/1.0
>>> Authorization: Basic bXlsb2dpbjpzZWNyZXQ=
>>> Host: www.w3.org
>>>
>>> In the past probably w3.org just ignored the issue, but now I  
>>> receive an
>>> HTTP 401 Unauthorized error in response...
>>>
>>> In any case it is a serious security issue if SOAPClient sends  
>>> password
>>> around the web, when the intent is that they are used only for the  
>>> web
>>> service host!
>>>
>>> I tried the following PHP versions:
>>>
>>> PHP 5.2.3-1ubuntu6.5 (cli) (built: Feb 11 2009 19:55:53)
>>> Copyright (c) 1997-2007 The PHP Group
>>> Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
>>>
>>> PHP 5.2.8 (cli) (built: Dec 17 2008 00:54:27)
>>> Copyright (c) 1997-2008 The PHP Group
>>> Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
>>>   with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by
>>> Zend Technologies
>>>   with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend
>>> Technologies
>>>   with Zend Debugger v5.2.2, Copyright (c) 1999-2006, by Zend
>>> Technologies
>>>
>>>
>>> Regards,
>>> Davide
>>>
>>> --
>>> PHP Soap Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>


smime.p7s (3K) Download Attachment

Re: SOAPClient authentication problem

by Davide Romanini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Zülke ha scritto:

> Can do, but I wanted to figure out a way to create a reproduce case
> first (I already have an idea).
>
> - David
>
>
>
> On 24.07.2009, at 12:20, Dmitry Stogov wrote:
>
>> Hi David,
>>
>> Please report a bug on bugs.php.net (assign it to dmitry).
>> I'll look into it later.
>>
>> Thanks. Dmitry.
>>
>> David Zülke wrote:
>>> This sounds like a serious issue, but I'm not sure if it's in libxml or
>>> in ext/soap. Will have a look later; but maybe Dmitry or someone else
>>> knows off the top of their heads?
>>>
>>> - David
>>>
>>>
>>> Begin forwarded message:
>>>
>>>> From: Davide Romanini <davide.romanini@...>
>>>> Date: 30. Juni 2009 11:49:30 MESZ
>>>> To: soap@...
>>>> Subject: [SOAP] SOAPClient authentication problem
>>>> Reply-To: d.romanini@...
>>>>
>>>> Hi,
>>>>
>>>> Today I found a nasty problem with a simple php SOAP client. Never had
>>>> problems before, but today I have the following error at SOAPClient
>>>> constructor line:
>>>>
>>>> SoapClient::SoapClient(http://www.w3.org/2001/xml.xsd): failed to open
>>>> stream: HTTP request failed! HTTP/1.1 401 Authorization Required
>>>>
>>>> The source is as simple as:
>>>>
>>>> $client = new SoapClient("http://my.host.com/my_web_service?wsdl",
>>>>                        array( 'trace' => TRUE,
>>>>                               'login'=>'mylogin',
>>>>                               'password'=>'secret'
>>>>                             )
>>>>                       );
>>>>
>>>> It seems that the php xml parser tries to fetch the url
>>>> http://www.w3.org/2001/xml.xsd at wsdl parsing time. Sniffing the
>>>> network operations I found that php uses my login and password (for the
>>>> web service) also to access external references! :-O
>>>>
>>>> GET /2001/xml.xsd HTTP/1.0
>>>> Authorization: Basic bXlsb2dpbjpzZWNyZXQ=
>>>> Host: www.w3.org
>>>>
>>>> In the past probably w3.org just ignored the issue, but now I
>>>> receive an
>>>> HTTP 401 Unauthorized error in response...
>>>>
>>>> In any case it is a serious security issue if SOAPClient sends password
>>>> around the web, when the intent is that they are used only for the web
>>>> service host!
>>>>
>>>> I tried the following PHP versions:
>>>>
>>>> PHP 5.2.3-1ubuntu6.5 (cli) (built: Feb 11 2009 19:55:53)
>>>> Copyright (c) 1997-2007 The PHP Group
>>>> Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
>>>>
>>>> PHP 5.2.8 (cli) (built: Dec 17 2008 00:54:27)
>>>> Copyright (c) 1997-2008 The PHP Group
>>>> Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
>>>>   with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by
>>>> Zend Technologies
>>>>   with Zend Optimizer v3.2.0, Copyright (c) 1998-2006, by Zend
>>>> Technologies
>>>>   with Zend Debugger v5.2.2, Copyright (c) 1999-2006, by Zend
>>>> Technologies
>>>>
>>>>
>>>> Regards,
>>>> Davide
>>>>
>>>> --
>>>> PHP Soap Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>
>>
>

It's really simple to reproduce. Take this example wsdl:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:sch="http://mycompany.com/hr/schemas"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://mycompany.com/hr/schemas"
targetNamespace="http://mycompany.com/hr/schemas">
  <wsdl:types>
    <xs:schema xmlns:hr="http://mycompany.com/hr/schemas"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
targetNamespace="http://mycompany.com/hr/schemas">
    <xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>

    <xs:element name="HolidayRequest">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="hr:Holiday"/>
                <xs:element ref="hr:Employee"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Holiday">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="hr:StartDate"/>
                <xs:element ref="hr:EndDate"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="StartDate" type="xs:NMTOKEN"/>
    <xs:element name="EndDate" type="xs:NMTOKEN"/>
    <xs:element name="Employee">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="hr:Number"/>
                <xs:element ref="hr:FirstName"/>
                <xs:element ref="hr:LastName"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="Number" type="xs:integer"/>
    <xs:element name="FirstName" type="xs:NCName"/>
    <xs:element name="LastName" type="xs:NCName"/>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="HolidayRequest">
    <wsdl:part element="tns:HolidayRequest" name="HolidayRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="holidayPortType">
    <wsdl:operation name="Holiday">
      <wsdl:input message="tns:HolidayRequest" name="HolidayRequest">
    </wsdl:input>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="holidayPortTypeSoap11" type="tns:holidayPortType">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="Holiday">
      <soap:operation soapAction=""/>
      <wsdl:input name="HolidayRequest">
        <soap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="holidayService">
    <wsdl:port binding="tns:holidayPortTypeSoap11"
name="holidayPortTypeSoap11">
      <soap:address/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


The important part is

<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/xml.xsd"/>

I just copied this file in my local apache doc root and tried to run
this script:

<?php
$client = new SoapClient("http://localhost/test/holiday.wsdl",
                       array( 'trace' => TRUE,
                              'login'=>'mylogin',
                              'password'=>'secret'
                            )
                      );
?>

And the output is:

Warning: SoapClient::SoapClient(http://www.w3.org/2001/xml.xsd): failed
to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required
 in /home/romaz/tmp/soapFail.php on line 7

Warning: SoapClient::SoapClient(): I/O warning : failed to load external
entity "http://www.w3.org/2001/xml.xsd" in /home/romaz/tmp/soapFail.php
on line 7

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing
Schema: can't import schema from 'http://www.w3.org/2001/xml.xsd' in
/home/romaz/tmp/soapFail.php:7
Stack trace:
#0 /home/romaz/tmp/soapFail.php(7):
SoapClient->SoapClient('http://localhos...', Array)
#1 {main}
  thrown in /home/romaz/tmp/soapFail.php on line 7

Note that login and password here are completely useless, because on my
local apache I haven't any access restriction.

Bye,
Davide

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: SOAPClient authentication problem

by David Zülke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 24.07.2009, at 12:45, Davide Romanini wrote:

> David Zülke ha scritto:
>> Can do, but I wanted to figure out a way to create a reproduce case
>> first (I already have an idea).
>>
>> - David
>>
>>
>>
>> On 24.07.2009, at 12:20, Dmitry Stogov wrote:
>>
>>> Hi David,
>>>
>>> Please report a bug on bugs.php.net (assign it to dmitry).
>>> I'll look into it later.
>>>
>>> Thanks. Dmitry.
>>>
>>> David Zülke wrote:
>>>> This sounds like a serious issue, but I'm not sure if it's in  
>>>> libxml or
[ 8< ]

> It's really simple to reproduce. Take this example wsdl:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:sch="http://mycompany.com/hr/schemas"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://mycompany.com/hr/schemas"
> targetNamespace="http://mycompany.com/hr/schemas">
>  <wsdl:types>
>    <xs:schema xmlns:hr="http://mycompany.com/hr/schemas"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified"
> targetNamespace="http://mycompany.com/hr/schemas">
>    <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="http://www.w3.org/2001/xml.xsd"/>
[ 8< ]

> </wsdl:definitions>
>
>
> The important part is
>
> <xs:import namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="http://www.w3.org/2001/xml.xsd"/>
>
> I just copied this file in my local apache doc root and tried to run
> this script:
>
> <?php
> $client = new SoapClient("http://localhost/test/holiday.wsdl",
>                       array( 'trace' => TRUE,
>                              'login'=>'mylogin',
>                              'password'=>'secret'
>                            )
>                      );
> ?>
>
> And the output is:
>
> Warning: SoapClient::SoapClient(http://www.w3.org/2001/xml.xsd): 
> failed
> to open stream: HTTP request failed! HTTP/1.1 401 Authorization  
> Required
> in /home/romaz/tmp/soapFail.php on line 7
>
> Warning: SoapClient::SoapClient(): I/O warning : failed to load  
> external
> entity "http://www.w3.org/2001/xml.xsd" in /home/romaz/tmp/
> soapFail.php
> on line 7
>
> Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing
> Schema: can't import schema from 'http://www.w3.org/2001/xml.xsd' in
> /home/romaz/tmp/soapFail.php:7
> Stack trace:
> #0 /home/romaz/tmp/soapFail.php(7):
> SoapClient->SoapClient('http://localhos...', Array)
> #1 {main}
>  thrown in /home/romaz/tmp/soapFail.php on line 7
>
> Note that login and password here are completely useless, because on  
> my
> local apache I haven't any access restriction.
>
> Bye,
> Davide
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.

- David




smime.p7s (3K) Download Attachment

Re: SOAPClient authentication problem

by David Zülke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

"





smime.p7s (3K) Download Attachment

Re: SOAPClient authentication problem

by David Zülke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 (tried to attach it but the message  
didn't make it through)

- David


--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: SOAPClient authentication problem

by David Zülke-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

I finally got around to writing a test case and opening a ticket  
(which contains the .phpt): http://bugs.php.net/49144

Cheers,

- David



smime.p7s (3K) Download Attachment