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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.