Re: [SOAP] Handling SOAP answers
| From: | Klaasjan Tukker | Date: | Sun, 29 Dec 2002 22:22:19 +0000 |
| Subject: | Re: [SOAP] Handling SOAP answers | ||
| References: | 1 2 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-347@lists.php.net to get a copy of this message | ||
Trying to get things straight here.
$client->wire output is show below.
> _auto_translation will take any soap type and create an instance of a
> class with the same name if one has been defined.
In the sourcecode of Base.php _decode($soapval) says:
if (class_exists($soapval->type)) {
$classname = $soapval->type;
}
In this case, the $soapval->type has the value "Struct" . Where is this
value coming from. I cannot find it in the SOAP data sent and received.
Or, is an explicit binding of a (to be written) WSDL needed here?
> Or you can explicitly set classes:
>
> $client->__set_type_translation('{namespace}SoapStruct');
>
> (namespace is what the namespace would be defined as in the wsdl)
Sorry, I don't know what you mean here.
Klaasjan
OUTGOING:
POST /soap/sample/server2.php HTTP/1.0
User-Agent: PEAR-SOAP 0.7.1
Host: localhost
Content-Type: text/xml; charset=UTF-8
Content-Length: 653
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:SOAP_Example_Server"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:echoStruct>
<item>
<varString xsi:type="xsd:string">test string</varString>
<varInt xsi:type="xsd:int">123</varInt>
<varFloat
xsi:type="xsd:float">123.123</varFloat></item></ns4:echoStruct>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
INCOMING
HTTP/1.1 200 OK
Date: Sun, 29 Dec 2002 22:21:54 GMT
Server: Apache/1.3.26 (Unix) Debian GNU/Linux PHP/4.2.3
X-Powered-By: PHP/4.2.3
Content-Length: 673
Connection: close
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:SOAP_Example_Server"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:echoStructResponse>
<return>
<varString xsi:type="xsd:string">test string</varString>
<varInt xsi:type="xsd:int">123</varInt>
<varFloat xsi:type="xsd:float">123.123</varFloat>
</return>
</ns4:echoStructResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
----- Original Message -----
From: "Shane Caraveo" <shane@caraveo.com>
To: "Klaasjan Tukker" <k.tukker@microweb.nl>
Cc: <pear-dev@lists.php.net>; <soap@lists.php.net>
Sent: Sunday, December 29, 2002 10:10 PM
Subject: Re: [SOAP] Handling SOAP answers
> Klaasjan Tukker wrote:
> > Given a server and client (code below):
> >
> > How do I convert the answer of the "echoStruct" (input is a
SoapStruct-Object), back into an SoapStruct? The current response is an
"stdClass" object.
>
> >
> > $struct = new SOAPStruct('test string',123,123.123);
> >
> > $options = array('namespace' => 'urn:SOAP_Example_Server',
> > 'trace' => 1);
>
> $client->_auto_translation = true;
>
> > $result = $client->call("echoStruct",$struct,$options);
> >
> >
> > echo "CLASS: ".get_class($result)."\n";
>
> _auto_translation will take any soap type and create an instance of a
> class with the same name if one has been defined.
>
> Or you can explicitly set classes:
>
> $client->__set_type_translation('{namespace}SoapStruct');
>
> (namespace is what the namespace would be defined as in the wsdl)
>
> Shane
>
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>