Re: **THIRD REQUEST** -- slightly updated

From: Date: Fri, 19 Dec 2003 23:53:43 +0000
Subject: Re: **THIRD REQUEST** -- slightly updated
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-1250@lists.php.net to get a copy of this message
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; } ?>

« previous php.soap (#1250) next »