Java 类javax.xml.ws.soap.SOAPFaultException 实例源码

项目:oscm    文件:TriggerDefinitonServiceWSTest.java   
@Test
public void updateTriggerDefinition_NonAdmin() throws Exception {

    VOTriggerDefinition triggerCreate = createVOTriggerDefinition();
    serviceSupplier.createTriggerDefinition(triggerCreate);
    List<VOTriggerDefinition> triggerDefinitions = serviceSupplier
            .getTriggerDefinitions();
    assertNotNull(triggerDefinitions);
    assertEquals(1, triggerDefinitions.size());

    try {
        serviceServiceManager.updateTriggerDefinition(triggerCreate);
    } catch (SOAPFaultException ex) {
        validateExceptionContent(ex);
    } finally {
        // cleanup
        serviceSupplier.deleteTriggerDefinition(triggerDefinitions.get(0)
                .getKey());
    }
}
项目:oscm    文件:TriggerDefinitonServiceWSTest.java   
@Test
public void deleteTriggerDefinition_NonAdmin() throws Exception {

    VOTriggerDefinition triggerCreate = createVOTriggerDefinition();
    serviceSupplier.createTriggerDefinition(triggerCreate);

    List<VOTriggerDefinition> triggerDefinitions = serviceSupplier
            .getTriggerDefinitions();
    assertNotNull(triggerDefinitions);
    assertEquals(1, triggerDefinitions.size());

    try {
        serviceServiceManager.deleteTriggerDefinition(triggerDefinitions
                .get(0).getKey());
    } catch (SOAPFaultException ex) {
        validateExceptionContent(ex);
    } finally {
        // cleanup
        serviceSupplier.deleteTriggerDefinition(triggerDefinitions.get(0)
                .getKey());
    }
}
项目:oscm    文件:BugfixWSTest.java   
@Test
public void testBug7461() throws Exception {

    ServiceProvisioningService serviceProvisioningSrv = ServiceFactory
            .getDefault().getServiceProvisioningService();

    VOServiceDetails sd = new VOServiceDetails();
    VOImageResource ir = new VOImageResource();
    try {
        serviceProvisioningSrv.updateService(sd, ir);
        fail("Call must not succeed!");
    } catch (Exception e) {
        if (e instanceof SOAPFaultException) {
            assertTrue(e.getMessage().contains("Unauthorized"));
        }
    }
}
项目:oscm    文件:MarketplaceServiceWSTest.java   
@Test
public void testDeleteMarketplaceWithWrongRole() throws Exception {
    VOMarketplace marketplace = factory.createMarketplaceVO(
            supplier.getOrganizationId(), false, "abc");

    marketplace = createAndValidateMarketplace(marketplace);

    try {
        // only operator can delete marketplaces
        mpService_Supplier
                .deleteMarketplace(marketplace.getMarketplaceId());
        fail();
    } catch (SOAPFaultException e) {
        checkAccessException(e);
    }
}
项目:oscm    文件:OnBehalfActingServiceWSTest.java   
/**
 * Test for restriction. Operator cannot call createOnBehalfUser.
 * 
 * @throws Exception
 */
