Jump to content

Nusoap if condition


abhivinay

Recommended Posts

Hi ,

 

Could some one help me . I am new to webservices .

 

I have client request like

 

<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"><v:Header /><v:Body><n0:Mghonttrd id="o0" c:root="1" xmlns:n0="http://mytestwebsite4soap.com"><Mghonttrd i:type="n0:Mghonttrd"><ngtrgs i:type="d:string">444</ngtrgs></Mghonttrd></n0:Mghonttrd></v:Body></v:Envelope>

 

 

 

I want server to check the dynamic value of string " ngtrgs"  and send the result according to the value by using if condition.

 

suppose if ngtrgs=444 then it should  return array('status'=>"active",
            'Name'=>"abhi",
            'age=>"20",
            'class'=>"12");

 

if ngtrgs= 555 then

 

return array('status'=>"active",
            'Name'=>"vinay",
            'age=>"19",
            'class'=>"12");

server side i have  code

 

.... etc.,

 

server side code is below

 

 

<?php
require_once './nusoap/lib/nusoap.php';


 
//Retrieve zip code for textual area
//Logic of the web service
function Mghonttrd($ngtrgs)
{
//if ($ngtrgs == "444")
 {
return array('status'=>"active",
            'Name'=>"abhi",
            'age=>"20",
            'class'=>"12");
}
}

 //Register web service function so that clients can access

 $server = new soap_server();
$server->register('Mghonttrd');

$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA'])? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
$server->service($POST_DATA);

?>
 

 

Thankyou

Link to comment
https://forums.phpfreaks.com/topic/284481-nusoap-if-condition/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.