Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5989055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:02:46+00:00 2026-05-22T23:02:46+00:00

I wrote php web service using nusoap and client script. When I fetch the

  • 0

I wrote php web service using nusoap and client script. When I fetch the database records via php client unicode records are displaying as ?????????? ???? ???? (“questions marks”).

server.php

<?php

    //call library
    require_once 'config.php';
    include_once("nusoap/lib/nusoap.php");

    $conn = new Dbconn(HOST, DB, USER, PASS);

    //using soap_server to create server object
    $server = new soap_server;


    $server->soap_defencoding = 'UTF-8';
    $server->decode_utf8 = true;
    //register a function that works on server

    $server->configureWSDL('designationdivisionwsdl', 'urn:designationdivisionwsdl');
    // Register the method to expose
    //$server->register('getallbook',                // 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
    //);
    //
    //
    //Definimos la estructura de cada registro
    $server->wsdl->addComplexType(
            'designations',
            'complexType',
            'struct',
            'all',
            '',
            array(
                'jobtit_name' => array('name' => 'jobtit_name', 'type' => 'xsd:string'),
                'jobtit_name_si' => array('name' => 'jobtit_name_si', 'type' => 'xsd:string'),
                'jobtit_name_ta' => array('name' => 'jobtit_name_ta', 'type' => 'xsd:string')
            )
    );

    $server->wsdl->addComplexType('estructura', 'complexType', 'array', '',
            'SOAP-ENC:Array', array(),
            array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:designations[]')),
            'tns:designations');

    $server->register('getDesignations', array(), array('return' => 'tns:estructura'));

    // create the function

    function getDesignations() {

        $ssql_ = mysql_query("select jobtit_name, jobtit_name_si, jobtit_name_ta from hs_hr_job_title") or die(mysql_error());
        $numrows = mysql_num_rows($ssql_);
        $designationList = array();
        for ($x = 0; $x < $numrows; $x++) {
            $designationList[] = mysql_fetch_array($ssql_);
        }
        return $designationList;
    }

    //start getDivisionlist webMethod

    $server->wsdl->addComplexType(
            'divisions',
            'complexType',
            'struct',
            'all',
            '',
            array(
                'comp_code' => array('comp_code' => 'comp_code', 'type' => 'xsd:string'),
                'title' => array('title' => 'title', 'type' => 'xsd:string'),
                'title_si' => array('title_si' => 'title_si', 'type' => 'xsd:string'),
                'title_ta' => array('title_ta' => 'title_ta', 'type' => 'xsd:string'),
            )
    );

    $server->wsdl->addComplexType('divisiontype', 'complexType', 'array', '',
            'SOAP-ENC:Array', array(),
            array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:divisions[]')),
            'tns:divisions');

    $server->register('getDivisions', array(), array('return' => 'tns:divisiontype'));

    function getDivisions() {

        $ssql_ = mysql_query("select title, title_si, title_ta from  hs_hr_compstructtree") or die(mysql_error());
        $numrows = mysql_num_rows($ssql_);
        $divisionList = array();
        for ($x = 0; $x < $numrows; $x++) {
            $divisionList[] = mysql_fetch_array($ssql_);
        }
        return $divisionList;
    }

    // create HTTP listener
    $server->service($HTTP_RAW_POST_DATA);

    exit();
?>

client.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>
<?php
include_once("nusoap/lib/nusoap.php");
ini_set ('soap.wsdl_cache_enabled', 0);

$client = new nusoap_client('http://localhost/esamwebservice/server.php?wsdl');

//$response = $client->call('getDesignations');
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = true;
$response = $client->call('getDivisions');
print_r($response);die;


?>
</body>
</html>

output

Array ( [0] => Array ( [title] => The Government of Sri Lanka [title_si] => ????? ???? ???????????????? ???????? ????? [title_ta] => ?????? ?????? ??????? ???????? ) [1] => Array ( [title] => IT Department ) [2] => Array ( [title] => PHP [title_si] => PHP_si [title_ta] => ???? ? ?? ? ) [3] => Array ( [title] => Land Section [title_si] => ???? ????? [title_ta] => ??? ? ? ) [4] => Array ( [title] => sdfsdf [title_si] => dsafsda [title_ta] => fasdfasdghd ) [5] => Array ( [title] => dfsdfdf ) [6] => Array ( [title] => dsfsdfdsf ) [7] => Array ( [title] => sdfsdfsd [title_si] => ???? ????? ) [8] => Array ( [title] => IT Department two [title_si] => dfgfd [title_ta] => gdfgfd ) [9] => Array ( [title] => fg ) [10] => Array ( [title] => Western Province [title_si] => Western Province_si [title_ta] => Western Province_ta ) [11] => Array ( [title] => 456 ) [12] => Array ( [title] => Test ) [13] => Array ( [title] => asdasd ) [14] => Array ( [title] => asd ) [15] => Array ( [title] => fsdfsd ) [16] => Array ( [title] => sdfsdf [title_si] => sdfsd [title_ta] => fsdf ) )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:02:47+00:00Added an answer on May 22, 2026 at 11:02 pm

    Using

    $client->decode_utf8 = false;
    

    instead of

    $client->decode_utf8 = true;
    

    worked for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a web service API which services REST requests in php. It didn't
I'm trying to write PHP to call a web service. Using SoapUI, I construct
I just wrote a PHP login script, and what I'm trying to accomplish is
I'm writing a PHP web service and one function. I want to set up
I've written a web service using ASP.NET (in C#) and I'm attempting to write
I've got a Web Service written using C# in Visual Studio 2008 (I've also
I have a PHP web application developed using symfony framework. I want to call
I've write a web-application in PHP which has 30 tables+views. From time to time
I'm writing a simple web app in PHP that needs to have write access
I've been asked to write a web application in PHP to handle customers, sales,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.