JBoss Community

Re: Cannot find ServiceFactory implementation Problem

created by marco gentile in JBoss Web Services Development - View the full discussion

Hi,

thanks for your replies.

I achieved to create a java client (java project) to connect to SugarCRM, without errors.

Below, I write a snippet of code:

 

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

....

import javax.xml.rpc.ServiceFactory;

....

String sessionID = null;

 

        try {

            // Create a URL end point for the client

            URL wsdlUrl = null;

            if (END_POINT_URL.isEmpty()) {

                wsdlUrl = new URL(

                        new SugarsoapLocator().getsugarsoapPortAddress()

                                + "?wsdl");

            } else {

                wsdlUrl = new URL(END_POINT_URL);

            }

 

            System.out.println("URL endpoint created successfully!");

 

            // Create Service for test configuration

            ServiceFactory serviceFactory = ServiceFactory.newInstance();

            Service service = serviceFactory.createService(wsdlUrl,

                    new SugarsoapLocator().getServiceName());

 

            System.out.println("Service created successfully");

            System.out.println("Service Name:"

                    + service.getServiceName().toString());

            System.out.println("Service WSDL:"

                    + service.getWSDLDocumentLocation().toString());

 

            // Trying to create a stub

            SugarsoapBindingStub binding = new SugarsoapBindingStub(wsdlUrl,

                    service);

            binding.setTimeout(TIMEOUT);

            System.out.println("Stub created successfully!");

 

            /**

             * Try to login on SugarCRM

             *

             * 1) Prepare a MD5 hash password 2) Prepare a User Auth object 3)

             * Execute login

             */

 

            // 1. Prepare a MD5 hash password

            MessageDigest messageDiget = MessageDigest.getInstance("MD5");

            messageDiget.update(USER_PASSWORD.getBytes());

 

            // 2. Prepare a User Auth object

            User_auth userAuthInfo = new User_auth();

            userAuthInfo.setUser_name(USER_NAME);

            userAuthInfo.setPassword((new BigInteger(1, messageDiget.digest()))

                    .toString(16));

            userAuthInfo.setVersion("0.1");

 

            try {

                // 3. Execute login

                Set_entry_result loginResult = binding.login(userAuthInfo,

                        APPLICATION_NAME);

                System.out.println("Login Successfully for " + USER_NAME);

                System.out.println("Your session Id: " + loginResult.getId());

                sessionID = loginResult.getId();

            } catch (RemoteException ex) {

                System.out.println("Login failed. Message: " + ex.getMessage());

                ex.printStackTrace();

            }

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

 

I created an eclipse web project, using JBoss 7.1.1 Final version as server.

I created a "login.xhtml" page.. submit button launches a function that belongs to "Login" class.. this function includes upper code.

When I debug my project on server, eclipse reports this error:

 

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

17:33:54,550 INFO  [stdout] (http-localhost-127.0.0.1-8080-2) URL endpoint created successfully!

 

17:33:55,803 ERROR [stderr] (http-localhost-127.0.0.1-8080-2) javax.xml.rpc.ServiceException: Failed to create factory: org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl

 

17:33:55,807 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)     at javax.xml.rpc.ServiceFactory.newInstance(ServiceFactory.java:110)

 

17:33:55,811 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)     at com.brokers.sib.Login.authorization(Login.java:78)

 

17:33:55,814 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)     at com.brokers.sib.Login$Proxy$_$$_WeldClientProxy.authorization(Login$Proxy$_$$_WeldClientProxy.java)

 

17:33:55,817 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 

17:33:55,821 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 

17:33:55,824 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

.....

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

 

Alessio Soldano I follow your hints but nothing changes. I hope to have given you more info.

Reply to this message by going to Community

Start a new discussion in JBoss Web Services Development at Community