RE: [SOAP] Re: **THIRD REQUEST** -- slightly updated
| From: | Sam Masiello | Date: | Fri, 19 Dec 2003 23:59:08 +0000 |
| Subject: | RE: [SOAP] Re: **THIRD REQUEST** -- slightly updated | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1251@lists.php.net to get a copy of this message | ||
Frustrated doesn't even begin to describe it at this point :) I can't
even get one of my functions to return a simple value so I know they
were properly called. Yes, I am using PEAR::SOAP.
A couple of questions, if you don't mind, as some of the things you did
I saw in some other examples as well:
-- Why do myserver.php?wsdl ? I saw this in some other examples, but
wasn't sure of its' purpose.
-- What is Disco.php in the SOAP directory? I saw it in there and
looked around to see what was going on, but still did not quite
understand what it was meant for.
I will try this and let you know if I have other questions (or to praise
your name for ending my suffering :) ). Thank you very much for your
reply!!
--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;
> }
>
>>