0 Replies Latest reply on Feb 13, 2008 3:55 AM by rony

    Web service hosted but client program cannot access it ERROR

    rony Newbie

      hi, pls help me,

      my problem is
      i have hosted the WEb services successfully, i can that in the below URL
      http://localhost/jbossws/services
      Environment is
      Jboss 4.2.2,
      jdk jdk1.5.0_12
      web service end point is EJB3

      But i when i am trying to access it through a Client i am getting some

      exceptions from JBOSS Side

      14:03:31,234 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
      javax.xml.rpc.soap.SOAPFaultException: Endpoint {http://test.main.i9check.source/}GreeterPort does not contain operation meta
      data for: sayhello
      at org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC.exceptionToFaultMessage(SOAPFaultHelperJAXRPC.java:189)
      at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:157)
      at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
      at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:645)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:430)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
      at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      at java.lang.Thread.run(Thread.java:595)

      and in the client Side Exception is

      com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl cannot be cast to com.sun.xml.messaging.saaj.soap.MessageImpl



      my client code is

      package source.web.user;


      import java.net.URL;

      import javax.xml.namespace.QName;
      import javax.xml.rpc.Call;
      import javax.xml.rpc.ParameterMode;
      import javax.xml.rpc.Service;
      import javax.xml.rpc.ServiceFactory;
      import javax.xml.rpc.encoding.XMLType;
      import javax.xml.rpc.soap.SOAPFaultException;





      public class HelloClient
      {

      static String WSDLLoc="http://127.0.0.1/i9check/TestWebServicesBean";
      static String serviceName="http://test.main.i9check.source/";
      static String portType="TestWebServicesBean";
      static String serviceEndPointAddress=WSDLLoc;
      static String nameSpace="http://test.main.i9check.source";


      public static void main(String[] args)

      {


      try {

      URL wsUrl = new URL(WSDLLoc+"?wsdl");
      /*QName operationName = new QName(nameSpace,serviceName);
      Service service = Service.create(wsUrl,operationName);
      Call call = service.createCall(portName, operationName);*/

      /* Service lookup */
      ServiceFactory serviceFactory = ServiceFactory.newInstance();
      //Service service = serviceFactory.createService(wsUrl, new QName(serviceName));
      Service service = serviceFactory.createService(wsUrl, new QName(serviceName,"Greeter"));

      /* Service access */
      Call call = (Call) service.createCall();
      call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "http://schemas.xmlsoap.org/soap/encoding/");
      call.setProperty(Call.OPERATION_STYLE_PROPERTY, "rpc");
      call.setTargetEndpointAddress(serviceEndPointAddress);
      call.removeAllParameters();
      call.setPortTypeName(new QName(portType));
      call.setOperationName(new QName("sayhello"));
      //if (call.isParameterAndReturnSpecRequired(call.getOperationName())){
      call.addParameter("in0", XMLType.XSD_STRING,ParameterMode.IN);
      call.setReturnType(XMLType.XSD_STRING);
      //}

      /* Service invocation */
      call.invoke(new Object[] {"Rony"});

      }
      catch (SOAPFaultException sfe){
      System.out.println("Detail "+sfe.getDetail());
      System.out.println("getFaultCode "+sfe.getFaultCode());
      System.out.println("getFaultString "+sfe.getFaultString());
      System.out.println("getFaultActor "+sfe.getFaultActor());


      }

      catch (javax.xml.ws.soap.SOAPFaultException sfe){
      System.out.println("getCause "+sfe.getCause());
      System.out.println("getStackTrace "+sfe.getStackTrace());
      System.out.println("getFaultCode "+sfe.getFault());



      }




      catch(Exception ex) {System.out.println("Exception "+ex.getMessage());}
      }
      }