@Test
public void testFailToCreateOnBehalfUserByOperator() throws Exception {

    // set up of blue line test with false
    createMarketableServiceAndSubscribe(true);

    // By PaaS: creating OnBehalf user must be failed
    String techProviderOrgId = techProviderOrg.getOrganizationId();
    IdentityService identifySV = ServiceFactory.getDefault()
            .getIdentityService();
    try {
        identifySV.createOnBehalfUser(techProviderOrgId, commonUserPWD);
        fail();
    } catch (Exception e) {
        if (e instanceof SOAPFaultException) {
            assertTrue(e.getMessage().contains("Unauthorized"));
        }
    }

}
项目:oscm    文件:VatServiceWSTest.java   
@Test
public void testSaveDefaultVat_UserUnauthorized() throws Exception {
    VatService defaultVatService = ServiceFactory.getDefault()
            .getVatService();

    VOVatRate defaultVat = new VOVatRate();
    defaultVat.setRate(TEN);

    try {
        defaultVatService.saveDefaultVat(defaultVat);
        fail();
    } catch (SOAPFaultException e) {
        checkAccessException(e);
    }

}
项目:KernelHive    文件:UnitServer.java   
public void onJobDone(int id, String status) {
    LOGGER.info(String.format("Job %d over.", id));

    boolean succeded = false;
    while (!succeded) {
        try {
            clusterBean.reportOver(id, status);
            LOGGER.info(String.format("Job %d over -reported", id));
            succeded = true;
        } catch (SOAPFaultException e) {
            LOGGER.log(Level.WARNING, "UnitServer failed to report job over. "
                    + "Trying again in 3 seconds... ", e);
            try {
                Thread.sleep(3000);
            } catch (InterruptedException ex) {
            }
        }
    }
}
项目:jaffa-framework    文件:WebServiceInvoker.java   
/**
 *  Marshals the inout arguments into a SOAPMessage
 * and invokes the WebService.
 * @param arguments the arguments for the WebService.
 * @return the reply from the WebService.
 * @throws SOAPException if any SOAP error occurs.
 * @throws SOAPFaultException if any SOAPFault occurs.
 * @throws JAXBException if any XML (un)marshalling error occurs.
 */
public Object invoke(Object... arguments) throws SOAPException, SOAPFaultException, JAXBException {
    SOAPConnection connection = null;

    try {
        // Create a connection
        connection = SOAPConnectionFactory.newInstance().createConnection();

        // Create the SOAPMessage
        SOAPMessage message = createSOAPMessage(arguments);

        // Invoke the WebService
        SOAPMessage response = invoke(connection, message);

        // Unmarshal the response
        return unmarshalResponse(response);
    } finally {
        // Always close the connection
        if (connection != null) {
            connection.close();
        }
    }
}
项目:engerek    文件:ModelWebServiceRaw.java   
@Override
public DOMSource invoke(DOMSource request) {
    try {
        return invokeAllowingFaults(request);
    } catch (FaultMessage faultMessage) {
        try {
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault soapFault = factory.createFault();
            soapFault.setFaultCode(SOAP11_FAULTCODE_SERVER);           // todo here is a constant until we have a mechanism to determine the correct value (client / server)
            soapFault.setFaultString(faultMessage.getMessage());
            Detail detail = soapFault.addDetail();
            serializeFaultMessage(detail, faultMessage);
            // fault actor?
            // stack trace of the outer exception (FaultMessage) is unimportant, because it is always created at one place
            // todo consider providing stack trace of the inner exception
            //Detail detail = soapFault.addDetail();
            //detail.setTextContent(getStackTraceAsString(faultMessage));
            throw new SOAPFaultException(soapFault);
        } catch (SOAPException e) {
            throw new RuntimeException("SOAP Exception: " + e.getMessage(), e);
        }
    }
}
项目:engerek    文件:ReportWebServiceRaw.java   
@Override
public DOMSource invoke(DOMSource request) {
    try {
        return invokeAllowingFaults(request);
    } catch (FaultMessage faultMessage) {
        try {
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault soapFault = factory.createFault();
            soapFault.setFaultCode(SOAP11_FAULTCODE_SERVER);           // todo here is a constant until we have a mechanism to determine the correct value (client / server)
            soapFault.setFaultString(faultMessage.getMessage());
            Detail detail = soapFault.addDetail();
            serializeFaultMessage(detail, faultMessage);
            // fault actor?
            // stack trace of the outer exception (FaultMessage) is unimportant, because it is always created at one place
            // todo consider providing stack trace of the inner exception
            //Detail detail = soapFault.addDetail();
            //detail.setTextContent(getStackTraceAsString(faultMessage));
            throw new SOAPFaultException(soapFault);
        } catch (SOAPException e) {
            throw new RuntimeException("SOAP Exception: " + e.getMessage(), e);
        }
    }
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test100GetConfigNoSecurity() throws Exception {
    final String TEST_NAME = "test100GetConfigNoSecurity";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(null, null);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "InvalidSecurity", "<wsse:Security> header");
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "<wsse:Security> header");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test101GetConfigWrongPasswordDigest() throws Exception {
    final String TEST_NAME = "test101GetConfigWrongPasswordDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, "wrongAdministratorPassword", WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "could not be authenticated or authorized");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test102GetConfigWrongPasswordText() throws Exception {
    final String TEST_NAME = "test102GetConfigWrongPasswordText";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, "wrongAdministratorPassword", WSConstants.PW_TEXT);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test103GetConfigEmptyPasswordDigest() throws Exception {
    final String TEST_NAME = "test103GetConfigEmptyPasswordDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, "", WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "could not be authenticated or authorized");

}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test104GetConfigEmptyPasswordText() throws Exception {
    final String TEST_NAME = "test104GetConfigEmptyPasswordText";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_ADMINISTRATOR_USERNAME, "", WSConstants.PW_TEXT);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "could not be authenticated or authorized");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test105GetConfigWrongUsernameDigest() throws Exception {
    final String TEST_NAME = "test105GetConfigWrongUsernameDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort("admin", USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no user");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test106GetConfigWrongUsernameText() throws Exception {
    final String TEST_NAME = "test106GetConfigWrongUsernameText";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort("admin", USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_TEXT);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no user");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test107GetConfigBlankUsernameDigest() throws Exception {
    final String TEST_NAME = "test107GetConfigBlankUsernameDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(" ", USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no username");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test108GetConfigBlankUsernameText() throws Exception {
    final String TEST_NAME = "test108GetConfigBlankUsernameText";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(" ", USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_TEXT);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no username");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test121GetConfigAsNobodyWrongPasswordDigest() throws Exception {
    final String TEST_NAME = "test121GetConfigAsNobodyWrongPasswordDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_NOBODY_USERNAME, "wrongNobodyPassword", WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no authorizations");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test122GetConfigAsNobodyEmptyPasswordDigest() throws Exception {
    final String TEST_NAME = "test103GetConfigEmptyPasswordDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_NOBODY_USERNAME, "", WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no authorizations");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test123GetConfigAsNobodyGoodPasswordDigest() throws Exception {
    final String TEST_NAME = "test123GetConfigAsNobodyGoodPasswordDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_NOBODY_USERNAME, USER_NOBODY_PASSWORD, WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no authorizations");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test131GetConfigAsCyclopsGoodPasswordDigest() throws Exception {
    final String TEST_NAME = "test131GetConfigAsCyclopsGoodPasswordDigest";
    displayTestTitle(TEST_NAME);

    modelPort = createModelPort(USER_CYCLOPS_USERNAME, USER_CYCLOPS_PASSWORD, WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    LogfileTestTailer tailer = createLogTailer();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginLogout(tailer);
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test143GetConfigAsDarthAdderGoodPasswordDigest() throws Exception {
    final String TEST_NAME = "test143GetConfigAsDarthAdderGoodPasswordDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD, WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    try {
     /// WHEN
     modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

     AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    // THEN
    tailer.tail();
    assertAuditLoginFailed(tailer, "user disabled");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test150GetConfigNoPasswordWrongDigest() throws Exception {
    final String TEST_NAME = "test150GetConfigNoPasswordWrongDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_NOPASSWORD_USERNAME, "wrongPassword", WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no credentials in user");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test152GetConfigNoPasswordEmptyDigest() throws Exception {
    final String TEST_NAME = "test152GetConfigNoPasswordEmptyDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_NOPASSWORD_USERNAME, " ", WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no credentials in user");
}
项目:Camel    文件:GreeterClientTest.java   
@Test
public void testServiceWithValidateUser() throws Exception {

    String response = sendMessageWithUsernameToken("jim", "jimspassword", "CXF");

    assertEquals(" Hello CXF", response);

    try {
        sendMessageWithUsernameToken("jim", "foo", "CXF");
        fail("should fail");
    } catch (Exception ex) {
        String msg = ex.getMessage();
        assertTrue("Get a wrong type exception.", ex instanceof SOAPFaultException);
        assertTrue("Get a wrong exception message: " + msg,
                   msg.startsWith("The security token could not be authenticated or authorized")
                   || msg.startsWith("A security error was encountered when verifying the messag"));
    }

}
项目:development    文件:TriggerDefinitonServiceWSTest.java   
@Test
public void updateTriggerDefinition_NonAdmin() throws Exception {

    VOTriggerDefinition triggerCreate = createVOTriggerDefinition();
    serviceSupplier.createTriggerDefinition(triggerCreate);
    List<VOTriggerDefinition> triggerDefinitions = serviceSupplier
            .getTriggerDefinitions();
    assertNotNull(triggerDefinitions);
    assertEquals(1, triggerDefinitions.size());

    try {
        serviceServiceManager.updateTriggerDefinition(triggerCreate);
    } catch (SOAPFaultException ex) {
        validateExceptionContent(ex);
    } finally {
        // cleanup
        serviceSupplier.deleteTriggerDefinition(triggerDefinitions.get(0)
                .getKey());
    }
}
项目:development    文件:TriggerDefinitonServiceWSTest.java   
@Test
public void deleteTriggerDefinition_NonAdmin() throws Exception {

    VOTriggerDefinition triggerCreate = createVOTriggerDefinition();
    serviceSupplier.createTriggerDefinition(triggerCreate);

    List<VOTriggerDefinition> triggerDefinitions = serviceSupplier
            .getTriggerDefinitions();
    assertNotNull(triggerDefinitions);
    assertEquals(1, triggerDefinitions.size());

    try {
        serviceServiceManager.deleteTriggerDefinition(triggerDefinitions
                .get(0).getKey());
    } catch (SOAPFaultException ex) {
        validateExceptionContent(ex);
    } finally {
        // cleanup
        serviceSupplier.deleteTriggerDefinition(triggerDefinitions.get(0)
                .getKey());
    }
}
项目:development    文件:BugfixWSTest.java   
@Test
public void testBug7461() throws Exception {

    ServiceProvisioningService serviceProvisioningSrv = ServiceFactory
            .getDefault().getServiceProvisioningService();

    VOServiceDetails sd = new VOServiceDetails();
    VOImageResource ir = new VOImageResource();
    try {
        serviceProvisioningSrv.updateService(sd, ir);
        fail("Call must not succeed!");
    } catch (Exception e) {
        if (e instanceof SOAPFaultException) {
            assertTrue(e.getMessage().contains("AccessException"));
        }
    }
}
项目:development    文件:MarketplaceServiceWSTest.java   
@Test
public void testDeleteMarketplaceWithWrongRole() throws Exception {
    VOMarketplace marketplace = factory.createMarketplaceVO(
            supplier.getOrganizationId(), false, "abc");

    marketplace = createAndValidateMarketplace(marketplace);

    try {
        // only operator can delete marketplaces
        mpService_Supplier
                .deleteMarketplace(marketplace.getMarketplaceId());
        fail();
    } catch (SOAPFaultException e) {
        checkAccessException(e);
    }
}
项目:development    文件:OnBehalfActingServiceWSTest.java   
/**
 * Test for restriction. Operator cannot call createOnBehalfUser.
 * 
 * @throws Exception
 */
@Test
public void testFailToCreateOnBehalfUserByOperator() throws Exception {

    // set up of blue line test with false
    createMarketableServiceAndSubscribe(true);

    // By PaaS: creating OnBehalf user must be failed
    String techProviderOrgId = techProviderOrg.getOrganizationId();
    IdentityService identifySV = ServiceFactory.getDefault()
            .getIdentityService();
    try {
        identifySV.createOnBehalfUser(techProviderOrgId, commonUserPWD);
        fail();
    } catch (Exception e) {
        if (e instanceof SOAPFaultException) {
            assertTrue(e.getMessage().contains("AccessException"));
        }
    }

}
项目:development    文件:VatServiceWSTest.java   
@Test
public void testSaveDefaultVat_UserUnauthorized() throws Exception {
    VatService defaultVatService = ServiceFactory.getDefault()
            .getVatService();

    VOVatRate defaultVat = new VOVatRate();
    defaultVat.setRate(TEN);

    try {
        defaultVatService.saveDefaultVat(defaultVat);
        fail();
    } catch (SOAPFaultException e) {
        checkAccessException(e);
    }

}
项目:vsphere-ws    文件:VITop.java   
String getEntityName(ManagedObjectReference moRef)
        throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg {
    String ret = null;
    try {
        ret = (String) getDynamicProperty(moRef, "name");
    } catch (SOAPFaultException sfe) {
        printSoapFaultException(sfe);
    } catch (Exception e) {
        return "<Unknown Entity>";
    }

    if (ret != null) {
        return ret;
    } else {
        return "<Unknown Entity>";
    }
}
项目:vsphere-ws    文件:VITop.java   
/**
 *
 */
void refreshStats() {
    try {
        PerfCompositeMetric metric =
                vimPort.queryPerfComposite(perfManager, querySpec);
        XMLGregorianCalendar latestTs =
                displayStats(querySpec.getMetricId(), metric);
        if (latestTs != null) {
            querySpec.setStartTime(latestTs);
        }
    } catch (SOAPFaultException sfe) {
        printSoapFaultException(sfe);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
项目:vsphere-ws    文件:VITop.java   
/**
 * Determines of a method 'methodName' exists for the Object 'obj'.
 *
 * @param obj            The Object to check
 * @param methodName     The method name
 * @param parameterTypes Array of Class objects for the parameter types
 * @return true if the method exists, false otherwise
 */
@SuppressWarnings("rawtypes")
boolean methodExists(Object obj, String methodName,
                     Class[] parameterTypes) {
    boolean exists = false;
    try {
        Method method = obj.getClass().getMethod(methodName, parameterTypes);
        if (method != null) {
            exists = true;
        }
    } catch (SOAPFaultException sfe) {
        printSoapFaultException(sfe);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return exists;
}
项目:vsphere-ws    文件:VIUsage.java   
/**
 * Determines of a method 'methodName' exists for the Object 'obj'.
 *
 * @param obj            The Object to check
 * @param methodName     The method name
 * @param parameterTypes Array of Class objects for the parameter types
 * @return true if the method exists, false otherwise
 */
@SuppressWarnings("rawtypes")
private static boolean methodExists(Object obj, String methodName,
                                    Class[] parameterTypes) {
    boolean exists = false;
    try {
        Method method = obj.getClass().getMethod(methodName, parameterTypes);
        if (method != null) {
            exists = true;
        }
    } catch (SOAPFaultException sfe) {
        printSoapFaultException(sfe);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return exists;
}
项目:winrm4j    文件:ShellCommand.java   
private void assertFaultCode(SOAPFaultException soapFault, String code) {
    try {
        NodeList faultDetails = soapFault.getFault().getDetail().getChildNodes();
        for (int i = 0; i < faultDetails.getLength(); i++) {
            if (faultDetails.item(i).getLocalName().equals("WSManFault")) {
                if (faultDetails.item(i).getAttributes().getNamedItem("Code").getNodeValue().equals(code)) {
                    LOG.trace("winrm client {} received error 500 response with code {}, response {}", this, code, soapFault);
                    return;
                } else {
                    throw soapFault;
                }
            }
        }
        throw soapFault;
    } catch (NullPointerException e) {
        LOG.debug("Error reading Fault Code {}", soapFault.getFault());
        throw soapFault;
    }
}
项目:jbossws-cxf    文件:MultipleClientsSignEncryptTestCase.java   
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testAlice() throws Exception
{
   QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
   URL wsdlURL = new URL(baseURL + "/SecurityService?wsdl");
   Service service = Service.create(wsdlURL, serviceName);
   ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
   setupWsse(proxy, "alice");
   try
   {
      assertEquals("Multiple Clients Secure Hello World!", proxy.sayHello());
   }
   catch (SOAPFaultException e)
   {
      throw new Exception("Error " + e.getMessage() + " - please check that the Bouncy Castle provider is installed.", e);
   }
}
项目:jbossws-cxf    文件:MultipleClientsSignEncryptTestCase.java   
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testJohn() throws Exception
{
   QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
   URL wsdlURL = new URL(baseURL + "/SecurityService?wsdl");
   Service service = Service.create(wsdlURL, serviceName);
   ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
   setupWsse(proxy, "john");
   try
   {
      assertEquals("Multiple Clients Secure Hello World!", proxy.sayHello());
   }
   catch (SOAPFaultException e)
   {
      throw new Exception("Error " + e.getMessage() + " - please check that the Bouncy Castle provider is installed.", e);
   }
}