Monday, February 8, 2010

WebLogic: invoking web services and clientgen

From your Web Service  (or JPD process), generate the WSDL (say HelloWorldSyncContract.WSDL).

In Workshop, Right Click on the WSDL, and do "clientgen": this will generate a HelloWorldSyncContract.jar file.

Put the jar file in the lib directory of your Test project.

You are now ready to code tests.... once you sort our all the NoClassDefFound that you will get... you need to add some 10 modules to your classpath:

Here is a list of modules:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Oracle WebLogic Server v10.3 JRE"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
    <classpathentry kind="src" path=".apt_src">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="com.bea.workshop.wls.j2eelib/wls-commonslogging-bridge-war/exact/1.0"/>
    <classpathentry kind="lib" path="lib/CompanyDBWS.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/workshop_10.3/weblogic-beehive/lib/controls/weblogic-webservice-control.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/workshop_10.3/weblogic-beehive/lib/controls/runtime/weblogic-controls.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/org.apache.beehive_1.0.2.2/apache-beehive-svn-snapshot/lib/controls/beehive-controls.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/wlserver_10.3/server/lib/wseeclient.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.descriptor_1.4.0.0.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.descriptor.j2ee_1.1.0.0.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/glassfish.jaxws.rt_2.1.3.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.weblogic.saaj_1.3.0.0.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.xml.staxb.runtime_1.3.0.0.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.weblogic.workmanager_1.4.0.0.jar"/>
  
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.utils.classloaders_1.4.0.0.jar"/>
  
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.utils.full_1.4.0.0.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.logging_1.4.0.0.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.management.core.binding_2.3.0.0.jar"/>
    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.management.core_2.3.0.0.jar"/>

    <classpathentry kind="lib" path="C:/beaosb/modules/com.bea.core.i18n_1.4.0.0.jar"/>



    <classpathentry kind="output" path="build/classes"/>
</classpath>



I have struggled with JavaClassFinder (precious tool!) to find out all these libraries.

Anyway we have 2 ways:
the JAX-WS
http://download-llnw.oracle.com/docs/cd/E12840_01/wls/docs103/webserv/client.html
and the RPC way
http://download-llnw.oracle.com/docs/cd/E12840_01/wls/docs103/webserv_rpc/client.html


You can learn from WebLogic examples file:///C:/beawli/wlserver_10.3/samples/server/docs/core/index.html


Later note: in fact WebLogic already gives you all the jars you need in the famous wseeclient.zip 

See here
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv/client.html#wp229351

So.... read carefully documentation before you start chasing things around...
 

No comments: