code: public String getXML(Object root)
      {
          if (root != null)
          {
              try {
                  ByteArrayOutputStream out = new ByteArrayOutputStream();
                  String strSOAPPackage = this.getSOAPPackage();
          
                  Marshaller m = JaxbContexts.getJAXBContexts().getMarshaller(strSOAPPackage);
          
                  synchronized (m)
                  {
                      m.marshal( root, out );
                  }
                  String strXML = out.toString(Constants.STRING_ENCODING);
                  return strXML;
              } catch (IOException ex)  {
                  ex.printStackTrace();   // Never
              } catch (JAXBException ex)   {
                  ex.printStackTrace();
              } catch (java.lang.IllegalArgumentException ex)   {
                  ex.printStackTrace();
              }
          }
          return null;
      }
docs: GetXML Method.