Hi there!

I'm new to this mailing list so please be gentle if I accidentally
forego any implicit etiquette...

I've spent a few days now trying to get SOAP interoperability with C#
and PHP5. The most difficult part has been trying to create standards-
compliant WSDL without any real knowledge of XML. I had heard that
SOAP was old-school now, and deprecated by the masses in favour of
(much) simpler communication, but I didn't want to write off all my
time. The communication required could be proprietary in my case as
the API is used internally within the company as part of a small
project between an Apache server (PHP) and a C# .NET 3.5 client.

Perhaps not surprisingly, getting PHP5 SOAP to work was the easiest
part, once the WSDL had been written.

Here are the PHP tutorials I've used:
http://developer.apple.com/internet/webservices/soapphp.html
http://devzone.zend.com/node/view/id/689

There is a way to define the SOAP service programatically from within
PHP, but in the absence of my own sanity at the end of much searching,
I went with the WSDL route. Once you've created a WSDL description of
the service (finnicky, difficult, but straightforward as always in
hindsight) then the PHP side of things is relatively simple. First
install/enable the SOAP module, and then write something like:

// Disable WSDL caching
ini_set("soap.wsdl_cache_enabled", "0");

// Define some functions to be invoked by SOAP calls from clients
function foo($input)
{
        // What input is, and what (if any) fields it has (if it's an array,
or object), depends on your WSDL definition
        // What you return should be compatible with what you, again, defined
as the return message in your WSDL definition
        return $something;
}

$server = new SoapServer('/path/to/wsdl/file');

$server->addFunction("foo");

$server->handle();

The SOAP module takes care of the rest.

Incidentally, as of today I'm thinking of undoing all my SOAP and WSDL
work because the Microsoft C# WSDL code generator (wsdl.exe, for
creating a client class to call SOAP functions) cannot handle arrays
of complex types very well (or atleast, as far as I've seen and have
read). This was a little disappointing to find... I was all excited to
finally have had some SOAP functionality :(

Cheers,
Arya

On Feb 4, 3:17 pm, Dalibor Andzakovic
<[email protected]> wrote:
> Err, that second link should've 
> beenhttp://kevinvaughan.com/pages/wsdl-interpreter.php
>
> dali
>
> From: [email protected] [mailto:[email protected]] On Behalf Of 
> Dalibor Andzakovic
> Sent: Wednesday, 4 February 2009 3:14 p.m.
> To: [email protected]
> Subject: [phpug] Re: PHP SOAP working tutorial
>
> SOAP client is pretty easy.
>
> I've usedhttp://www.urdalen.no/wsdl2php/index.phpin the past with good 
> success against .net and java services.
> There is alsohttp://www.urdalen.no/wsdl2php/index.php
> If I was staring again I would 
> usehttp://framework.zend.com/manual/en/zend.soap.htmlbut that's only because 
> I tend to use ZF for a mundane stuff like logging...
>
> If you want to provide a service then you need to make distinction between 
> RPC/Encoded (old) and Document/Literal (new) SOAP. Use ZendFramework for 
> RPC/Encoded (which uses soap extension) and SDO extension for 
> Document/Literal.
>
> I've had SDO webservices consumed sucessfuly with both .Net and java libraries
>
> HTH
>
> dali
>
> From: [email protected] [mailto:[email protected]] On Behalf Of 
> Brendan Brink
> Sent: Monday, 2 February 2009 11:38 a.m.
> To: [email protected]
> Subject: [phpug] PHP SOAP working tutorial
>
> Hi there all,
>
> Wondered if anyone had a link to a PHP Soap tutorial that they have used and 
> found useful?
>
> Have noted that many online are connecting to servers which are no longer 
> active for testing.
>
> wanting to create a client in PHP
>
> Thanks
>
> Cheers
> Brendan.

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to