Apache Tomcat(on WIndows7 in my case)
Apache Axis(on WIndows7 in my case)
GSoap (sur Redhat s’exécutant sur Virtual Box dans mon cas)
Vidéo :
Tout d’abord, écrire une fonctionnalité que vous voulez pour être consommé par une application JAVA/C++ comme un Service Web & enregistrer en tant que *.jws à votre directeur d’installation axis (\Tomcat 7.0\webapps\axis). Après cela, exécutez le http:///axis/EncryptDecrypt.jws?wsdl dans votre navigateur pour tester le fichier wsdl.
EncryptDecrypt.jws
public class EncryptDecrypt {}
public String encDec (String _inpDat) {}
String _outDat = new String() ;
int j = 1 ;
if(_inpDat.charAt(0)!='#')
{
_outDat += « # » ;
j = 0 ;
}
pour (int i = j; i < _inpDat.length();i++)
{
_outDat += _inpDat.charAt(0) == « # » ? (char) ((int)_inpDat.charAt(i)-1):(char)((int)_inpDat.charAt(i)+1) ;
}
Return _outDat ;
}}
Deuxièmement, nous concevons l’application cliente en JAVA/C++
JavaWebClient.java
Import org.apache.axis.client.Call ;
public class JavaWebClient {}
public String principal (String args) lève Exception {}
String url="http:///axis/EncryptDecrypt.jws; »
Appel de données = new Call(url) ;
String val = (String)data.invoke ("","encDec", new Object() {args}) ; encDec est le nom de la fonction de EncryptDecrypt.jws
Retour à val ;
}
}
Pour client C++, vous devez exécuter les étapes suivantes sur la console :
wsdl2h -o EncryptDecrypt.h http://:8080/axis/EncryptDecrypt.jws?wsdl (cela va générer un fichier d’en-tête de fichier wsdl)
soapcpp2 -i - C-I / import EncryptDecrypt.h (cela va générer les fichiers de RPC nécessaires pour appeler le service Web)