/**
   * Function to build vocabData body type
   *
   * @param
   * @return BodyType object
   */
  public BodyType getBodyType(RoleType UserConfigurationType) {
    edu.harvard.i2b2.pm.datavo.pm.ObjectFactory of =
        new edu.harvard.i2b2.pm.datavo.pm.ObjectFactory();

    BodyType bodyType = new BodyType();
    bodyType.getAny().add(of.createGetAllRole(UserConfigurationType));
    return bodyType;
  }
  /**
   * Function to build vocabData body type
   *
   * @param
   * @return BodyType object
   */
  public BodyType getBodyType(String str) {
    edu.harvard.i2b2.pm.datavo.pm.ObjectFactory of =
        new edu.harvard.i2b2.pm.datavo.pm.ObjectFactory();

    BodyType bodyType = new BodyType();
    bodyType.getAny().add(of.createSetPassword(str)); // "i2b2"));
    // bodyType.getAny().add(of.createGetAllRole(UserConfigurationType));
    // bodyType.getAny().add(of.createConfigureType(ConfigurationType));
    return bodyType;
  }
  @Test
  public void validSessionUnvalidUsernoXML() throws Exception {
    try {

      GetUserConfigurationType userConfig = new GetUserConfigurationType();
      userConfig.getProject().add("Demo");

      edu.harvard.i2b2.pm.datavo.pm.ObjectFactory of =
          new edu.harvard.i2b2.pm.datavo.pm.ObjectFactory();
      BodyType bodyType = new BodyType();
      bodyType.getAny().add(of.createGetUserConfiguration(userConfig));

      RequestMessageType requestMessageType =
          buildRequestMessage(bodyType, "i2b2", "demouser", "Demo");
      StringWriter strWriter = new StringWriter();
      edu.harvard.i2b2.pm.datavo.i2b2message.ObjectFactory of2 =
          new edu.harvard.i2b2.pm.datavo.i2b2message.ObjectFactory();
      PMJAXBUtil.getJAXBUtil().marshaller(of2.createRequest(requestMessageType), strWriter);

      OMElement requestElement = convertStringToOMElement(strWriter.toString());
      OMElement responseElement = getServiceClient(pmTargetEPR).sendReceive(requestElement);

      // read test file and store query instance ;
      // unmarshall this response string
      JAXBElement responseJaxb =
          PMJAXBUtil.getJAXBUtil().unMashallFromString(responseElement.toString());
      ResponseMessageType r = (ResponseMessageType) responseJaxb.getValue();
      JAXBUnWrapHelper helper = new JAXBUnWrapHelper();
      ConfigureType masterInstanceResult =
          (ConfigureType) helper.getObjectByClass(r.getMessageBody().getAny(), ConfigureType.class);
      assertNotNull(masterInstanceResult);

      // try calling with another user
      requestMessageType =
          buildRequestMessage(
              bodyType, "demo", masterInstanceResult.getUser().getPassword().getValue(), "Demo");
      strWriter = new StringWriter();
      of2 = new edu.harvard.i2b2.pm.datavo.i2b2message.ObjectFactory();
      PMJAXBUtil.getJAXBUtil().marshaller(of2.createRequest(requestMessageType), strWriter);

      requestElement = convertStringToOMElement(strWriter.toString());
      responseElement = getServiceClient(pmTargetEPR).sendReceive(requestElement);

      responseJaxb = PMJAXBUtil.getJAXBUtil().unMashallFromString(responseElement.toString());
      r = (ResponseMessageType) responseJaxb.getValue();
      helper = new JAXBUnWrapHelper();
      String err = r.getResponseHeader().getResultStatus().getStatus().getType();
      assertEquals("ERROR", err);

    } catch (Exception e) {
      e.printStackTrace();
      throw e;
    }
  }