Partage de codes sources - CodesWall.info
Java
> Simple exemple de client XML-RPC
Titre
Simple exemple de client XML-RPC
Postée le
22-09-2009
Affichée
3526
Mini-lien
Description
Exemple de client XMLRPC permettant d'utiliser le service AfficheIP
Etat
Ne contient pas d'erreurs.
Code d'insertion
Options
Tweet
Téléchargement
/* Simple exemple de client XmlRPC en Java
* utilisant le WebService AfficheIP
*
* http://www.afficheip.net
*/
import
java.net.URL
;
import
org.apache.xmlrpc.client.XmlRpcClient
;
import
org.apache.xmlrpc.client.XmlRpcClientConfigImpl
;
import
javax.swing.JOptionPane
;
public
class
client
{
public
static
void
main
(
String
[
]
args
)
{
try
{
XmlRpcClientConfigImpl config
=
new
XmlRpcClientConfigImpl
(
)
;
config.
setServerURL
(
new
URL
(
"http://www.afficheip.net/RPC"
)
)
;
XmlRpcClient client
=
new
XmlRpcClient
(
)
;
client.
setConfig
(
config
)
;
/* Recupere l'adresse IP */
String
ip
=
(
String
)
client.
execute
(
"afficheip.getIP"
,
new
Object
[
]
{
}
)
;
JOptionPane
.
showMessageDialog
(
null
,
"IP : "
+
ip
)
;
/* Recupere l'host */
String
host
=
(
String
)
client.
execute
(
"afficheip.getHOST"
,
new
Object
[
]
{
}
)
;
JOptionPane
.
showMessageDialog
(
null
,
"HOST : "
+
host
)
;
}
catch
(
Exception
e
)
{
}
}
}
Postez votre code-source
Informations
Catégorie *
-
ActionScript3
ASP
C
C#.Net
C++
COBOL
CSS
Delphi
Fichier .ini
HTML4
HTML5
Java
javascript
jQuery
Latex
MatLab
mIRC
MySQL
Objective-C
OCaml
pascal
Perl
Php
Python
QBasic
Ruby
Script Batch
Shell
SmallTalk
VB.Net
VBA
Visual Basic
XML
Autre
Titre *
(50 car. max)
Description *
(200 car. max)
Le code
Fonctionne
Ne fonctionne pas
Je ne sais pas
Source
* : Champs obligatoires
Fermer
Accueil
Poster
Actualités
Règles
Contact
Partenaires
Infos / Aide
ActionScript3
(0)
ASP
(0)
C
(65)
C#.Net
(4)
C++
(51)
COBOL
(0)
CSS
(21)
Delphi
(0)
Fichier .ini
(5)
HTML4
(16)
HTML5
(2)
Java
(48)
javascript
(35)
jQuery
(0)
Latex
(6)
MatLab
(3)
mIRC
(3)
MySQL
(13)
Objective-C
(1)
OCaml
(4)
pascal
(9)
Perl
(11)
Php
(58)
Python
(3)
QBasic
(1)
Ruby
(1)
Script Batch
(8)
Shell
(10)
SmallTalk
(1)
VB.Net
(5)
VBA
(5)
Visual Basic
(6)
XML
(17)
Autre
(18)
\n
Forum informatique