<!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="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">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;">
    Consuming web service from Coldfusion using JAR created with CXF
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/fleeman">David Fleeman</a> in <i>Beginner's Corner</i> - <a href="http://community.jboss.org/message/545689#545689">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I've successfully generated a JUnit test for a web service deployed to SOA-P.&#160; Below is the working JUnit test:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #808080; font-family: courier new,courier; ">/* START JUNIT CODE */</span></p><p><span style="color: #808080; font-family: courier new,courier; ">package edu.ohio.soa;</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">import java.net.URL;<br/>import java.util.ArrayList;<br/>import java.util.List;</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">import junit.framework.Assert;</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">import org.jboss.soa.peoplesoft_services.GetStudentsService;<br/>import org.junit.Test;</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">import edu.ohio.schema.person.PersonNameId;<br/>import edu.ohio.schema.studentgroupservice.GetStudentsReq;<br/>import edu.ohio.schema.studentgroupservice.GetStudentsRsp;<br/>import edu.ohio.schema.studentgroupservice.StudentInfo;<br/></span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">public class ClientTest {</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">&#160;&#160;&#160; @Test<br/>&#160;&#160;&#160; public void testClient() throws Exception {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Instantiate reference to service<br/><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160; GetStudentsService service = new GetStudentsService(new URL("</span><a class="jive-link-external-small" href="http://localhost:8180/student-group-service-1.0.0/ebws/peoplesoft-services/GetStudents?wsdl" target="_blank">http://localhost:8180/student-group-service-1.0.0/ebws/peoplesoft-services/GetStudents?wsdl</a><span>"));</span></span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Construct the service request<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; GetStudentsReq req = new GetStudentsReq();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; List&lt;String&gt; sg = new ArrayList&lt;String&gt;();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; sg.add("CAP");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; sg.add("ARMY");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; req.setStudentGroup(sg);</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Make the service call and store the response<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; GetStudentsRsp rsp = service.getGetStudentsPortType().getStudentsOp(req);</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Print out key data to verify the response<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (StudentInfo i : rsp.getStudentInfo()) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; PersonNameId name = i.getStudentName();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(name.getOuid() + " " + name.getFirstName() + " " + name.getLastName());<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Assertion that response was successfully returned<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; Assert.assertTrue(rsp!=null);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160; }<br/>}</span></p><p><span style="font-family: courier new,courier;"><span style="color: #808080;">/* END JUNIT COE */</span><br/></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've packaged the code corresponding with this JUnit test into a JAR and put it in the JBoss AS deploy/default/lib folder and restarted AS.&#160; I am wanting to consume the web service from ColdFusion 9 using the Java objects in the JAR file.&#160; However, the last line of code in provided snippet produces an error:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="color: #808080; font-family: courier new,courier; ">/* START CF CODE */</span></p><p><span style="color: #808080; font-family: courier new,courier; ">&lt;cfscript&gt;<br/>&#160;&#160;&#160; serviceURL = CreateObject("java", "java.net.URL");<br/><span>&#160;&#160;&#160; serviceURL.init("</span><a class="jive-link-external-small" href="http://localhost:8180/student-group-service-1.0.0/ebws/peoplesoft-services/GetStudents?wsdl" target="_blank">http://localhost:8180/student-group-service-1.0.0/ebws/peoplesoft-services/GetStudents?wsdl</a><span>");</span><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; "><br/></span></p><p><span style="color: #808080; font-family: courier new,courier; ">&#160;&#160;&#160; serviceRef = CreateObject("java", "org.jboss.soa.peoplesoft_services.GetStudentsService");<br/>&#160;&#160;&#160; serviceRef = serviceRef.init(serviceURL);<br/>&lt;/cfscript&gt;</span></p><p><span style="color: #808080; font-family: courier new,courier; ">/* END CF CODE */</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The produced error is:</p><p><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 8pt; line-height: 11pt; font-size-adjust: none; font-stretch: normal;"><h1 id="textSection1" style="font-style: normal; font-variant: normal; font-weight: normal; line-height: 15pt; font-size-adjust: none; font-stretch: normal;"><span style="color: #808080; font-size: 10pt; font-family: courier new,courier; ">Object&#160; instantiation exception.</span></h1><p><span style="color: #808080; font-size: 10pt; font-family: courier new,courier; "> </span><span style="line-height: 11pt; color: #808080; font-stretch: normal; font-variant: normal; font-size: 10pt; font-style: normal; font-size-adjust: none; font-family: courier new,courier; font-weight: normal; ">An exception occurred while&#160; instantiating a Java object. The class must not be an interface or an&#160; abstract class. Error: ''.</span></p><p><span style="line-height: 11pt; color: #808080; font-stretch: normal; font-variant: normal; font-size: 10pt; font-style: normal; font-size-adjust: none; font-family: courier new,courier; font-weight: normal; ">The error occurred in <strong>C:\jboss\appservers\jboss-eap-5.0\jboss-as\server\default\deploy\cfusion.ear\cfusion.war\index.cfm:&#160; line 71<br/></strong></span></p><span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: 11pt; font-size-adjust: none; font-stretch: normal;"><pre><span style="color: #808080; font-family: courier new,courier; "><strong><span style="font-size: 10pt;">7</span>1 : &#160;&#160;&#160;&#160;&#160;serviceRef = serviceRef.init(serviceURL);</strong></span><br/><br/><span style="font-family: arial,helvetica,sans-serif;">Something is going wrong when trying to use the non-default constructor in the GetStudentsService java object.&#160; I've not been able to find any <br/>useful answer on message boards and this is really holding me up at this point.&#160; Any help is appreciated.&#160; Thanks!<br/></span></pre></span> </span></p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/545689#545689">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


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

</div>

</body>
</html>