|
|
Subject: Re: can we use getclass() instead of is_a() ? - msg#00029
List: php.nusoap.general
Another suggestion and one we use on another open source project
There also is a PEAR class that provides the missing functions not found in
older PHP versions and works well.
http://pear.php.net/package/PHP_Compat
Check for the existance of the function(is_a) and if not there then include
the pear class.
Regards,
Blaine
----- Original Message -----
From: "Ciprian Popovici" <ciprian@xxxxxxxxxx>
To: <nusoap-general@xxxxxxxxxxxxxxxxxxxxx>
Sent: Saturday, March 12, 2005 10:28 PM
Subject: Re: [Nusoap-general] can we use getclass() instead of is_a() ?
On Fri, 11 Mar 2005 14:08:04 -0500 "Scott Nichol"
<snicholnews@xxxxxxxxxxxxxxx> wrote:
Thanks. Great idea. It will be in the next revision I check into CVS.
I'd just like to note that is_a() is recursive, while get_class() is not.
I don't know if this is important for the code in question. If the use of
is_a() is expected to also identify granparent classes or deeper
inheritance, then one get_class() call won't cut it. You'll need to go up
the inheritance chain step by step using get_class() and
get_parent_class(). That's why is_a() was implemented, I suspect, as a
more elegant, single step alternative to this issue.
IMO a cleaner and better approach would be to detect if is_a() exists, and
if not to define a function with the same name, which emulates the same
behaviour.
if (!function_exists('is_a')) {
function is_a($object, $class) {
$class = trim(strtolower($class));
$c = get_class($object);
while ($c) {
if ($c == $class) return true;
$c = get_parent_class($c);
}
return false;
}
}
--
Ciprian Popovici
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nusoap-general mailing list
Nusoap-general@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/nusoap-general
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Array of anyType not returned properly
I am working with an individual who has created a web
service using ColdFusion. He has provided me with a WSDL file and I have
tried my best to replicate it, however the outputs from his server and my
server are different.
I believe our WSDLs are similar once mine is generated.
WSDL provided to me: http://69.20.61.40/WebServices/Flash/getCountryData.wsdl
My WSDL: http://69.20.61.40/WebServices/Flash/atflash.php?wsdl
My problem is with the type “anyType”. My
results are not visible. My code is as follows:
<?php
require_once('lib/nusoap.php');
$NAMESPACE = 'http://69.20.61.40/WebServices/Flash/atflash.php';
$server = new soap_server;
$server->debug_flag=false;
$server->configureWSDL('getCountryData', $NAMESPACE);
$server->wsdl->schemaTargetNamespace = $NAMESPACE;
//
ArrayOf_xsd_string
$server->wsdl->addComplexType(
'ArrayOf_xsd_string',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:string[]')
),
'xsd:string'
);
//
ArrayOfArrayOf_xsd_anyType
$server->wsdl->addComplexType(
'ArrayOfArrayOf_xsd_anyType',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'xsd:anyType[][]')
),
'xsd:anyType[]'
);
//
QueryBean
$server->wsdl->addComplexType(
'QueryBean',
'complexType',
'struct',
'all',
'',
array(
'columnList' => array('name'=>'columnList','type'=>'tns:ArrayOf_xsd_string'),
'data' => array('name'=>'data','type'=>'tns:ArrayOfArrayOf_xsd_anyType')
)
);
$server->register(
'getData',
array('countryCode'=>'xsd:string'),
array('getDataReturn'=>'tns:QueryBean'),
$NAMESPACE);
//
==== PROCESS REQUEST =====================================================
$HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA'])
? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
$server->service($HTTP_RAW_POST_DATA);
exit();
function getData($countryCode){
$mystrings[] = "DESCRIPTION";
$mystrings[] = "URL";
$arrayt[] = array("canada", "http://www.canada.com");
$arrayt[] = array("england", "http://www.england.com");
$querybean = array(
'columnList' => $mystrings,
'data' => $arrayt);
return $querybean;
}
?>
I have created a test client which can be found at http://69.20.61.40/WebServices/Flash/atflashclient.php
Now my problem is that the “data” element
contains 2 elements. However when I try to dig deeper it gives me an
error stating that the element is not an array. However it is clear from
the getData() function that the variable $arrayt is most certainly an array and
should return back with two elements with each containing two more elements:
Element1: Canada, http://www.canada.com
Element2: England, http://www.england.com
Can someone please tell me why I can not get the proper
output and what I should do to get the correct output?
Best regards,
Ali
Next Message by Date:
click to view message preview
Why is this WebService Call not passing the 2nd of three parms
This one webservice call is someone not passing the
2nd of three parms for this function when the client parses the webservice
call.
I've been staring at the debug output for a few
hours trying various changes but can not isolate the cause.
Many other functions are working fine. Any
ideas?
I am passing in the three parms where the call is
done like: $soapclient->call($apiCall,
$parameters);
And the passed in variables
are:
apiCall >> utilities_getComponentFieldValueparameters >>
Array ( [parameters] => Array ( [sessionOid] =>
0000.0ac9.aa11.a775.0d0f.79c2 [OID] => 0000.0ac9.aa11.85b8.3e20.41d5 [field]
=> PHONEFEATURES ) )
The debug trace:
POST /AdminSOAP/jaxrpc/UtilitiesDBSOAPPort HTTP/1.0
User-Agent: NuSOAP/0.6.7 (1.75)
Host: db01.voiss.primus.ca:80
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 602
0000.0ac9.aa11.a76c.d123.79b1PHONEFEATURES_utilSOAPID Response: HTTP/1.1 500 Internal Server Error
SOAPAction: ""
Content-Type: text/xml;charset=utf-8
Date: Tue, 15 Mar 2005 18:14:49 GMT
Server: Apache-Coyote/1.1
Connection: close
env:ClientJAXRPC.TIE.01: caught exception while handling request: unexpected element name: expected={http://www.vocaldata.com/AdminSOAP/Utilities}oid, actual={http://www.vocaldata.com/AdminSOAP/Utilities}field
<!--Extract of DEBUG dump from nusoap showing that it is not seeing the
2nd parm that is passed in -->wsdl: got 1 part(s)wsdl: have
arrayStruct parameterswsdl: serializing part "parameters" of type
"http://www.vocaldata.com/AdminSOAP/Utilities:utilities_getComponentFieldValue"wsdl:
calling serializeType w/named paramwsdl: in serializeType: parameters,
http://www.vocaldata.com/AdminSOAP/Utilities:utilities_getComponentFieldValue,
Array, literal, wsdl: got a prefixed type: utilities_getComponentFieldValue,
http://www.vocaldata.com/AdminSOAP/Utilitiesxmlschema:
<http://www.vocaldata.com/AdminSOAP/Utilities> in getTypeDef, found
element utilities_getComponentFieldValuexmlschema:
<http://www.vocaldata.com/AdminSOAP/Utilities> in getTypeDef, found
complexType utilities_getComponentFieldValueTypewsdl: typedef, name:
utilities_getComponentFieldValuewsdl: typedef, type:
http://www.vocaldata.com/AdminSOAP/Utilities:utilities_getComponentFieldValueTypewsdl:
typedef, typeClass: elementwsdl: typedef, form: qualifiedwsdl: typedef,
phpType: structwsdl: typedef, elements: Arraywsdl: serializeType:
uqType: utilities_getComponentFieldValue, ns:
http://www.vocaldata.com/AdminSOAP/Utilities, phptype: struct, arrayType:
wsdl: in serializeType: sessionOid, http://www.w3.org/2001/XMLSchema:string,
0000.0ac9.aa11.a76c.d123.79b1, literal, wsdl: got a prefixed type: string,
http://www.w3.org/2001/XMLSchemawsdl: in serializeType: field,
http://www.w3.org/2001/XMLSchema:string, PHONEFEATURES, literal, wsdl: got a
prefixed type: string, http://www.w3.org/2001/XMLSchemawsdl: returning:
string(204) "<utilities_getComponentFieldValue
xmlns="http://www.vocaldata.com/AdminSOAP/Utilities"><sessionOid>0000.0ac9.aa11.a76c.d123.79b1</sessionOid><field>PHONEFEATURES</field></utilities_getComponentFieldValue>"
-----------------------
Extract of WSDL for this operation
<xsd:element
name="utilities_getComponentFieldValue"
type="tns:utilities_getComponentFieldValueType"/>
<xsd:complexType
name="utilities_getComponentFieldValueType">
<xsd:sequence>
<xsd:element minOccurs="1"
maxOccurs="1"
name="sessionOid" type="xsd:string" />
<xsd:element minOccurs="1"
maxOccurs="1"
name="oid" type="xsd:string" />
<xsd:element minOccurs="1"
maxOccurs="1"
name="field" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
Previous Message by Thread:
click to view message preview
Re: can we use getclass() instead of is_a() ?
On Fri, 11 Mar 2005 14:08:04 -0500 "Scott Nichol"
<snicholnews@xxxxxxxxxxxxxxx> wrote:
> Thanks. Great idea. It will be in the next revision I check into CVS.
I'd just like to note that is_a() is recursive, while get_class() is not.
I don't know if this is important for the code in question. If the use of
is_a() is expected to also identify granparent classes or deeper
inheritance, then one get_class() call won't cut it. You'll need to go up
the inheritance chain step by step using get_class() and
get_parent_class(). That's why is_a() was implemented, I suspect, as a
more elegant, single step alternative to this issue.
IMO a cleaner and better approach would be to detect if is_a() exists, and
if not to define a function with the same name, which emulates the same
behaviour.
if (!function_exists('is_a')) {
function is_a($object, $class) {
$class = trim(strtolower($class));
$c = get_class($object);
while ($c) {
if ($c == $class) return true;
$c = get_parent_class($c);
}
return false;
}
}
--
Ciprian Popovici
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Next Message by Thread:
click to view message preview
wsdl and out-in messaging using nuSoap?
Hello,
I've got a question related to WSDL and nuSoap. As we all know, WSDL allows
for 4 types of message exchange patterns:
-in
-out
-out-in (ie. service sends request and awaits response)
-in-out (ie. service receives request and sends response)
As far as I can see, only the first and the last type of messaging is supported
in nuSoap. Or am I wrong? Is it possible to describe an operation which first
has got a output-message followed by an input message?
Best regards,
Maurits Billiet
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
|
|