Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
948 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  Web services et Java - dilemmes

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Web services et Java - dilemmes

n°1665127
leeea
Posté le 03-01-2008 à 12:42:54  profilanswer
 

bonjour et bonnaney 2008 a tous  :D  
 
 
j'ai la tete dans les web services en ce moment et j'avoue etre plutot novice en la matier
 
je suis confronté a plusieurs problemes :  
 
1) je veux etablir la connection a un web service tournant sur Jonas 4.8 (de type webapp) depuis un client standalone java (donc un simple main)
pour tester, j'ai déployé l'exemple fourni par jonas (jaxrpc);
 
le web service est accessible a l'adresse  
 
"http://localhost:9000/wswarsample/endpoints/jaxrpc?JWSDL"
 
voila le code de mon client qui necessite deux fichiers, HelloDP.java et JaxRpcEndpointInterface.java:  
 
 
import java.net.URL;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import javax.xml.namespace.QName;
 
public class HelloClientDP {
 
 public static void main(String args[]) {
        try {
            // Create a service class with WSDL information.
            QName serviceName = new QName("http://localhost:9000/wswarsample/endpoints/jaxrpc?JWSDL","JaxRpcEndpointInterfaceService" );
           URL wsdlLocation = new URL("http://localhost:9000/wswarsample/endpoints/jaxrpc?JWSDL" );
            ServiceFactory factory = ServiceFactory.newInstance();
            Service service = factory.createService(wsdlLocation,serviceName);
 
            // Get an implementation for the SEI for the given port
            QName portName = new QName("", "JaxRpcEndpoint1" );
            JaxRpcEndpointInterface quote = (JaxRpcEndpointInterface) service.getPort(portName,JaxRpcEndpointInterface.class);
 
           // Invoke the operation
              System.out.println(quote.sayHello("Buzz" ));
        }
        catch (Throwable t) {
            t.printStackTrace();
        }
    }
}
 
 
avec JaxRpcEndpointInterface comme SEI (service endpoint interface)
       JaxRpcEndpointInterfaceService comme nom de service
       JaxRpcEndpoint1 comme nom de port
 
 
 
import java.rmi.Remote;
import java.rmi.RemoteException;
 
public interface JaxRpcEndpointInterface extends Remote {
 
    String sayHello(String name) throws RemoteException;
 
    int getCotes() throws RemoteException;
}
 
 
 
apres compilation et execution, j'obtiens :  
 
javax.xml.rpc.ServiceException: Error processing WSDL document:
javax.xml.rpc.ServiceException: Error processing WSDL document:
javax.xml.rpc.ServiceException: Cannot find service:  {http://localhost:9000/wswarsample/endpoints/jaxrpc?JWSDL}JaxRpcEndpointInterfaceService
        at org.apache.axis.client.Service.initService(Service.java:250)
        at org.apache.axis.client.Service.<init>(Service.java:165)
        at org.apache.axis.client.ServiceFactory.createService(ServiceFactory.ja
va:198)
        at HelloClientDP.main(HelloClientDP.java:17)
 
est-ce du au wsdl? a l'adresse?
 
 
2) -est-il possible de faire tourner un webservice indépendemment d'un serveur, ou alors avec un serveur tres léger?
 
    -peut on établir une communication SOAP de type P2P entre deux agents ?  
 
3)
 
en esperant que quelques ames charitables puissent me repondre  :)  
 

mood
Publicité
Posté le 03-01-2008 à 12:42:54  profilanswer
 

n°1665166
brisssou
8-/
Posté le 03-01-2008 à 14:01:39  profilanswer
 

Citation :

javax.xml.rpc.ServiceException: Cannot find service:

 

donc c'est le serviceName qui doit pas être bon.

 

2/ pourquoi pas, mais comme ton webservice est en Java, "très léger" c'est très relatif.

 

3/ tu peux gérer des sessions, mais pour que le serveur parle au client de façon autonome, il va te falloir un serveur SOAP des deux cotés (je pense)


Message édité par brisssou le 03-01-2008 à 14:01:52

---------------
HFR - Mes sujets pour Chrome - Firefox - vérifie les nouveaux posts des topics suivis/favoris
n°1665181
leeea
Posté le 03-01-2008 à 14:23:10  profilanswer
 

[quotemsg=1665166,2,7025]

Citation :

javax.xml.rpc.ServiceException: Cannot find service:


 
"donc c'est le serviceName qui doit pas être bon."
 
je suis tombé sur un site proposant des webservices
 
http://www.webservicex.net/WS/WSDe [...] 12&WSID=56
wsdl : http://www.webservicex.net/globalweather.asmx?WSDL
 
je teste juste la création du service
 
import java.net.URL;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import javax.xml.namespace.QName;
 
public class HelloClientDP {
 
 public static void main(String args[]) {
        try {
            // Create a service class with WSDL information.
            QName serviceName = new QName("http://www.webservicex.net/globalweather.asmx?WSDL","GlobalWeather" );
           URL wsdlLocation = new URL("http://www.webservicex.net/globalweather.asmx?WSDL" );
            ServiceFactory factory = ServiceFactory.newInstance();
            Service service = factory.createService(wsdlLocation,serviceName);
        }
        catch (Throwable t) {
            t.printStackTrace();
        }
    }
}
 
 
resultat à l'execution :  
 
javax.xml.rpc.ServiceException: Error processing WSDL document:
javax.xml.rpc.ServiceException: Error processing WSDL document:
javax.xml.rpc.ServiceException: Cannot find service:  {http://www.webservicex.net/globalweather.asmx?WSDL}GlobalWeather
        at org.apache.axis.client.Service.initService(Service.java:250)
        at org.apache.axis.client.Service.<init>(Service.java:165)
        at org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
        at HelloClientDP.main(HelloClientDP.java:14)
 
 
c'est donc le code qui est en cause?
 
 
 :sweat:

n°1665183
brisssou
8-/
Posté le 03-01-2008 à 14:26:21  profilanswer
 

ha mais j'en sais rien moi. Je regarde juste l'exception, et c'est le serviceName qui est rebalancé, donc je suppose.  Tu as la même valeur pour ton wsdl, mais je pense que l'exception aurait été différente, quoi que. Essaye de modifier l'un ou l'autre, tu verras la tête de l'exception.
 
tu es sûr de tes ports pour ton serveur ?


---------------
HFR - Mes sujets pour Chrome - Firefox - vérifie les nouveaux posts des topics suivis/favoris

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  Web services et Java - dilemmes

 

Sujets relatifs
Appliquer un motif à une fenetre JavaURL pour s'identifier directement aux services iGoogle
utilisation d'un bean dans une fenêtre javaProbleme sur la suite de conway en java !
probleme java et tokenizer[JAVA] Plugin Eclipse - Comment créer un nouveau Projet
probleme java beanJava - création de dossier et droit d'écriture (linux)
Comment utiliser la machine virtuelle java Microsoft ?Cherche qq'un qui voudrais réécrire mon programme JAVA (ou en Windev)
Plus de sujets relatifs à : Web services et Java - dilemmes


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR