IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques et frameworks PHP Discussion :

[Web Service] Pourquoi le webservice ne supporte pas les accents ?


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre du Club
    Inscrit en
    Juillet 2006
    Messages
    242
    Détails du profil
    Informations forums :
    Inscription : Juillet 2006
    Messages : 242
    Points : 56
    Points
    56
    Par défaut [Web Service] Pourquoi le webservice ne supporte pas les accents ?
    Bonjour à tous,

    Je développe une application cliente en Java ME qui appelle une fonction dans un service web PHP , et cette fonction récupère des données venant d'une base de données MySQL sous Linux Ubuntu. Voici le code Java ME :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    public String alimenterBaseDeDonneesEtapeProsp( String login, String password,String adresse,String site)
        {
                    Object  resultatRequeteSOAP = null;
    		SoapObject objetSOAPEtapeProsp;
    		HttpTransport connexionServeur;
    		SoapSerializationEnvelope envelope;
    		String nomService		= "urn:Client";
    		String urlService               = adresse+"/"+site+"/webservice/InterfaceTransfererClient.php";
    		String methodeChoisie 		= "getEtapeProsp";
                    try
    		{
    			connexionServeur = new HttpTransport(urlService );
                          	connexionServeur.debug = true;
             		objetSOAPEtapeProsp = new SoapObject(nomService, methodeChoisie );
                            objetSOAPEtapeProsp.addProperty("user", login);
                            objetSOAPEtapeProsp.addProperty("motpasse",password);
                            System.out.println("WEBSERVICE : "+objetSOAPEtapeProsp);
                            envelope = new SoapSerializationEnvelope(SoapSerializationEnvelope.VER11);
                            envelope.bodyOut = objetSOAPEtapeProsp;
                            connexionServeur.call(null,envelope);
                            resultatRequeteSOAP = envelope.getResponse();
                            return String.valueOf(resultatRequeteSOAP);
                    }
                    catch (Exception aE)
                    {
                        return "Erreur 55 : ".concat(aE.getMessage());
                    }
        }
    Voici le fichier wsdl :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    <?xml version="1.0" encoding="utf-8"?>
    <definitions name="Client" 
    		targetNamespace="urn:Client" 
    		xmlns:typens="urn:Client" 
    		xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    		xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    		xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    		xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    		xmlns="http://schemas.xmlsoap.org/wsdl/">
     
    	<types>
        	<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" 
    			targetNamespace="urn:Client">
    		</xsd:schema>
    	</types> 
     
     
    	<!-- partie 3 : Message -->
    	<message name="getClientRequest">
    		<part name="user" type="xsd:string"/>
    		<part name="motpasse" type="xsd:string"/>
    	</message>
    	<message name="getClientResponse">
    		<part name="return" type="xsd:string"/>
    	</message>
     
    	<message name="getCreditRequest">
    		<part name="user" type="xsd:string"/>
    		<part name="motpasse" type="xsd:string"/>
    	</message>
    	<message name="getCreditResponse">
    		<part name="return" type="xsd:string"/>
    	</message>
     
    	<message name="getEcheancierRequest">
    		<part name="user" type="xsd:string"/>
    		<part name="motpasse" type="xsd:string"/>
    	</message>
    	<message name="getEcheancierResponse">
    		<part name="return" type="xsd:string"/>
    	</message>
     
    	<message name="getUrlPhotosRequest">
    		<part name="user" type="xsd:string"/>
    		<part name="motpasse" type="xsd:string"/>
    	</message>
    	<message name="getUrlPhotosResponse">
    		<part name="return" type="xsd:string"/>
    	</message>
     
    	<message name="getModificationClientRequest">
    		<part name="client" type="xsd:string"/>
    	</message>
    	<message name="getModificationClientResponse">
    		<part name="return" type="xsd:string"/>
    	</message>
     
    	<message name="getModificationCreditRequest">
    		<part name="credit" type="xsd:string"/>
    	</message>
    	<message name="getModificationCreditResponse">
    		<part name="return" type="xsd:string"/>
    	</message>
     
    	<message name="getModificationEcheanceRequest">
    		<part name="echeance" type="xsd:string"/>
    	</message>
    	<message name="getModificationEcheanceResponse">
    		<part name="return" type="xsd:string"/>
    	</message>
     
    	<message name="getAllPhotoNamesRequest">
    		<part name="user" type="xsd:string"/>
    		<part name="motpasse" type="xsd:string"/>
    	</message>
    	<message name="getAllPhotoNamesResponse">
    		<part name="return" type="xsd:anyType"/>
    	</message>
     
    	<message name="getEtapeProspRequest">
    		<part name="user" type="xsd:string"/>
    		<part name="motpasse" type="xsd:string"/>
    	</message>
    	<message name="getEtapeProspResponse">
    		<part name="return" type="xsd:anyType"/>
    	</message>
     
    	<!-- partie 4 : Port Type -->
    	<portType name="ClientPort">
    		<!-- partie 5 : Operation -->
    		<operation name="getClient">
    			<input message="typens:getClientRequest"/>
    			<output message="typens:getClientResponse"/>
    		</operation>
    		<operation name="getCredit">
    			<input message="typens:getCreditRequest"/>
    			<output message="typens:getCreditResponse"/>
    		</operation>
    		<operation name="getEcheancier">
    			<input message="typens:getEcheancierRequest"/>
    			<output message="typens:getEcheancierResponse"/>
    		</operation>
    		<operation name="getUrlPhotos">
    			<input message="typens:getUrlPhotosRequest"/>
    			<output message="typens:getUrlPhotosResponse"/>
    		</operation>
    		<operation name="getModificationClient">
    			<input message="typens:getModificationClientRequest"/>
    			<output message="typens:getModificationClientResponse"/>
    		</operation>
    		<operation name="getModificationEcheance">
    			<input message="typens:getModificationEcheanceRequest"/>
    			<output message="typens:getModificationEcheanceResponse"/>
    		</operation>
    		<operation name="getModificationCredit">
    		  <input message="typens:getModificationCreditRequest"/>
    		  <output message="typens:getModificationCreditResponse"/>
    		</operation>
    		<operation name="getAllPhotoNames">
    		  <input message="typens:getAllPhotoNamesRequest"/>
    		  <output message="typens:getAllPhotoNamesResponse"/>
    		</operation>
    		<operation name="getEtapeProsp">
    			<input message="typens:getEtapeProspRequest"/>
    			<output message="typens:getEtapeProspResponse"/>
    		</operation>
    	</portType>
     
    	<!-- partie 6 : Binding -->
    	<binding name="ClientBinding" type="typens:ClientPort">
    		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    		<operation name="getClient">
    			<soap:operation soapAction="ClientAction"/>
    			<input name="getClientRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getClientResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    		<operation name="getCredit">
    			<soap:operation soapAction="CreditAction"/>
    			<input name="getCreditRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getCreditResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    		<operation name="getEcheancier">
    			<soap:operation soapAction="EcheancierAction"/>
    			<input name="getEcheancierRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getEcheancierResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    		<operation name="getUrlPhotos">
    			<soap:operation soapAction="UrlPhotosAction"/>
    			<input name="getUrlPhotosRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getUrlPhotosResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    		<operation name="getModificationClient">
    			<soap:operation soapAction="ModificationClientAction"/>
    			<input name="getModificationClientRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getModificationClientResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    		<operation name="getModificationCredit">
    			<soap:operation soapAction="ModificationCreditAction"/>
    			<input name="getModificationCreditRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getModificationCreditResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    		<operation name="getModificationEcheance">
    		  <soap:operation soapAction="ModificationEcheanceAction"/>
    		  <input name="getModificationEcheanceRequest">
    			<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    		  </input>
    		  <output name="getModificationEcheanceResponse">
    			<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    		  </output>
    		</operation>
    		<operation name="getAllPhotoNames">
    			<soap:operation soapAction="AllPhotoNamesAction"/>
    			<input name="getAllPhotoNamesRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getAllPhotoNamesResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    		<operation name="getEtapeProsp">
    			<soap:operation soapAction="EtapeProspAction"/>
    			<input name="getEtapeProspRequest">
    				<soap:body 	use="encoded" 	namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</input>
    			<output name="getEtapeProspResponse">
    				<soap:body 	use="encoded" namespace="urn:Client" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    			</output>
    		</operation>
    	</binding>
     
    	<!-- partie 7 : Service -->
    	<service name="ClientService">
    		<documentation></documentation>
    		<!-- partie 8 : Port -->
    		<port name="ClientPort" binding="typens:ClientBinding">
    			<soap:address location="http://192.168.1.123/imfmobile/webservice/InterfaceTransfererClient.php"/>
    		</port>
    	</service>
    </definitions>
    Et voici le PHP webservice :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    <?php
     
       	ini_set("soap.wsdl_cache_enabled", "0");
    	$serveurSOAP = new SoapServer('Client.wsdl');
    	$serveurSOAP->addFunction('getClient');
    	$serveurSOAP->addFunction('getCredit');
    	$serveurSOAP->addFunction('getEcheancier');
    	$serveurSOAP->addFunction('getUrlPhotos');
    	$serveurSOAP->addFunction('getModificationClient');
    	$serveurSOAP->addFunction('getModificationCredit');
    	$serveurSOAP->addFunction('getModificationEcheance');
    	$serveurSOAP->addFunction('getAllPhotoNames');
    	$serveurSOAP->addFunction('getEtapeProsp');
    	if ($_SERVER['REQUEST_METHOD'] == 'POST')
    	{
    		$serveurSOAP->handle();
    	}
    	else
    	{
    	echo 'désolé, je ne comprends pas les requêtes GET, veuillez seulement utiliser POST';
    	}
     
    	function convertDateFormat4($str)
        {
    	   $tmp=$str;
    	   $Y=substr($tmp, 0,4); 
    	   $M=substr($tmp, 5,2);  
    	   $D=substr($tmp, 8,2); 	   
    	   $tmp=$D.'/'.$M.'/'.$Y;
    	   return $tmp;
    	}
    	function convertDateFormat($str)
        {
    	   $tmp=$str;
    	   $Y=substr($tmp, -4,4); 
    	   $M=substr($tmp, 3,2); 
    	   $D=substr($tmp, 0,2); 	   
    	   $tmp=$Y.'-'.$M.'-'.$D;
    	   return $tmp;
    	}
    	function toTimeStamp($str) 
    	 {
    	 	$tmp=$str;
    	 	$M=substr($tmp, 5,2); 
    		$D=substr($tmp, 8,2); 
    		$Y=substr($tmp, 0,4); 
      		return mktime (0, 0, 0, $M, $D,$Y);
    	 }
    	function convertDateFormatHM($str)
        {
    	   $tmp=$str;
    	   $Y=substr($tmp, 0,4); 
    	   $M=substr($tmp, 5,2);  
    	   $D=substr($tmp, 8,2);
    	   $H=substr($tmp, 11,2);
    	   $MN=substr($tmp, 14,2);
    	   $tmp=$D.'/'.$M.'/'.$Y.' '.$H.'h '.$MN.'mn';
    	   return $tmp;
    	}
     
     
    	 function verifyUser($user, $motpasse) {
    	 	$ok = null ;
    		$connec = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
    		mysql_select_db("finance",$connec);
    	$query=mysql_query("SELECT  user_code FROM utilisateur WHERE user_login = '".$user."' AND user_passwd = md5('".$motpasse."')");
    		if (mysql_num_rows($query)== 1) 
    		{
    			$ligne = mysql_fetch_array($query);
    			$ok = $ligne['user_code'] ;
    		}	
    		return $ok;
     	 }
     
    	function getClient($user,$motpasse) 
        	{
     
    		$user_code = verifyUser($user, $motpasse) ;
    	   	if ( $user_code != null) {
    	   		$chaine = "" ;
    	  		$datejour=date("Y-m-d");
    	  		$connec = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
    	  		mysql_select_db("finance",$connec);
    			$query=mysql_query("SELECT * FROM prospect INNER JOIN transfert ON
    			prospect.prosp_id = transfert.prosp_id
    			WHERE transfert.user_code ='". $user_code ."' AND date_transfert='".$datejour."'") ;
    			while($ligne = mysql_fetch_array($query))
            		{
    				$chaine .=$ligne['prosp_id'].';';
    				$chaine .=$ligne['prosp_cin'].';';
    				$chaine .=$ligne['prosp_nom'].';';
    				$chaine .=$ligne['prosp_prenom'].';';
    				$chaine .=convertDateFormat4($ligne['prosp_date_naiss']).';';
    				$chaine .=$ligne['prosp_prof'].';';
    				$chaine .=$ligne['prosp_genre'].';';
    				$chaine .=$ligne['prosp_lieu_resid'].';';
    				$chaine .=$ligne['prosp_tel'].';';
    				$chaine .=$ligne['prosp_courriel'].';';
    				$chaine .=$ligne['prosp_adresse'].';';
    				$chaine .=$ligne['prosp_filiere_princ'].';';
    				$chaine .=$ligne['prosp_filiere_second'].';';
    				$chaine .=$ligne['prosp_solde_dat'].';';
    				$chaine .=$ligne['prosp_solde_dav'].';';
    				$chaine .=$ligne['prosp_activ_second'].';';
    				$chaine .=$ligne['prosp_reclame'].';';
    				$chaine .=$ligne['prosp_besoins'].';';
    				$chaine .=$ligne['prosp_objet_fin'].';';
    				$chaine .=$ligne['prosp_besoin_de_fin'].';';
    				$chaine .=$ligne['prosp_schema_de_fin'].';';
    				$chaine .=convertDateFormat4($ligne['prosp_date_deblo']).';';
    				$chaine .=$ligne['prosp_duree'].';';
    				$chaine .=$ligne['prosp_echeancier_de_remb'].';';
    				$chaine .=$ligne['prosp_impaye'].';';
    				$chaine .=$ligne['prosp_encours'];
     
    				$chaine .= "\r\n" ;
     
    			}
    	  	 }
    	   	else 
    	   	{
    	   		$chaine = "Login ou mot de passe incorrect" ;
    	   	}
    	   	return $chaine;
    	}
     
    	function getCredit($user,$motpasse)
    	{
     
    		$user_code = verifyUser($user, $motpasse) ;
    		if ( $user_code != null) {
    	    		$datejour=date("Y-m-d");
    			$resultat="";
    	  		$connec = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
    	  		mysql_select_db("finance",$connec);
    			$query = mysql_query("SELECT * FROM credit WHERE prosp_id IN 
    			(SELECT prosp_id FROM transfert WHERE user_code ='".$user_code ."' AND date_transfert='".$datejour."')");
    			while($ligne = mysql_fetch_array($query))
    		    	{
    			 $resultat .=$ligne['prosp_id'].';';
    			 $resultat .=$ligne['cred_id'].';';
    			 $resultat .=$ligne['cred_ref'].';';
    			 $resultat .=$ligne['prod_code'].';';
    			 $resultat .=$ligne['cred_objet'].';';
    			 $resultat .=$ligne['cred_mnt_decaisse'].';';
    			 $resultat .=$ligne['duree'].';';
    			 $resultat .=convertDateFormat4($ligne['cred_date_decaisse']).';';
    			 $resultat .=$ligne['cred_teg'].';';
    			 $resultat .=$ligne['cred_taux_interet'].';';
    			 $resultat .=$ligne['cred_mnt_remb'].';';
    			 $resultat .=$ligne['cred_impaye_30'].';';
    			 $resultat .=$ligne['cred_impaye_60'].';';
    			 $resultat .=$ligne['cred_impaye_90'].';';
    			 $resultat .=$ligne['cred_impaye_plus_90'].';';
    			 $resultat .=$ligne['encours'].';';
    			 $resultat .=$ligne['echeance'];
    			 $resultat .="\r\n";
    		 	}
    		}
    		else {
    	   		$resultat = "Login ou mot de passe incorrect" ;
    	   	}
    	    return $resultat;
    	}
    	function getEcheancier($user,$motpasse)
    	{
     
    		$user_code = verifyUser($user, $motpasse) ;
    		if ( $user_code != null) {
    			$datejour=date("Y-m-d");
    			$chaine="";
    	  		$connec = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
    	  		mysql_select_db("finance",$connec);
    			$req=mysql_query("SELECT * FROM echeance WHERE cred_id IN 
    			(SELECT cred_id FROM credit WHERE prosp_id IN 
    			(SELECT prosp_id FROM transfert WHERE user_code ='".$user_code ."' AND date_transfert='".$datejour."'))");
    			while($ligne = mysql_fetch_array($req))
    		    	{
    				 $chaine .=$ligne['eche_id'].';';
    				 $chaine .=$ligne['remb_id'].';';
    				 $chaine .=$ligne['cred_id'].';';
    				 $chaine .=convertDateFormat4($ligne['eche_date']).';';
    				 $chaine .=$ligne['eche_montant'].';';
    				 $chaine .=$ligne['eche_paye'].';';
    				 $chaine .=$ligne['eche_retard'].';';
    				 $chaine .=$ligne['eche_nb_retard'].';';
    				 $chaine .=$ligne['eche_crd'].';';
    				 $chaine .=$ligne['eche_rembourse'].';';
    				 $chaine .=$ligne['eche_interet'].';';
    				 $chaine .=$ligne['eche_flagpaie'];
    				 $chaine .= "\r\n" ;
    			 }
    		}
    		else 
    		{
    	   		      $chaine = "Login ou mot de passe incorrect" ;
    	    }
    	   return $chaine;
    	}
     
    	function getUrlPhotos($user,$motpasse)
    	{
    		$user_code = verifyUser($user, $motpasse) ;
    		if ( $user_code != null) 
    		{
    	    		$datejour=date("Y-m-d");
    				$resultat="";
    		  		$connec = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
    		  		mysql_select_db("finance",$connec);
    				$query = mysql_query("SELECT * FROM image WHERE prosp_id IN 
    				(SELECT prosp_id FROM transfert WHERE user_code ='".$user_code ."' AND date_transfert='".$datejour."')");
    				while($ligne = mysql_fetch_array($query))
    				{
    					 $resultat .=$ligne['img_id'].';';
    					 $resultat .=$ligne['prosp_id'].';';
    					 $resultat .=$ligne['img_titre'].';';
    					 $resultat .=$ligne['img_desc'].';';
    					 $resultat .=$ligne['img_fichier'];
    					 $resultat .="\r\n";
    				}
    			}
    		else
    		{
    	   		$resultat = "Login ou mot de passe incorrect" ;
       		}
    		return $resultat;
    	}
    	function getModificationClient($client)
    	{
     
    		$resultat=explode("\n",$client);
    		$connec = mysql_connect("192.168.1.123:3306","root", "mysqlroot");
    		mysql_select_db("finance",$connec);
    		for($i = 0; $i < count($resultat) ; $i++)
    		{
    				$valeur=explode(";",$resultat[$i]);
    	   			$requete = mysql_query("UPDATE prospect SET prosp_id = '".$valeur[0]."', 
    	         	prosp_cin    = '".$valeur[1]."',
    		     	prosp_nom    = '".$valeur[2]."',
    		    	prosp_prenom = '".$valeur[3]."',
    				prosp_date_naiss = '".convertDateFormat($valeur[4])."',
    				prosp_prof = '".$valeur[5]."',
    				prosp_genre = '".$valeur[6]."',
    				prosp_lieu_resid = '".$valeur[7]."',
    				prosp_tel = '".$valeur[8]."',
    				prosp_courriel = '".$valeur[9]."',
    				prosp_adresse = '".$valeur[10]."',
    				prosp_filiere_princ = '".$valeur[11]."',
    				prosp_filiere_second = '".$valeur[12]."',
    				prosp_solde_dat = '".$valeur[13]."',
    				prosp_solde_dav = '".$valeur[14]."',
    				prosp_activ_second = '".$valeur[15]."',
    				prosp_reclame = '".$valeur[16]."',
    				prosp_besoins = '".$valeur[17]."',
    				prosp_objet_fin = '".$valeur[18]."',
    				prosp_besoin_de_fin = '".$valeur[19]."',
    				prosp_schema_de_fin = '".$valeur[20]."',
    				prosp_date_deblo = '".convertDateFormat($valeur[21])."',
    				prosp_duree = '".$valeur[22]."',
    				prosp_echeancier_de_remb = '".$valeur[23]."',
    				prosp_impaye = '".$valeur[24]."',
    				prosp_encours = '".$valeur[25]."'
    		     	WHERE prosp_id = '".$valeur[0]."'");
    		}
     
    		return $resultat[0];
    	}
    	function getModificationCredit($credit)
    	{
    		$resultat=explode("\n",$credit);
    		$connec = mysql_connect("192.168.1.123:3306","root", "mysqlroot");
    		mysql_select_db("finance",$connec);
    		for($i = 0; $i < count($resultat) ; $i++)
    		{
    				$valeur=explode(";",$resultat[$i]);
    	   			$requete = mysql_query("UPDATE credit SET cred_id = '".$valeur[0]."', 
    	         	prod_code    = '".$valeur[1]."',
    				prosp_id    = '".$valeur[2]."',
    		     	cred_ref    = '".$valeur[3]."',
    		    	cred_objet = '".$valeur[4]."',
    				cred_mnt_decaisse = '".$valeur[5]."',
    				duree = '".$valeur[6]."',
    				cred_date_decaisse = '".convertDateFormat($valeur[7])."',
    				cred_teg = '".$valeur[8]."',
    				cred_taux_interet = '".$valeur[9]."',
    				cred_mnt_remb = '".$valeur[10]."',
    				cred_impaye_30 = '".$valeur[11]."',
    				cred_impaye_60 = '".$valeur[12]."',
    				cred_impaye_90 = '".$valeur[13]."',
    				cred_impaye_plus_90 = '".$valeur[14]."',
    				encours = '".$valeur[15]."',
    				echeance = '".$valeur[16]."'
    		     	WHERE cred_id = '".$valeur[0]."'");
    		}
     
    		return $resultat[0];
     
    	}
    	function getModificationEcheance($echeance)
    	{
    		$resultat=explode("\n",$echeance);
    		$connec = mysql_connect("192.168.1.123:3306","root", "mysqlroot");
    		mysql_select_db("finance",$connec);
    		for($i = 0; $i < count($resultat) ; $i++)
    		{
    				$valeur=explode(";",$resultat[$i]);
    	   			$requete = mysql_query("UPDATE echeance SET eche_id = '".$valeur[0]."', 
    	         	remb_id    = '".$valeur[1]."',
    				cred_id    = '".$valeur[2]."',
    		     	eche_date    = '".convertDateFormat($valeur[3])."',
    		    	eche_montant = '".$valeur[4]."',
    				eche_paye = '".$valeur[5]."',
    				eche_retard = '".$valeur[6]."',
    				eche_nb_retard = '".$valeur[7]."',
    				eche_crd = '".$valeur[8]."',
    				eche_rembourse = '".$valeur[9]."',
    				eche_interet = '".$valeur[10]."',
    				eche_flagpaie = '".$valeur[11]."'
    		     	WHERE eche_id = '".$valeur[0]."'");
    		}
    		return $resultat[0];
    	}
    	function getAllPhotoNames($user,$motpasse)
    	{
    		$user_code    = verifyUser($user, $motpasse) ;
    		if ( $user_code != null) 
    		{
    			$datejour = date("Y-m-d");
    			$connec   = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
    			mysql_select_db("finance",$connec);
    			$query    = mysql_query("SELECT * FROM image WHERE prosp_id IN (SELECT prosp_id FROM transfert WHERE user_code ='".$user_code ."' AND date_transfert='".$datejour."') order by prosp_id, img_id");
    			$lastDossier = "";
    			$resultat = "";
    			while($ligne = mysql_fetch_array($query))
    			{
    				$photoPath = $ligne['img_fichier'];
    				$photoPathArray = explode('/', $photoPath);
    				$nom  = end($photoPathArray);
    				$dossier = prev($photoPathArray);
    				if ($dossier == "4X4")
    				{
    					$dossier = prev($photoPathArray);
    					$nom .= "(4X4)";
    				}
    				if ($dossier != $lastDossier)	// changement de prospect
    				{
    					if ($lastDossier != "")
    					{
    						$resultat .= "\r\n";
    					}
    					$lastDossier = $dossier;
    					$resultat .= $dossier.";".$nom.";";
    				}
    				else
    				{
    					$resultat .= $nom.";";
    				}
    			}
    			$resultat .= "\r\n" ;
    		}
    		else
    		{
    	   		$resultat = "Login ou mot de passe incorrect" ;
       		}
    		return $resultat;
    	}
    	function getEtapeProsp($user, $motpasse)
    	{
    		$user_code = verifyUser($user, $motpasse) ;
    	   	if ( $user_code != null) {
    	   		$chaine = "" ;
    	  		$datejour=date("Y-m-d");
    	  		$connec = mysql_connect("192.168.1.123:3306", "root", "mysqlroot");
    	  		mysql_select_db("finance",$connec);
    			$requete = "SELECT * FROM etape_prospection INNER JOIN type_prospection ON
    			etape_prospection.type_prosp_id = type_prospection.type_prosp_id
    			WHERE etape_prospection.prosp_id IN (select transfert.prosp_id from transfert where transfert.user_code ='". $user_code ."' AND transfert.date_transfert='".$datejour."')";
    			$query=mysql_query($requete) ;
    			while($ligne = mysql_fetch_array($query))
            		{
    				$chaine .=$ligne['ETAPE_PROSP_ID'].';';
    				$chaine .=$ligne['type_prosp_lib'].';';
    				$chaine .=convertDateFormatHM($ligne['ETAPE_PROSP_DATE']).';';
    				$chaine .=$ligne['ETAPE_PROSP_COMMENT'].';';
    				$chaine .=$ligne['PROSP_ID'].';';
     
    				$chaine .= "\r\n" ;
     
    			}
    	  	 }
    	   	else 
    	   	{
    	   		$chaine = "Login ou mot de passe incorrect" ;
    	   	}
    	   	return $chaine;
    	}
    ?>
    Lorsque je consulte à partir de SQLYog Entreprise la structure de la base de données alors je vois que la collation de toutes les tables est latin1_swedish_ci , et que le "default charset" des deux tables concernées est latin1.

    Quand il n'y a pas d'accent dans le contenu de la colonne ETAPE_PROSP_COMMENT de la table etape_prospection alors tout va bien : le service web retourne la chaîne désirée ; mais quand je mets par exemple un "é" dans la colonne ETAPE_PROSP_COMMENT alors l'exception suivante est rencontrée dans l'application java au niveau de la méthode "call" :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    expected: END_TAG {http://schemas.xmlsoap.org/soap/envelope/}Body (position:END_TAG </{http://schemas.xmlsoap.org/soap/envelope/}SOAP-ENV:Fault>@2:297 in java.io.InputStreamReader@e5125d64)
    Alors comment faire pour que le service web supporte les accents ?

  2. #2
    Membre du Club
    Inscrit en
    Juillet 2006
    Messages
    242
    Détails du profil
    Informations forums :
    Inscription : Juillet 2006
    Messages : 242
    Points : 56
    Points
    56
    Par défaut
    J'ai enfin trouvé la solution : j'ai passé la fonction PHP à $ligne['ETAPE_PROSP_COMMENT'].

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Web Service][API Google Maps] Ne fonctionne pas en ligne
    Par PRACH dans le forum Bibliothèques et frameworks
    Réponses: 4
    Dernier message: 07/12/2009, 10h30
  2. [Web Service] Consommer un WebService .Net depuis PHP en asynchrone
    Par Joooooon dans le forum Bibliothèques et frameworks
    Réponses: 6
    Dernier message: 02/04/2009, 16h15
  3. Réponses: 0
    Dernier message: 06/06/2008, 17h03
  4. [Web Service][SOAP] NuSOAP Webservice Sur tous serveurs ?
    Par Harry dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 05/01/2006, 14h59

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo