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
3131
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 *
-
Php
javascript
CSS
HTML
Xml
Perl
C
C++
Java
VB.Net
Script Batch
C#.Net
Visual Basic
VBA
Shell
mIRC
Latex
OCaml
pascal
MySQL
MatLab
Fichier .ini
SmallTalk
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
Php
(58)
javascript
(35)
CSS
(20)
HTML
(16)
Xml
(17)
Perl
(11)
C
(64)
C++
(51)
Java
(48)
VB.Net
(5)
Script Batch
(8)
C#.Net
(4)
Visual Basic
(6)
VBA
(5)
Shell
(10)
mIRC
(3)
Latex
(6)
OCaml
(4)
pascal
(9)
MySQL
(13)
MatLab
(3)
Fichier .ini
(5)
SmallTalk
(1)
Autre
(17)
\n
Forum informatique