I created a SOAP server in codeigniter and here is my controller
class Sample extends CI_Controller {
function __construct()
{
parent::__construct();
$ns = base_url();
$this->load->library("Nusoap_library");
$this->load->library("Master");
$this->server = new soap_server(); // create soap server object
$this->server->configureWSDL("SOAP", $ns); // wsdl
$this->server->wsdl->schemaTargetNamespace = $ns; // server namespace
}
public function index()
{
$ns = base_url();
$input_array = array ('type' => "xsd:string"); // "addnumbers" method parameters
$return_array = array ("fruit" => "xsd:string");
$this->server->register('Master.fruits', $input_array, $return_array, "urn:SOAPServerWSDL", "urn:".$ns."/addnumbers", "rpc", "encoded", "Fruit Types");
$this->server->service(file_get_contents("php://input")); // read raw data from request body
}
public function client(){
$this->client = new nusoap_client(base_url()."index.php?wsdl", true);
$this->load->view("client");
}
}
the server is works very well, and i created a Mater class as library Master.php [library]
class Master {
public function fruits($type)
{
switch($type)
{
case 'red':
return "Apple";
break;a
case 'yellow':
return "banana";
break;
}
}
}
As you can see the controller, i also created a client function to test whether the client working fine
here is my client View code
$error = $this->client->getError();
if ($error) {
echo "<h2>Constructor error</h2><pre>" . $error . "</pre>";
}
$result = $this->client->call("Master.fruits", array("type" => "red"));
if ($this->client->fault) {
echo "<h2>Fault</h2><pre>";
print_r($result);
echo "</pre>";
}
else {
$error = $this->client->getError();
if ($error) {
echo "<h2>Error</h2><pre>" . $error . "</pre>";
}
else {
echo "<h2>Fruits</h2><pre>";
echo $result;
echo "</pre>";
}
}
i am getting result perfectly in php while calling the SOAP server but if the same SOAP server is called via C# by creating service
i am getting errors something like it should not be like Master.fruits it should be like masterfruits and also i am getting errors in content Type