[thelist] PHP enum

Mark Joslyn Mark.Joslyn at SolimarSystems.com
Fri Oct 1 10:45:23 CDT 2004


<snip>
Are you consuming this using WSDL to generate a proxy client, or are you
manually calling each method?  

This is probably due to the fact that the service is not looking for a
native PHP simple data type, but actually SOAP data type.  You'll have to
look in their API docs for what the definition of that type is.
</snip>

I am consuming the web services in this manner:

$sResults = new soapclient('http://localhost/Search.asmx?WSDL', true);

$param = array('aName' => $app, 'sName' => $sess, 'arName' => $arch, 'rName'
=> $rep, 'page' => $ip, 'pageSize' => $ps, 'query' => $q, 'sFlags' => $f,
'sf' => $sort, 'snap' => $sShot);

$results = $sResults->call('searcher', array('parameters' => $param));

So, YES, I do believe that the service provides WSDL - is there a resource I
could reference to show how to use WSDL on the client side?

The WSDL schema looks like this:

<snip>
<s:element name="ss_search">
	<s:complexType>
		<s:sequence>
  			<s:element minOccurs="0" maxOccurs="1" name="aName"
type="s:string" /> 
  			<s:element minOccurs="0" maxOccurs="1" name="sName"
type="s:string" /> 
  			<s:element minOccurs="0" maxOccurs="1" name="arName"
type="s:string" /> 
  			<s:element minOccurs="0" maxOccurs="1"
name="repName" type="s:string" /> 
  			<s:element minOccurs="1" maxOccurs="1" name="page"
type="s:int" /> 
  			<s:element minOccurs="1" maxOccurs="1"
name="pageSize" type="s:int" /> 
  			<s:element minOccurs="0" maxOccurs="1" name="query"
type="s:string" /> 
  			<s:element minOccurs="1" maxOccurs="1" name="sFlags"
type="tns:ESFlags" /> 
  			<s:element minOccurs="0" maxOccurs="1" name="sf"
type="s:string" /> 
  			<s:element minOccurs="1" maxOccurs="1" name="snap"
type="s:int" /> 
  		</s:sequence>
  	</s:complexType>
 </s:element>

<s:simpleType name="ESFlags">
	<s:list>
		<s:simpleType>
			<s:restriction base="s:string">
  				<s:enumeration value="Snapshot" /> 
  				<s:enumeration value="Search" /> 
  				<s:enumeration value="Descending" /> 
  			</s:restriction>
  		</s:simpleType>
  	</s:list>
</s:simpleType>
</snip>

So what I need is to pass all the parameters into the web service as either
string or integers - except for "sFlags" - that needs to be an Enums. SO far
all I have been able to do is set it to a string or integer, but the web
service rejects this as the wrong format.

Any ideas how to send "sFlags" in as an Enum?

Thanks for your help!

markJ



More information about the thelist mailing list