Page 1 of 1

webservice with nusoap

Posted: Tue Aug 12, 2008 3:24 pm
by jogisarge
Hello !!

i try to create a webservice with nusoap.

Code: Select all

 
$soap = new soap_server();
$soap->configureWSDL('TEST', 'http://www.test.de/');
$soap->wsdl->schemaTargetNamespace = 'http://soapinterop.org/xsd/';
  
$soap->register(
      'strtest',
      array(
        'p1' => 'xsd:string',
        'p2' => 'xsd:string'
      ),
      array(
        'erg' => 'xsd:string'
      ),
      'http://soapinterop.org/'
    );
    $soap->service(isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '');
    function strtest($p1,$p2)
    {
        return "BLA ".$p1." BLA . ".$p2." ";
    }
 
now i try to create a function that returns an array !??
i dont know how to make the register-code ?
I need it, because i use the wsdl-file that nusoap creates for me.

bye jogi

Re: webservice with nusoap

Posted: Wed Aug 13, 2008 8:14 am
by lukewilkins
So you are just wanting to return $p1 and $p2 in an array?

Code: Select all

function strtest($p1,$p2) {
        //return "BLA ".$p1." BLA . ".$p2." ";
        return array('BLA'=>$p1, 'BLA2'=>$p2);
}
Let me know if I miss understood you.

Luke

Re: webservice with nusoap

Posted: Wed Aug 13, 2008 8:36 am
by jogisarge
no, i need to know how i have to code this part

Code: Select all

 
[b]$soap->register[/b](
      'strtest',
      array(
        'p1' => 'xsd:????????????????????????????????'
             ),
      array(
        'erg' => 'xsd:????????????????????????'
      ),
      'http://soapinterop.org/'
    );
 
 
if the p1 is an arraylist and erg too.

bye jogi

Re: webservice with nusoap

Posted: Wed Aug 13, 2008 8:58 am
by lukewilkins
I don't think I understand that you're asking for, but I think you should be able to find your answer here:
http://dietrich.ganx4.com/nusoap/testbe ... erver.phps

Re: webservice with nusoap

Posted: Fri Aug 15, 2008 2:40 am
by jogisarge
hi,
I don't think I understand that you're asking for, but I think you should be able to find your answer here:
i have checked your link, but i don't understand it.

perhaps i can explane my prob again:

i need a function in my webservice that gets an arraylist lik this:

Code: Select all

 
$elem[0] = array("name"=>"fred","age"=>"21");
$elem[1] = array("name"=>"sandy","age"=>"13");
$elem[2] = array("name"=>"carl","age"=>"33");
$elem[3] = array("name"=>"paige","age"=>"44");
 
this array should be put as parm to my webservice-function.
the webservice-function receives the parm and works with it.
the function should return an array like this:

Code: Select all

 
$erg[0]["name"]; (fred)
$erg[0]["age"]; (21)
$erg[0]["gender"]; (boy)
 
$erg[1]["name"]; (fred)
$erg[1]["age"]; (13)
$erg[1]["gender"]; (girl)
 
thats only a example to explain my problem.
know i dont know how to code the function in my webservice, by using complex datatypes.

bye jogi