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


Java SOAPFault.getFaultCode方法代碼示例

本文整理匯總了Java中javax.xml.soap.SOAPFault.getFaultCode方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPFault.getFaultCode方法的具體用法?Java SOAPFault.getFaultCode怎麽用?Java SOAPFault.getFaultCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.soap.SOAPFault的用法示例。


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

示例1: callWebService

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
public String callWebService(String msisdn) throws SOAPException, IOException, XWSSecurityException, GetTermalIccidException {
    SOAPMessage request = createTerminalRequest(msisdn);
    request = secureMessage(request);

    // TODO
    logger.info("Get Terminals by msisdn Request: ");
    request.writeTo(System.out);
    System.out.println("");

    SOAPConnection connection = connectionFactory.createConnection();
    SOAPMessage response = connection.call(request, url);
    // TODO
    logger.info("Get Terminals by msisdn Response: ");
    response.writeTo(System.out);
    System.out.println("");

    if (!response.getSOAPBody().hasFault()) {
        return writeTerminalResponse(response);
    } else {
        SOAPFault fault = response.getSOAPBody().getFault();
        logger.error("Received SOAP Fault");
        logger.error("SOAP Fault Code :" + fault.getFaultCode());
        logger.error("SOAP Fault String :" + fault.getFaultString());
        throw new GetTermalIccidException(fault.getFaultCode() + "," + fault.getFaultString());
    }
}
 
開發者ID:booleguo,項目名稱:sam-elle,代碼行數:27,代碼來源:GetTerminalsByMsisdnClient.java

示例2: testFaultCodeWithPrefix1

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@Test
public void testFaultCodeWithPrefix1() throws Exception {
    MessageFactory fac = MessageFactory.newInstance();
    SOAPMessage soapMessage = fac.createMessage();
    SOAPPart soapPart = soapMessage.getSOAPPart();
    SOAPEnvelope envelope = soapPart.getEnvelope();
    SOAPBody body = envelope.getBody();
    SOAPFault sf = body.addFault();

    String prefix = "wso2";
    sf.setFaultCode(prefix + ":Server");
    String result = sf.getFaultCode();

    assertNotNull(result);
    assertEquals(prefix + ":Server", result);
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:17,代碼來源:SOAPFaultTest.java

示例3: testFaultCodeWithPrefix2

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
@Test
public void testFaultCodeWithPrefix2() throws Exception {
    MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
    SOAPMessage soapMessage = fac.createMessage();
    SOAPPart soapPart = soapMessage.getSOAPPart();
    SOAPEnvelope envelope = soapPart.getEnvelope();
    SOAPBody body = envelope.getBody();
    SOAPFault sf = body.addFault();

    String prefix = "wso2";
    sf.setFaultCode(prefix + ":Server");
    String result = sf.getFaultCode();

    assertNotNull(result);
    assertEquals(prefix + ":Server", result);
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:17,代碼來源:SOAPFaultTest.java

示例4: handleResultFault

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
protected void handleResultFault(SOAPFault fault)
{
	StringBuilder errorMsg = new StringBuilder();
	errorMsg.append("XML/A fault: ");
	
	String faultString = fault.getFaultString();
	if (faultString != null)
	{
		errorMsg.append(faultString);
		errorMsg.append("; ");
	}

	String faultActor = fault.getFaultActor();
	if (faultActor != null)
	{
		errorMsg.append("Actor: ");
		errorMsg.append(faultActor);
		errorMsg.append("; ");
	}

	String faultCode = fault.getFaultCode();
	if (faultCode != null)
	{
		errorMsg.append("Code: ");
		errorMsg.append(faultCode);
		errorMsg.append("; ");
	}
	
	throw new JRRuntimeException(errorMsg.toString());
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:31,代碼來源:JRXmlaQueryExecuter.java

示例5: assertSoapFault

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
protected void assertSoapFault(SOAPFaultException e, String expectedCode, String expectedMessage) {
   	SOAPFault fault = e.getFault();
   	String faultCode = fault.getFaultCode();
   	display("SOAP fault code: "+faultCode);
   	assertTrue("Unexpected fault code: "+faultCode, faultCode.endsWith(expectedCode));
   	String message = e.getMessage();
   	assertTrue("Unexpected fault message: "+message, message.contains(expectedMessage));
}
 
開發者ID:Pardus-Engerek,項目名稱:engerek,代碼行數:9,代碼來源:AbstractWebserviceTest.java

示例6: handleResultFault

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
protected void handleResultFault(SOAPFault fault)
{
	StringBuffer errorMsg = new StringBuffer();
	errorMsg.append("XML/A fault: ");

	String faultString = fault.getFaultString();
	if (faultString != null)
	{
		errorMsg.append(faultString);
		errorMsg.append("; ");
	}

	String faultActor = fault.getFaultActor();
	if (faultActor != null)
	{
		errorMsg.append("Actor: ");
		errorMsg.append(faultActor);
		errorMsg.append("; ");
	}

	String faultCode = fault.getFaultCode();
	if (faultCode != null)
	{
		errorMsg.append("Code: ");
		errorMsg.append(faultCode);
		errorMsg.append("; ");
	}

	throw new JRRuntimeException(errorMsg.toString());
}
 
開發者ID:JockiHendry,項目名稱:ireport-fork,代碼行數:31,代碼來源:OLAPQueryExecuter.java

示例7: send

import javax.xml.soap.SOAPFault; //導入方法依賴的package包/類
public Element send(Element request, URI endpointURL) throws TransportException {
    if (log.isDebugEnabled()) {
        String requestMessage = XMLUtils.convertNodeToXMLString(request);
        log.debug("Request message: %s\n%s" + endpointURL + ":" + requestMessage);
    }

    Element response = null;
    try {
        SOAPMessage message = this.createSOAPMessage(request);
        //Make the SAAJ Call now
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection connection = soapConnectionFactory.createConnection();
        SOAPMessage soapResponse = connection.call(message, endpointURL.toURL());

        SOAPBody soapBody = soapResponse.getSOAPBody();
        boolean hasFault = soapBody.hasFault();
        if (hasFault) {
            SOAPFault soapFault = soapBody.getFault();
            String faultStr = soapFault.getFaultCode() + "::" + soapFault.getFaultString();
            throw new RegistryException(faultStr);
        }
        response = getFirstChildElement(soapBody);
    } catch (Exception ex) {
        log.error("Exception::" + ex.getMessage(), ex);
        throw new TransportException(ex);
    }
    if (log.isDebugEnabled()) {
        String responseMessage = XMLUtils.convertNodeToXMLString(response);
        log.debug("Response message: %s" + responseMessage);
    }

    return response;
}
 
開發者ID:apache,項目名稱:juddi-scout,代碼行數:34,代碼來源:SaajTransport.java


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