RE: [SOAP] Re: **THIRD REQUEST** -- slightly updated
| From: | Sam Masiello | Date: | Mon, 22 Dec 2003 16:29:12 +0000 |
| Subject: | RE: [SOAP] Re: **THIRD REQUEST** -- slightly updated | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1265@lists.php.net to get a copy of this message | ||
Here is a question...
If Disco will create WSDL for you based on your implementation, I
definitely don't want that to happen. The project has a defined WSDL
document that we are both using for our separate implementations (for
the server that I am writing and for the client that a third party is
developing).
I'll futz around with what you have recommended below. Thank you again!
--Sam
Dave Dykshoorn wrote:
> A bit annoyed, don't worry I was too when I got started? You are
> using PEAR::SOAP right?
>
> Try this it should work for you...
>
> header seems to be reserved so you'll get faults if you use it I find.
>
> <CLIENT>
> <?php
> require_once("SOAP/Client.php") ;
> $url = "http://mysoap.com/MyServer.php?wsdl" ;
> $wsdl = new SOAP_WSDL($url);
> $client = $wsdl->getProxy() ;
> echo '<pre>';
> //print_r($client->pingService());
> print_r($client->emailSubmit('hi', 'there'));
> echo '</pre>';
>>
>
>
>
> <SERVER>
>
> <?php
> require_once("SOAP/Server.php") ;
>
> class SOAP_My_Server {
>
> var $__dispatch_map = array();
> var $__typedef = array();
>
> function SOAP_My_Server() { $this->__dispatch_map['pingService'] =
> array( 'in' => array(), 'out' => array('pingReturn'=>
> '{urn:SOAP_My_Server}pingPackage'));
>
> $this->__dispatch_map['emailSubmit'] = array(
> 'in' => array('myheader'=>'string',
> 'body'=>'string'),
> 'out' => array('submitReturn'=>'boolean')) ;
>
> $this->__typedef['pingPackage'] = array('ack'=>'boolean',
> 'time'=>'int') ;
> }
>
> function emailSubmit($myheader, $body) {
> // return new SOAP_Value('submitReturn', 'string', 'test');
> return
> new SOAP_Value('submitReturn', 'boolean', true); }
>
> function pingService() {
> $myreturn = array('ack'=>true, 'time'=>3600) ;
> return new SOAP_Value('pingReturn', '{urn:SOAP_My_Server}pingPackage',
> $myreturn) ;
> }
> }
>
> $server=new SOAP_Server;
> $soapmyserver = new SOAP_My_Server;
> $server->addObjectMap($soapmyserver,'urn:SOAP_My_Server');
>
> if (isset($_SERVER['REQUEST_METHOD']) &&
> $_SERVER['REQUEST_METHOD']=='POST') {
> $server->service($HTTP_RAW_POST_DATA); } else {
> require_once 'SOAP/Disco.php';
> $disco = new SOAP_DISCO_Server($server,"SOAP_My_Server");
> header("Content-type: text/xml");
> if (isset($_SERVER['QUERY_STRING']) &&
> strcasecmp($_SERVER['QUERY_STRING'],'wsdl')==0) {
> echo $disco->getWSDL();
> } else {
> echo $disco->getDISCO();
> }
> exit;
> }
>
>>