php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50698 SoapClient should handle wsdls with some incompatiable endpoints
Submitted: 2010-01-08 21:19 UTC Modified: 2010-05-05 09:44 UTC
Votes:5
Avg. Score:4.4 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:4 (100.0%)
Same OS:4 (100.0%)
From: zippy1981 at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: *General Issues
PHP Version: 5.2.12, 5.3.1 OS: Windows XP/7 and probably all.
Private report: No CVE-ID: None
 [2010-01-08 21:19 UTC] zippy1981 at gmail dot com
Description:
------------
I have a WCF web service written in .NET that has different endpoints. I 
want .NET clients to be able to talk to it using nettcp (a propietary 
microsoft protocol) and PHP to be able to talk to it using basicHttp 
(soap 1.1). However, if WSDL contains any endpoints other than http or 
https endpoints I get the following error:

PHP Fatal error:  SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support 
transport 'http://schemas.microsoft.com/soap/tcp'

I think the following should occur:

If no endpoint is explicitly specified in the constructor, PHP should 
pick the first compatible endpoint available in the wsdl and use it. If 
the endpoint is explicitly declared in the constructor, then PHP should 
not care about the available endpoints.

Reproduce code:
---------------
<?php
// .NET Service that this calls exists at http://github.com/zippy1981/EchoService
$client = new SoapClient
        ('http://localhost:8731/EchoService/?wsdl',
         array(
                'location' => 'http://localhost:8731/EchoService/Basic',
                'trace' => true,
                'soap_version' => SOAP_1_1,
                'connection_timeout' => 5
        )
);

echo $client->echo(array('request' => "Hello World"))->EchoResult;
?>

Expected result:
----------------
c:\php\php.exe EchoClient.php
Hello World

Actual result:
--------------
PHP Fatal error:  SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support 
transport 'http://schemas.microsoft.com/soap/tcp'

Patches

BugTestImprovedv2 (last revision 2010-04-30 21:59 UTC by zippy1981 at gmail dot com)
BugTestImproved (last revision 2010-04-06 12:49 UTC by zippy1981 at gmail dot com)
BugTest (last revision 2010-04-05 15:26 UTC by zippy1981 at gmail dot com)
non-http-endpoint-handling (last revision 2010-04-02 18:47 UTC by zippy1981 at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-08 21:52 UTC] zippy1981 at gmail dot com
I also reported this on stack overflow. If anyone has any suggestions 
for workarounds, especially if there workaround on the .NET side feel 
free to post them there.


http://stackoverflow.com/questions/1933213/connecting-to-a-wcf-service-
in-php-that-has-a-a-nettcp-binding-and-a-basichttpbin
 [2010-01-10 22:10 UTC] zippy1981 at gmail dot com
Also verified to break on 5.3.1.
 [2010-01-12 21:49 UTC] zippy1981 at gmail dot com
Verified on Windows 7 as well.
 [2010-01-13 14:41 UTC] srinatar@php.net
as far as I understand, Microsoft TCP transport spec is a private 
interface for communicating between .Net server/clients. I would expect 
that you will need SOAP/TCP as end point for communicating between php 
client and .Net server. 

Af course,my knowledge might be outdated on this. 
 [2010-01-13 15:05 UTC] zippy1981 at gmail dot com
It seems I was not clear in my original ticket.

My soap service has two end points. One is http (soap 1.1). The other 
is nettcp, microsoft private protocol.

PHP throws an error when I parse the WSDL simply because it contains 
an endpoint it can't connect to. This is in spite of the following 
four facts:

1) There is a http endpoint it knows how to connect to in the WSDL
2) I override the WSDL endpoints in the soap constructor.
3) A soap client only needs to connect to one endpoint in a WSDL to 
communicate with it

If I manually edit the WSDL so that the nettcp endpoint is no longer 
advertised, but it still exists, PHP will connect to it fine.
 [2010-01-13 20:29 UTC] srinatar@php.net
thanks for the clarification. if you can provide a test case /script , it would help us to work on this. thanks again for taking time for following up on this. your help will definitely help PHP make better !
 [2010-01-13 20:59 UTC] zippy1981 at gmail dot com
Thanks for your reply.

On my initial report I posted an example client. In a comment in the 
example client is a link to a github repo with a .NET web service that 
causes this issue (e.g. config file was bound to nettcp):

http://github.com/zippy1981/EchoService

Inside the .net service is also a copy of the PHP client.

The .NET code can be compiled on any windows machine with the free IDE 
SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/Download/)

I can provide a manually generated wsdl  with false endpoints if needed. 
I'll gladly help test a fix or provide a mock if needed.
 [2010-04-02 17:29 UTC] zippy1981 at gmail dot com
-Package: Feature/Change Request +Package: *General Issues
 [2010-04-02 17:29 UTC] zippy1981 at gmail dot com
Below is a patch that helps to fix the behavior. The following problems remain:

1) If the wsdl contains only non http endpoints, and the location parameter is 
not specified, a proper error message is not generated.
2) If the wsdl contains only non http endpoints, and the location parameter is 
specified, the error "Uncaught SoapFault exception: [Client] Function ("echo") 
is not a valid method for this service in File.php:21" is displayed.


Index: ext/soap/php_sdl.c
===================================================================
--- ext/soap/php_sdl.c	(revision 297339)
+++ ext/soap/php_sdl.c	(working copy)
@@ -832,7 +832,12 @@
 							if (strncmp((char*)tmp-
>children->content, WSDL_HTTP_TRANSPORT, sizeof(WSDL_HTTP_TRANSPORT)) == 0) {
 								soapBinding-
>transport = SOAP_TRANSPORT_HTTP;
 							} else {
-								
soap_error1(E_ERROR, "Parsing WSDL: PHP-SOAP doesn't support transport '%s'", 
tmp->children->content);
+								// Since this is 
an E_NOTICE severity message, it will disappear into the ether.
+								
soap_error1(E_NOTICE, "Parsing WSDL: PHP-SOAP doesn't support transport '%s'", 
tmp->children->content);
+								
efree(soapBinding);
+								
efree(tmpbinding);
+								trav = trav-
>next;
+								continue;
 							}
 						}
 					}
 [2010-04-02 20:48 UTC] zippy1981 at gmail dot com
Submitted a new patch with error handling.
 [2010-04-02 20:51 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2010-05-05 09:43 UTC] dmitry@php.net
Automatic comment from SVN on behalf of dmitry
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=299013
Log: Fixed bug #50698 (SoapClient should handle wsdls with some incompatiable endpoints). (Justin Dearing)
 [2010-05-05 09:44 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2010-05-05 09:44 UTC] dmitry@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC