Re: [SOAP] php-soap interop
| From: | Shane Caraveo | Date: | Fri, 31 May 2002 18:15:54 +0000 |
| Subject: | Re: [SOAP] php-soap interop | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-33@lists.php.net to get a copy of this message | ||
brad lafountain wrote:
Hmm, so you have to use soapvar to create xsd:integer? I have found xsd:integer to be more used than xsd:long, and xsd:float more common than xsd:double. Anyway, it isn't important.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 directlyhere 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
Yeah the extension already knows how to encode all (most) xsd types, soap, apache so it assumes the correct namespace.What about non-xsd types? It seems without wsdl there is no way to provide the element nodeName, namespace or type namespace.
The client side doesn't matter, but a small change in the server side would allow binding multiple classes, and allow for setting namespaces per-function when binding functions: $server = new SoapServer(); $server->setClass('myObject','urn:myobject'); $server->setClass('anotherObject','urn:anotherobject'); $server->addFunction('echoFloat','urn:echoFloat'); $server->addFunction('echoSOAPStruct','urn:echoSOAPStruct'); $server->handle(); Then the client would change the namespace depending on what it is accessing: $obj = SoapObject("http://localhost/soapserver.php", "urn:myobject"); echo $obj->someothermethod(); $obj2 = SoapObject("http://localhost/soapserver.php", "urn:echoFloat"); echo $obj2->echoFloat(1.2); I'm somewhat concered about the soapvar class, that it is too limited. I found that the minimal requirement to properly define types without wsdl is: name, type, value, type_namespace and optionaly a namespace. The combination of which build up to : <namespace_prefix:name xsi:type='type_namespace_prefix:type' xmlns:namespace_prefix='namespace' xmlns:type_namespace_prefix='type_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.
value</namespace_prefix:name>with the prefixes being autogenerated. It's easy to serialize xsd types without the additional information, but once you try to serialize SOAPStruct for instance, then you run into a problem if you cannot define these things. So perhaps the domxml work you've recently done addresses this, though dom seems heavy-wieght to me for doing simple serializations of complex types. If so, some examples on doing that would be helpfull. So here is a soap message that I will need to be able to serialize from a SoapObject call: http://www.caraveo.com/soap_interop/client_round2_results.php?wire=487 From what I have seen so far, this would get me part way: //client $obj = new SoapObject('http://localhost/interopserver.php','http://soapinterop.org/'); $inputStruct = new Std_Object(); $inputStruct->varString = 'abcdefg'; $inputStruct->varInt = SoapVar(1234,XSD_INT); $inputStruct->varFloat = SoapVar(1234,XSD_FLOAT); $ret = $obj->echoStruct($inputStruct); //server $server = new SoapServer('http://soapinterop.org/'); $server->addFunction('echoStruct'); $server->handle(); function echoStruct($struct) { $retobj = new Std_Object(); $retobj->varString = $struct->varString; $retobj->varInt = SoapVar($struct->varInt,XSD_INT); $retobj->varFloat = SoapVar($struct->varFloat,XSD_FLOAT); return $retobj; } What I am missing so far is how I define SOAPStruct is in the namespace http://soapinterop.org/xsd. If soapvar was changed to accept something like: return SoapVar($retobj,'{http://soapinterop.org/xsd}SOAPStruct'); Or, the other way to go would be putting the namespace in the object itself: $retobj->__namespace = 'http://soapinterop.org/xsd'; return $retobj; Then any type with any namespace can be defined. Shane