5 Replies Latest reply on Jun 8, 2007 4:31 AM by kike sedes

    problem calling webservice from client

    kike sedes Newbie

      when i try to run the client it raises next exception. I use jboss 4.2 and jbossws 1.2.

      My aplication code is like this:

      public interface SesionSession {

      public com.satdatatelecom.satdataweb.model.session.vo.LoginVO login .......}

      --------------------------------------------------------------------------------------
      -------------------------------------------------------------------------------------- @WebService(endpointInterface="com.satdatatelecom.satdataweb.model.session.session.SesionEndPointInterface", targetNamespace = "http://localhost:8080/jbossws/services/Sesion", serviceName = "loginUsuario")
      @Remote(SesionSession.class)
      @RemoteBinding(jndiBinding = "/ejb3/EJB3SesionEndPointInterface")
      @Stateless
      public class SesionSessionBean implements SesionSession {

      @PersistenceContext(unitName = GlobalNames.PERSISTENCE_UNIT)
      private EntityManager entityManager;

      @WebMethod(action = "urn:Sesion")
      public LoginVO loginUsuario...........................
      ..............................................
      ...........................................
      }
      -
      -------------------------------------------------------------------------------
      ---------------------------------------------------------------------------------------

      @WebService(targetNamespace = "http://net.jboss.org/satdataweb")
      @WebContext(urlPattern="/*")
      @SOAPBinding(style = Style.RPC)
      public interface SesionEndPointInterface extends Remote{

      public LoginVO loginUsuario....................
      ...............................................
      ............................................

      -----------------------------------------------------------------------------------
      ----------------------------------------------------------------------------------

      In the client sidfe i do the following. I think the problem is here but i don´t know why



      public SessionFacadeWSImpl()
      throws InternalErrorException {

      try {
      System.out.println(" -0000001 SFWSI - Kike --->Creando LoginServiceLocator");
      LoginUsuarioLocator locator = new LoginUsuarioLocator();
      sesionSession = (SesionEndPointInterface) locator.getSesionSessionBeanPort(new URL("http://localhost:8080/jbossws/services/Sesion"));
      // DataConexion.getUrl(webService);
      System.out.println("0000002 SFWSI Kike --->Creado LoginServiceLocator , sessionSession ->" + sesionSession.toString() );
      }
      catch (Exception ex) {
      ex.printStackTrace();
      throw new InternalErrorException(ex);
      }
      }

      -----------------------------------------------------------------------------------
      -----------------------------------------------------------------------------------

      and finally this is the stub generated by axis in the client

      .....................
      ........................
      public com.satdatatelecom.satdataweb.services.beans.LoginVO loginUsuario(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3) throws java.rmi.RemoteException, com.satdatatelecom.satdataweb.services.beans.EmpresaNotFoundException, com.satdatatelecom.satdataweb.services.beans.PasswordException, com.satdatatelecom.satdataweb.services.beans.SessionException, com.satdatatelecom.satdataweb.services.beans.UsuarioNotFoundException, com.satdatatelecom.satdataweb.services.beans.ConcesionException, com.satdatatelecom.satdataweb.services.beans.ConcesionEmpresaException {
      if (super.cachedEndpoint == null) {
      throw new org.apache.axis.NoEndPointException();
      }
      System.out.println("---------------- estoy dentro del Stub ---------------");
      org.apache.axis.client.Call _call = createCall();
      _call.setOperation(_operations[0]);
      _call.setUseSOAPAction(true);
      _call.setSOAPActionURI("Sesion");
      System.out.println("---------------- estoy dentro del Stub METIACTION URI---------------");
      _call.setEncodingStyle(null);
      _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://session.session.model.satdataweb.satdatatelecom.com", "loginUsuario"));

      setRequestHeaders(_call);
      setAttachments(_call);
      try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0, arg1, arg2, arg3});



      This is the exception executiong the client




      (400)HTTP method POST is not supported by this URL
      at com.satdatatelecom.satdataweb.model.session.facade.webservice.SessionFacadeWSImpl.loginUsuario(SessionFacadeWSImpl.java:74)
      at com.satdatatelecom.satdataweb.gui.login.DoLogin.doLogin(DoLogin.java:189)
      at com.satdatatelecom.satdataweb.gui.login.thread.LoginThread.run(LoginThread.java:90)
      ***Information about encapsulated exception***
      AxisFault
      faultCode: {http://xml.apache.org/axis/}HTTP
      faultSubcode:
      faultString: (400)HTTP method POST is not supported by this URL
      faultActor:
      faultNode:
      faultDetail:
      {}:return code: 400
      JBossWeb/2.0.0.GA - Informe de Error<!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--> <h1>Estado HTTP 400 - HTTP method POST is not supported by this URL</h1>type Informe de estadomensaje HTTP method POST is not supported by this URLdescripción El requerimiento enviado por el cliente era sintácticamente incorrecto (HTTP method POST is not supported by this URL).<h3>JBossWeb/2.0.0.GA</h3>
      {http://xml.apache.org/axis/}HttpErrorCode:400

      (400)HTTP method POST is not supported by this URL
      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 com.satdatatelecom.satdataweb.services.beans.SesionEndPointInterfaceBindingStub.loginUsuario(SesionEndPointInterfaceBindingStub.java:243)
      at com.satdatatelecom.satdataweb.model.session.facade.webservice.SessionFacadeWSImpl.loginUsuario(SessionFacadeWSImpl.java:51)
      at com.satdatatelecom.satdataweb.gui.login.DoLogin.doLogin(DoLogin.java:189)
      at com.satdatatelecom.satdataweb.gui.login.thread.LoginThread.run(LoginThread.java:90)
      #### [06/06/2007, 10:30:10] ---> Error al conectar. No se puede conectar con el servidor 127.0.0.1: 8080
      [06/06/2007, 10:30:10] ---> Error al conectar. No se puede conectar con el servidor 127.0.0.1: 8080



      I need some help because i don´t know what to do.

        • 1. Re: problem calling webservice from client
          Thomas Diesler Master

          You seem to be using Axis on the client side not jbossws. If this is intentionally, you probably need to go to the Axis forum

          Please use [ code ] when you paste code

          • 2. Re: problem calling webservice from client
            kike sedes Newbie

            Sorry Thomas. Finally i talked to the client developers and now i can use jbossws in the client side.

            The new SessionFacadeWSImpl() would be something like this?

            System.out.println(" -0000001 SFWSI - Kike --->Creando Servicio");
             URL wsdlURL = new URL("http://127.0.0.1:8080/SesionSessionBeanService/SesionSessionBean?wsdl");
             QName serviceName = new QName("http://localhost:8080/jbossws/services/Sesion", "LoginService");
             Service service = Service.create(wsdlURL, serviceName);
             sesionSession = (SesionEndPointInterface)service.getPort(SesionEndPointInterface.class);
             System.out.println("0000002 SFWSI Kike --->Creado Servicio , sessionSession ->" + sesionSession.toString() );
             System.out.println("0000002 SFWSI Kike --->Creado Servicio , service ->" + service.toString() );
            
             BindingProvider bindingProvider = (BindingProvider)sesionSession;
             Map<String, Object> reqContext = bindingProvider.getRequestContext();
             reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, TARGET_ENDPOINT_ADDRESS);
             reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit");
             reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
            


            after it , cain i call the login service from sessionSesion?
            which class hava i to copy in the client? Only the endpointInterface?

            Thanks Thomas
            Regards kike


            • 3. Re: problem calling webservice from client
              kike sedes Newbie

              when i execute the client it askes me for a class, whick does not exists.

              class: localhost.jbossws.services.Sesion.jaxws.EmpresaNotFoundExceptionBean could not be found
               at com.sun.xml.internal.ws.modeler.RuntimeModeler.getClass(Unknown Source)
               at com.sun.xml.internal.ws.modeler.RuntimeModeler.processExceptions(Unknown Source)
               at com.sun.xml.internal.ws.modeler.RuntimeModeler.processRpcMethod(Unknown Source)
               at com.sun.xml.internal.ws.modeler.RuntimeModeler.processMethod(Unknown Source)
               at com.sun.xml.internal.ws.modeler.RuntimeModeler.processClass(Unknown Source)
               at com.sun.xml.internal.ws.modeler.RuntimeModeler.buildRuntimeModel(Unknown Source)
               at com.sun.xml.internal.ws.client.ServiceContextBuilder.processAnnotations(Unknown Source)
               at com.sun.xml.internal.ws.client.ServiceContextBuilder.completeServiceContext(Unknown Source)
               at com.sun.xml.internal.ws.client.WSServiceDelegate.processServiceContext(Unknown Source)
               at com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(Unknown Source)
               at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
               at javax.xml.ws.Service.getPort(Unknown Source)
               at com.satdatatelecom.satdataweb.model.session.facade.webservice.SessionFacadeWSImpl.<init>(SessionFacadeWSImpl.java:47)
               at com.satdatatelecom.satdataweb.data.DataUsuario.getSessionFacade(DataUsuario.java:69)
               at com.satdatatelecom.satdataweb.gui.login.DoLogin.doLogin(DoLogin.java:182)
               at com.satdatatelecom.satdataweb.gui.login.thread.LoginThread.run(LoginThread.java:90)
              ***InternalErrorException
              


              my class is named empresaNotFoundException. Why is it asking me for a class with the same name concatenating it with bean?

              • 4. Re: problem calling webservice from client
                kike sedes Newbie

                i tried to not throw exceptions to see what happens and now i have the same
                problem as when i used axis.

                javax.xml.ws.WebServiceException: HTTP Status-Code 405: HTTP method POST is not supported by this URL
                



                this is what i do in the client:

                URL wsdlURL = null;
                 try {
                 wsdlURL = new URL("http://127.0.0.1:8080/SesionSessionBeanService/SesionSessionBean?wsdl");
                 } catch (MalformedURLException e1) {
                 // TODO Auto-generated catch block
                 e1.printStackTrace();
                 }
                 QName serviceName = new QName("http://localhost:8080/jbossws/services/Sesion", "LoginService");
                 Service service = Service.create(wsdlURL, serviceName);
                 SesionEndPointInterface sesionSession = (SesionEndPointInterface)service.getPort(SesionEndPointInterface.class);
                 System.out.println("0000002 SFWSI Kike --->Creado Servicio , sessionSession ->" + sesionSession.toString() );
                 System.out.println("0000002 SFWSI Kike --->Creado Servicio , service ->" + service.toString() );
                
                 BindingProvider bindingProvider = (BindingProvider)sesionSession;
                 Map<String, Object> reqContext = bindingProvider.getRequestContext();
                 reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/jbossws/services/Sesion/SesionSessionBean");
                 reqContext.put(BindingProvider.USERNAME_PROPERTY, "kermit");
                 reqContext.put(BindingProvider.PASSWORD_PROPERTY, "thefrog");
                
                 try{
                // System.out.println("Conectando con... " + DataConexion.getServer() + ": " + DataConexion.getServerPort());
                 FicheroLog.writeIncidencia("Conectando con... " + DataConexion.getServer() + ": " + DataConexion.getServerPort());
                
                 loginVO = sesionSession.loginUsuario(idEmpresa, login, password, session);
                


                • 5. Re: problem calling webservice from client
                  kike sedes Newbie

                  i could solve the problem adding a pluging to eclipse to show wsdl files. I was calling an url incorrect.

                  Now the client connect to jboss and execute a simple webservice echo, but my service to login crashes, with a error i can`t undestand.

                  The client connects the administration server (jboss) and when i print what is it doing, it prints corrects values and it returns the correct loginVO object, but when it returns to the client i receive the next exception from jboss:


                  2007-06-08 10:13:10,821 ERROR [org.jboss.ws.core.server.AbstractServiceEndpointServlet] Error processing web service request
                  javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
                   - with linked exception:
                  [javax.xml.bind.JAXBException: com.satdatatelecom.satdataweb.model.permiso.vo.ConcesionVO nor any of its super class is known to this context]
                   at org.jboss.ws.core.jaxws.JAXBSerializer.handleMarshallException(JAXBSerializer.java:109)
                   at org.jboss.ws.core.jaxws.JAXBSerializer.serialize(JAXBSerializer.java:89)