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

Services Web Java Discussion :

Erreur 404 lors de l'appel d'un web service


Sujet :

Services Web Java

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Juin 2008
    Messages
    19
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2008
    Messages : 19
    Points : 8
    Points
    8
    Par défaut Erreur 404 lors de l'appel d'un web service
    Bonjour à tous,

    Voilà, je suis entrain de mettre en place un mécanisme d'authentification avec Http Basic Authentication pour accéder à mon web service HelloWorl, j'ai donc voulu tester avec un client Axis sous eclipse (qui l'a generé à partir du wsdl).
    J'ai ajouter des paramètre (Username et Password) dans le HelloWorldImplServiceSoapBindingStub comme suit :
    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
     
    	public java.lang.String sayHi(java.lang.String nom, java.lang.String text)
    			throws java.rmi.RemoteException {
    		if (super.cachedEndpoint == null) {
    			throw new org.apache.axis.NoEndPointException();
    		}
    		org.apache.axis.client.Call _call = createCall();
    		_call.setOperation(_operations[0]);
    		_call.setUseSOAPAction(true);
    		_call.setSOAPActionURI("http://spring.demo/sayHi");
    		_call.setEncodingStyle(null);
    		System.out.println("ESSAI AUTH DEBUT");
    		try {
    			AuthToken t = AuthSingleton.getInstance().getToken(1);
    			_call.setProperty(org.apache.axis.client.Call.USERNAME_PROPERTY, t.getUsername());
    			_call.setProperty(org.apache.axis.client.Call.PASSWORD_PROPERTY, t.getPassword());
    		} catch (Exception e) {
    			System.out.println(e.getMessage());
    		}
     
    		System.out.println("ESSAI AUTH FIN");
    		_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
    				Boolean.FALSE);
    		_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
    				Boolean.FALSE);
    		_call
    				.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
    		_call.setOperationName(new javax.xml.namespace.QName(
    				"http://spring.demo/", "sayHi"));
     
    		setRequestHeaders(_call);
    		setAttachments(_call);
    		try {
    			java.lang.Object _resp = _call.invoke(new java.lang.Object[] { nom,
    					text });
     
    			if (_resp instanceof java.rmi.RemoteException) {
    				throw (java.rmi.RemoteException) _resp;
    			} else {
    				extractAttachments(_call);
    				try {
    					return (java.lang.String) _resp;
    				} catch (java.lang.Exception _exception) {
    					return (java.lang.String) org.apache.axis.utils.JavaUtils
    							.convert(_resp, java.lang.String.class);
    				}
    			}
    		} catch (org.apache.axis.AxisFault axisFaultException) {
    			throw axisFaultException;
    		}
    	}
    Voici un test Junit sur le client :
    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
     
    public class test extends TestCase {
     
    	public void testSayHi() throws ServiceException, RemoteException {
    		demo.spring.HelloWorldImplService service = new demo.spring.HelloWorldImplServiceLocator();
    		demo.spring.HelloWorld port = service.getHelloWorldPort();
    		// final String test = port.sayHi("toto", "titi");
    		try {
     
    			System.out.println(port.sayHi("toto", "titi"));
    		} catch (RemoteException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    	}
    }
    J'ai ainsi une erreur 404 de la sorte et je ne sais pas d'où vient le problè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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
     
    AxisFault
     faultCode: {http://xml.apache.org/axis/}HTTP
     faultSubcode: 
     faultString: (404)Introuvable
     faultActor: 
     faultNode: 
     faultDetail: 
    	{}:return code:  404
    <html><body>No service was found.</body></html>
    	{http://xml.apache.org/axis/}HttpErrorCode:404
     
    (404)Introuvable
    	at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
    	at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
    	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    	at org.apache.axis.client.Call.invoke(Call.java:2767)
    	at org.apache.axis.client.Call.invoke(Call.java:2443)
    	at org.apache.axis.client.Call.invoke(Call.java:2366)
    	at org.apache.axis.client.Call.invoke(Call.java:1812)
    	at demo.spring.HelloWorldImplServiceSoapBindingStub.sayHi(HelloWorldImplServiceSoapBindingStub.java:143)
    	at demo.spring.test.testSayHi(test.java:18)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at junit.framework.TestCase.runTest(TestCase.java:168)
    	at junit.framework.TestCase.runBare(TestCase.java:134)
    	at junit.framework.TestResult$1.protect(TestResult.java:110)
    	at junit.framework.TestResult.runProtected(TestResult.java:128)
    	at junit.framework.TestResult.run(TestResult.java:113)
    	at junit.framework.TestCase.run(TestCase.java:124)
    	at junit.framework.TestSuite.runTest(TestSuite.java:232)
    	at junit.framework.TestSuite.run(TestSuite.java:227)
    	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Avez vous une idée?

  2. #2
    Membre du Club
    Inscrit en
    Mars 2008
    Messages
    112
    Détails du profil
    Informations forums :
    Inscription : Mars 2008
    Messages : 112
    Points : 67
    Points
    67
    Par défaut
    j'ai eu le même problème que toi
    t'a trouvé une solution??

Discussions similaires

  1. Temps lors du premier appel d'un Web Service
    Par kirsito dans le forum Services Web
    Réponses: 6
    Dernier message: 24/08/2012, 09h40
  2. Réponses: 1
    Dernier message: 25/06/2012, 17h52
  3. Enum WSDL null lors de l'appel d'un web service
    Par Babas007 dans le forum Services Web
    Réponses: 0
    Dernier message: 14/04/2011, 10h55
  4. problème de proxy lors d'un appel d'un web service
    Par marwa21 dans le forum Windows Phone
    Réponses: 1
    Dernier message: 10/03/2011, 14h23
  5. problème d'arguments lors de l'appelle d'un web service
    Par hammag dans le forum Services Web
    Réponses: 1
    Dernier message: 24/06/2008, 17h30

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