當前位置: 首頁>>代碼示例>>Java>>正文


Java SOAPFaultException類代碼示例

本文整理匯總了Java中javax.xml.ws.soap.SOAPFaultException的典型用法代碼示例。如果您正苦於以下問題:Java SOAPFaultException類的具體用法?Java SOAPFaultException怎麽用?Java SOAPFaultException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SOAPFaultException類屬於javax.xml.ws.soap包,在下文中一共展示了SOAPFaultException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateTriggerDefinition_NonAdmin

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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());
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:21,代碼來源:TriggerDefinitonServiceWSTest.java

示例2: deleteTriggerDefinition_NonAdmin

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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());
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:23,代碼來源:TriggerDefinitonServiceWSTest.java

示例3: testBug7461

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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"));
        }
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:18,代碼來源:BugfixWSTest.java

示例4: testDeleteMarketplaceWithWrongRole

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:17,代碼來源:MarketplaceServiceWSTest.java

示例5: testFailToCreateOnBehalfUserByOperator

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
/**
 * 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"));
        }
    }

}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:26,代碼來源:OnBehalfActingServiceWSTest.java

示例6: testSaveDefaultVat_UserUnauthorized

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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);
    }

}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:17,代碼來源:VatServiceWSTest.java

示例7: onJobDone

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
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) {
			}
		}
	}
}
 
開發者ID:roscisz,項目名稱:KernelHive,代碼行數:20,代碼來源:UnitServer.java

示例8: invoke

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
/**
 *  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();
        }
    }
}
 
開發者ID:jaffa-projects,項目名稱:jaffa-framework,代碼行數:32,代碼來源:WebServiceInvoker.java

示例9: invoke

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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);
        }
    }
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:24,代碼來源:ModelWebServiceRaw.java

示例10: test100GetConfigNoSecurity

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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");
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:26,代碼來源:TestWSSecurity.java

示例11: test101GetConfigWrongPasswordDigest

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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");
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:26,代碼來源:TestWSSecurity.java

示例12: test102GetConfigWrongPasswordText

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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");        	
    }
    
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:24,代碼來源:TestWSSecurity.java

示例13: test103GetConfigEmptyPasswordDigest

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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");
    
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:27,代碼來源:TestWSSecurity.java

示例14: test104GetConfigEmptyPasswordText

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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");
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:26,代碼來源:TestWSSecurity.java

示例15: test105GetConfigWrongUsernameDigest

import javax.xml.ws.soap.SOAPFaultException; //導入依賴的package包/類
@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");
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:26,代碼來源:TestWSSecurity.java


注:本文中的javax.xml.ws.soap.SOAPFaultException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。