pear::soap api outline
| From: | Shane Caraveo | Date: | Sat, 01 Jun 2002 23:06:11 +0000 |
| Subject: | pear::soap api outline | ||
| Groups: | php.pear.dev php.soap | ||
| Request: | Send a blank email to pear-dev+get-6703@lists.php.net to get a copy of this message | ||
Hello,
Since I'm talking with Brad about the c library, I decided it would be helpfull to outline pear::soap for him. Then I decided that might be helpfull for everyone ;)
This is not all the api, but the pertinent public api that would typicaly be used in a php script using the pear::soap library. I've left out plenty of stuff.
- Shane
features I can remember right now:
soap 1.1 support
client support for direct calls or object overloading via proxy class or php_overload extension
support for literal and section 5 encoding
support for rpc style messages, partial implementation for document style messages
http, https and smtp transport layers
href/id support
multidimensional array support (xsi:type='string[,]')
soap header support
soap attribute support
soap attachements via DIME (experimental) and SwA (Mime)
use objects or stand alone functions in servers
email parsing server
email to http gateway server
WSDL support, incomplete but operational XML Schema support, wsdl parser now parses all xmethods.com wsdl's, don't know if it grok's them all yet.
extensive interop testing
-------------------------------------------------------------------
SOAP_Client(string endpoint, string wsdl, string portname)
set_encoding(string encoding)
allows for setting character endocing (utf-8, us-ascii)
addHeader(soap_value header)
allows for setting elements into the soap header section of the soap envelope
mixed call(string method, array params, array options)
makes a soap call. returns the result of the call.
method is the method name being called
params can be soap_value objects or php types, or a mix of the two
options can contain a number of important items;
namespace, soapaction, timeout (socket), from (smtp),
transfer-encoding (smtp), subject (smtp),
headers (http/smtp), use (literal/encoded),
style (document/rpc), mime or dime for attachements
these items are defaulted if not entered, or overwriten
by wsdl where appropriate if wsdl is used.
parseResponse(string soap_envelope, string encoding, array attachements)
used internally, but public for testing purposes, allows a user to deserialize a soap envelope obtained from some other source
-------------------------------------------------------------------
Server Classes:
SOAP_Server()
service(string data, string endpoint_url, [boolean test])
service initiates the server running a request. the data value is the raw post data for http. SOAP_Server is subclassed for email parsing.
addObjectMap(ref object)
adds an instance of an object to the server handler
addToMap(string methodname, array in, array out, [string namespace])
adds a method to the server handler. the in/out arrays define the parameters for the method. The namespace is options, defines a specific namespace for the function.
SOAP_Server_Email(boolean send_response)
send_response defines whether a return email is sent
SOAP_Server_Email subclasses SOAP_Server, handling differences necessary to parse a soap message contained in an email
it also handles sending a response via smtp if necessary
-------------------------------------------------------------------
Serialization classes:
SOAP_Value(string name, string type, mixed value, array attributes)
allows for explicitly defining a type without wsdl
name and type can be formated to include the namespace:
'{namespace}name','{namespace}type',value
the attributes array is added to the xml element as
xml attributes
several other values exist in the class that can be set independentaly to do things like multidimensional array flattening.
SOAP_Header
subclass of soap_value, but sets the actor and mustunderstand attributes automaticly if not included.
SOAP_Attachement
subclass of soap_value, but handles additional information necessary for creating soap attachements via SwA or DIME.
-------------------------------------------------------------------
SOAP_WSDL(string uri)
it's not realy correctly named, just haven't split it out of the soap library yet. This class handles parsing wsdl files, and storing information in a simple format for the SOAP_Client to use. This class does not handle parsing WSDL itself, it calls on SOAP_WSDL_PARSER class to do that. WSDL files are also cached, though that mechanism will change to cash serialized copies of the SOAP_WSDL class itself.
Most of the following member functions are used internally by the soap_client class. The exception are the proxy functions.
getEndpoint(string portName)
returns an endpoint for a service port
getPortName(string operation)
gets the portname for an operation
getOperationData(string portname, string operation)
gets detailed data about the operation that is used for validating parameters, etc.
getSoapAction(string portname, string operation)
gets the soapaction uri for an operation
getNamespace(string portname, string operation)
gets the namespace for an operation
getSchemaType(string type, string name, string type_namespace)
given some information, it returns an array containing validated type information
generateProxyCode([string port])
generates php code that can be used as a proxy class
getProxy([string port])
uses generateProxyCode to get a php class, then eval's it into existence. This allows a script to call on the wsdl to create a class that can be used as a client.