Welcome Guest, Not a member yet? Register   Sign In
soap server/client error
#1

[eluser]Unknown[/eluser]
Hello, I write soapServer and soapClient controller. Code is:

SoapServer:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Hellowsdl extends CI_Controller {

function __construct()
{
  parent::__construct();
}

function index()
{
require_once(APPPATH.'libraries/lib/nusoap'.EXT);
  // Create the server instance
  $server = new soap_server();
  // Initialize WSDL support
  $server->configureWSDL('hellowsdl', 'urn:hellowsdl');
  // Register the method to expose
  $server->register('hello',    // method name
   array('name' => 'xsd:string'),  // input parameters
   array('return' => 'xsd:string'), // output parameters
   'urn:hellowsdl',     // namespace
   'urn:hellowsdl#hello',    // soapaction
   'rpc',        // style
   'encoded',       // use
   'Says hello to the caller'   // documentation
  );
  // Define the method as a PHP function
  function hello($name) {
    return 'Hello, ' . $name;
  }
  // Use the request to (try to) invoke the service
  $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
  $server->service($HTTP_RAW_POST_DATA);
}
}

soapClient

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Hellowsdlclient extends CI_Controller {

function __construct()
{
  parent::__construct();
}

function index()
{
  
  require_once(APPPATH.'libraries/lib/nusoap'.EXT);
  // Create the client instance
  $client = new soapclient('http://localhost/NWTrepozitorij/trunk/rest/index.php/hellowsdl?wsdl');
  

  // Call the SOAP method
  $result = $client->hello('Scott');

    // Display the result
    echo '<h2>Result</h2><pre>';
    print_r($result);
    echo '</pre>';

}
}

when I acces the webpage on link http://localhost/NWTrepozitorij/trunk/re.../hellowsdl I can see my server and it looks like:
Screenshot 1: http://pokit.org/get/?fb9e7f44e2b8143229...02b56f.jpg
Screenshot 2: http://pokit.org/get/?9482ed94e92372bb30...c0c472.jpg

But when I try to access to my client on link: http://localhost/NWTrepozitorij/trunk/re...wsdlclient
I get this error: "error in msg parsing: xml was empty, didn't parse!
Screenshot of error: http://pokit.org/get/?6dd69cf5462dbbd39e...16e642.jpg

As you can see my server is working fine but cannot access to it, and don't know where the error is cause the same example works fine in pure php but in codeigniter won't work. I need it in codeigniter to work. Please help!

#2

[eluser]TheFuzzy0ne[/eluser]
Have you tried validating your XML? http://www.xmlvalidation.com/index.php

Also, be sure that there are no errors being output by the server, which could be mucking up your XML.
#3

[eluser]kostyak[/eluser]
Hi!
I have tried your code but don't find appropriate version of the 'nusoap'. But what I want to say. In the samples I didn't find a remote procedure call like you used.
Code:
$client->hello('Scott');
Instead I found:
Code:
$client->call('hello',array('parameters'=>'Scott'), '', '', false, true);

May be problem in this?




Theme © iAndrew 2016 - Forum software by © MyBB