<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: Cannot find ServiceFactory implementation Problem
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/marklenders">marco gentile</a> in <i>JBoss Web Services Development</i> - <a href="https://community.jboss.org/message/762999#762999">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p> thanks for your replies.</p><p>I achieved to create a java client (java project) to connect to SugarCRM, without errors.</p><p>Below, I write a snippet of code:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>-------------------------------------------------</p><p>....</p><p>import javax.xml.rpc.ServiceFactory;</p><p>....</p><p>String sessionID = null;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Create a URL end point for the client</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; URL wsdlUrl = null;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (END_POINT_URL.isEmpty()) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; wsdlUrl = new URL(</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new SugarsoapLocator().getsugarsoapPortAddress()</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + "?wsdl");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } else {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; wsdlUrl = new URL(END_POINT_URL);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("URL endpoint created successfully!");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Create Service for test configuration</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="text-decoration: underline;"><strong><em>ServiceFactory serviceFactory = ServiceFactory.newInstance();</em></strong></span></p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Service service = serviceFactory.createService(wsdlUrl,</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new SugarsoapLocator().getServiceName());</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Service created successfully");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Service Name:"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + service.getServiceName().toString());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Service WSDL:"</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; + service.getWSDLDocumentLocation().toString());</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Trying to create a stub</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SugarsoapBindingStub binding = new SugarsoapBindingStub(wsdlUrl,</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; service);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; binding.setTimeout(TIMEOUT);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Stub created successfully!");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /**</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * Try to login on SugarCRM</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * 1) Prepare a MD5 hash password 2) Prepare a User Auth object 3)</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * Execute login</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 1. Prepare a MD5 hash password</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MessageDigest messageDiget = MessageDigest.getInstance("MD5");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; messageDiget.update(USER_PASSWORD.getBytes());</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 2. Prepare a User Auth object</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; User_auth userAuthInfo = new User_auth();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; userAuthInfo.setUser_name(USER_NAME);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; userAuthInfo.setPassword((new BigInteger(1, messageDiget.digest()))</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .toString(16));</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; userAuthInfo.setVersion("0.1");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // 3. Execute login</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Set_entry_result loginResult = binding.login(userAuthInfo,</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; APPLICATION_NAME);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Login Successfully for " + USER_NAME);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Your session Id: " + loginResult.getId());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sessionID = loginResult.getId();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (RemoteException ex) {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println("Login failed. Message: " + ex.getMessage());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ex.printStackTrace();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>-------------------------------------------------</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I created an eclipse web project, using <span style="font-size: 10pt;">JBoss 7.1.1 Final version as server.</span></p><p>I created a "login.xhtml" page.. submit button launches a function that belongs to "Login" class.. this function includes upper code.</p><p>When I debug my project on server, eclipse reports this error:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>-------------------------------------------------</p><p>17:33:54,550 INFO&#160; [stdout] (http-localhost-127.0.0.1-8080-2) URL endpoint created successfully!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>17:33:55,807 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)&#160;&#160;&#160;&#160; at javax.xml.rpc.ServiceFactory.newInstance(ServiceFactory.java:110)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>17:33:55,811 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)&#160;&#160;&#160;&#160; at com.brokers.sib.Login.authorization(Login.java:78)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>17:33:55,814 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)&#160;&#160;&#160;&#160; at com.brokers.sib.Login$Proxy$_$$_WeldClientProxy.authorization(Login$Proxy$_$$_WeldClientProxy.java)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>17:33:55,817 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)&#160;&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>17:33:55,821 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)&#160;&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>17:33:55,824 ERROR [stderr] (http-localhost-127.0.0.1-8080-2)&#160;&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>.....</p><p>-------------------------------------------------</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><a class="jive-link-profile-small" href="https://community.jboss.org/people/asoldano">Alessio Soldano</a> I follow your hints but nothing changes. I hope to have given you more info.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/762999#762999">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services Development at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2047">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>