Couple of days back, I blogged about the features of SOAP extension. Now, are these features good enough. Yes they sure are for simple SOAP services.
However, simple SOAP services draws much criticism, specially form REST fans. If you want to do only simple stuff with SOAP, why not use REST? I see that to be a valid argument, especially in the PHP world, given that HTTP is the dominant transport.
In fact, the real value of SOAP comes, when things get complex, more enterprise in nature. That is where the QoS comes into play. SOAP is not that much useful, when you want to use the Fliker upload images, you of course and use the REST API. SOAP is useful when you want to send an invoice, that contains special discounted rates, securely to one of your customers. You have to be absolutely sure that only that customer sees it. And may be you are using a spread sheet or a PDF file to record the invoice and you want to send it as it is. This requires the need to send binary attachment with security with SOAP. And if you are lucky, your customer's system too would use PHP, however, in this heterogeneous world, it may well be that the customer is on .NET or using J2EE. In short, you need a interoperable comprehensive SOAP stack.
PHP SOAP extension is good to get started, to play around with. However, it falls much short in meeting the enterprise demands in the SOA era.
Can you improve it, to support security and binary attachments? Of course you can. However, the concern is that the time it would take to make it interop side by side with .NET and Java implementations. They have taken years to come to that stage. I have seen how much effort has been spent on Apache Axis2/Java and Apache Axis2/C. Even if you have people with right expertise, WS-Security alone would take at least two person years to complete.
It is the WSDL mode that most users love to use. And if you ever have worked with a WSDL tool, you know how hectic it is to support all the user scenarios. Specially the schema support is an endless game. Most of the interop issues pop up with WSDLs. WSDL mode in SOAP extension already have enough interop issues. And there are no plans to support WSDL 2.0. Let alone, the most critical feature to support in WSDL is the WS-Policy support. Specially when WS-Security in in use, the security policies are the way of conveying rules of the level of security to be used and the rules to follow. Even if basic WS-Security is implemented based on some library like xmlsec, supporting policies would require a WS-Policy processing engine. That too will require at least one person year of work.
In summary, it would be years before serious Web services could be implemented with PHP SOAP extension. Web services are complex!
7 comments:
Did someone ever try "the other" native SOAP Extension for PHP
http://wso2.org/projects/wsf/php
? They claim to support things like
SOAP MTOM, WS-Addressing, WS-Security, WS-SecurityPolicy,
WS-ReliableMessaging.
They also support "document/literal wrapped", the kind-of-state-of-the-art doocument style for WSDLs.
I would love to hear any comments from people with "enterprise background" on this project.
We have been using WSF/PHP to send binary attachments and some of the security features in our system, for doc transfer. So far we had no issues.
hi,
i write a web service using asp.net and want to use them with php(php as a consumer),
i use wamp on my system,
uncomment php-soap.dll and use thid code :
$wsdl="http://localhost:49188/EBankServices/Service.asmx?wsdl";
$client = new SoapClient($wsdl, array('exceptions' => 0));
but i got this error :
Warning: SoapClient::SoapClient(http://localhost:49188/EBankServices/Service.asmx?wsdl) [function.SoapClient-SoapClient]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\wamp\www\ServiceConsumer.php on line 7
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: I/O warning : failed to load external entity "http://localhost:49188/EBankServices/Service.asmx?wsdl" in C:\wamp\www\ServiceConsumer.php on line 7
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://localhost:49188/EBankServices/Service.asmx?wsdl' in C:\wamp\www\ServiceConsumer.php on line 7
if i use the other wsdl foe example http://ws.cdyne.com/psaddress/addresslookup.asmx?wsdl
i got the same error.
so what should i do?please help me.
thanks
Looks like SoapClient was not able to read your input WSDL.
I tried code generating a client using the wsdl2php script for your second wsdl. It works ok. I think you can get your consumer implemented very quickly using WSF/PHP and the code generation scirpt :)
i save the wsdl of my services as Service.wsdl in c:\wamp\www folder,
and then use this:
$client=new SoapClient("Service.wsdl");
echo "Hello";
it result in "Hello"
but when i add these lines,i got some error:
Code:$param=array('name'=>'azade',);
$result = $client->__soapCall('HelloWorld',$param);
Error:Hello
Fatal error: Uncaught SoapFault exception: [H T T P] Could not connect to host in C:\wamp\www\n.php:7 Stack trace: #0 [internal function]: SoapClient->__doRequest('< ?x m l version="...', 'h t t p://localhos...', 'h t t p://tempuri....', 1, 0) #1 C:\wamp\www\n.php(7): SoapClient->__soapCall('HelloWorld', Array) #2 {main} thrown in C:\wamp\www\n.php on line 7
so,i don't know what should i do?
and i don't work with script and WSF/PHP ,could u help me on these?
thanks
@azade, you need something like the following:
$client=new SoapClient("http://localhost/Service.wsdl");
Post a Comment