php-soap interop

From: Date: Fri, 31 May 2002 14:43:20 +0000
Subject: php-soap interop
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-31@lists.php.net to get a copy of this message
> Anyway, I need to get some script example from you. I want to start > developing the interop tests. I can dig through some of the examples > you've sent out before, but figure it would be easier to let you know > what I need. > > a. send soap messages without wsdl, serializing php types directly here is the default mapping: php:long/int to xsd:long php:double to xsd:double php:string to xsd:string php:bool to xsd:boolean php:array to soap:array php:array (with string keys) to apache:Map php:object to soap:struct > b. send soap messages without wsdl, serializing soapval values if you want to "overide" the default maping you can use SoapVal($data, XSD_SOME_TYPE); I don't have all of the xsd types defined yet. function echoFloat($float) { return new SoapVar($float, XSD_FLOAT); } function echoArrayOfFloat($array) { foreach($array as $f) $ret[] = new SoapVar($f, XSD_FLOAT); return $ret; } > c. send soap messages with wsdl, serializing php types if you have a wsdl on the client or the server. //client $obj = new SoapObject("http://localhost/server.php?WSDL"); $ret = $obj->echoFloat("12.1"); // the conversion here will be automatic //server $server = new SoapServer("urn:blah"); $server->addFunction("echoFloat"); $server->bind("some.wsdl"); $server->handle(); function echoFloat($float) { // no matter what you return here it will always be a float.. // (if the wsdl says) return (string)$float; return $float; } > > Everything is fairly simple, most interop tests are echoType functions > (echoString, echoInt, echoFloat, etc.). Some use complex types, such as > soap struct, which I use soap_value like this when not using wsdl: > > $soapstruct = new > SOAP_Value('inputStruct','{...namespace...}SOAPStruct',array('abcdefg',2134,12.34)); function echoStruct($struct) { return $struct; } function returnStruct() { $ret->foo = "bar"; return $ret; } > > Your soapvar class looks almost the equivelant, but only takes value and > type. Where do you get the element node name and type namespace from > with soapvar? Yeah the extension already knows how to encode all (most) xsd types, soap, apache so it assumes the correct namespace. > > Can you bind more than one class into a soap server? I have a couple > interop classes that need to be bound to a server. No.. the class binding is used for making a soap service a php object. So you can use a object remotely and so the object can be perstisted. $obj = SoapObject("http://localhost/myobject.php", "urn:myobject"); $obj->somemethod(); echo $obj->someothermethod(); $server = new SoapServer("urn:myobject"); $server->setClass("myObject"); $server->setPersistence(SOAP_PERSISTENCE_SESSION); $server->handle(); class myObject { function somemethod() { $this->data = "data"; } function someothermethod() { return $this->data; } } as you see you are using the object exactly like you would a normal php object. The data for all the members are perstisted. So there is acually a php object "running" on the server. The constructor even gets called. So it doesn't make any sence to "bind" two classes to a soap server in the way that it works now. The setClass makes the soapservice the php object. maybe i can make a way that addFunction() can accecpt "class" => "function" params, only if the method is static. > > That's about it, with that I'll start work on interop scripts and we can > get an idea how interop is against a variety of soap implementations. > I just commited my changes to domxml. So now some of the more advance mapping/ineterp can be done (from cvs domxml and cvs phpsoap). You shouldn't need these examples with the simple interop stuff that you are doing. Hope this helps. - Brad __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com

« previous php.soap (#31) next »