# Steps to build and run Remoting CLI:

i)  Checkout RHQ

ii) Enable [rhq_source]/modules/enterprise/client/src/main/java as a java source directory for your ide. For eclipse users, 'use as source folder'

iii) Build RHQ from [rhq_source] and enable the Webservice endpoints by passing in the following additional parameter at build time:
   -Drhq.server.enable.ws

iv) Run rhq as normal and after startup, verify that your webservices are deployed at http://[server]:7080/jbossws/services

v) Until we figure out how to correctly fit this client side portion into the maven build, or even if, the following will need to be done in your IDE/Dev environment to get the client side JAXB generated types to run the following steps successfully.  Jay is tasked with Maven-izing it.
   a) Open up a shell and navigate to [rhq_source]/modules/enterprise/client/src/ and run generate-jaxb-client-types.sh/bat script to generate all JAXB types to ./output directory.  
   b) Add ./output directory to the top of your classpath setup in your IDE. 
   c) Add the XStream 1.2.2 library from your maven repository to the classpath for your project as well.
   d) Download JLine 0.9.94 library and add it to the classpath for your project as well.

vi) Run the test suite (currently incomplete and we'll be enhancing it as we move forward) by:
  a)Log into the RHQ GUI client and create a new WS test user, u:ws-test p:ws-test and the "Super User" Role.  
  b)You should be able to startup XMLClientMainTest.java from you IDE and run it as a junit test.  


Notes:
-i) Take extra care that the classes that you are using for the exposed SLSBs are coming out of the 'org.rhq.enterprise.server.ws' package only.  Any components that are using types NOT from these client side JAXB elements is using server side types which we do NOT want to do.  We need to continue to operate as a pure JAXB client so that we most closely mimic the operating environment for all WS* clients.  

ii) Sometimes it is helpful when debugging the webservice interface to see what the client side or server side type actually looks like as XML.  XStream, while inefficient for serializing arbitrary java object trees, is much less picky about serializing these object trees so you can get a quick picture of a given object.  JAXB typically will not serialize unless you do some extra coding.


iii) After jaxb type generation may need to:

 A)
Navigate to org.rhq.enterprise.server.ws.ContentManagerRemote.getPackageTypes and change

throws ResourceTypeNotFoundException_Exception
  to 
throws ResourceTypeNotFoundException

 B) Navigate to  and change
public class ResourceTypeNotFoundException {
  to
public class ResourceTypeNotFoundException extends Throwable {

 C) Delete the ResourceTypeNotFoundException_Exception class.
