当前位置: 首页>>代码示例>>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;未经允许,请勿转载。