当前位置: 首页>>代码示例>>Java>>正文


Java SoapFault.setDetail方法代码示例

本文整理汇总了Java中org.apache.cxf.binding.soap.SoapFault.setDetail方法的典型用法代码示例。如果您正苦于以下问题:Java SoapFault.setDetail方法的具体用法?Java SoapFault.setDetail怎么用?Java SoapFault.setDetail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cxf.binding.soap.SoapFault的用法示例。


在下文中一共展示了SoapFault.setDetail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import org.apache.cxf.binding.soap.SoapFault; //导入方法依赖的package包/类
public SoapFault getValue() throws Exception {
    SoapFault fault = new SoapFault(message, faultCode);
    if (xmlDetail != null) {
        Document document = xmlDetail.getValue();
        if (!document.getDocumentElement().getNodeName().equals("detail")) {
            logger.warn("The provided XML is not wrapped in a detail element, this is required and one will be added");

            DocumentBuilder builder = xmlUtilities.getDocumentBuilder();
            Document newDetailDocument = builder.newDocument();
            Element newDetailElement = newDetailDocument.createElement("detail");
            newDetailDocument.appendChild(newDetailElement);
            newDetailElement.appendChild(newDetailDocument.importNode(document.getDocumentElement(), true));

            fault.setDetail(newDetailElement);
        } else
            fault.setDetail(document.getDocumentElement());
    }

    return fault;
}
 
开发者ID:uoa-group-applications,项目名称:morc,代码行数:21,代码来源:SoapFaultTestResource.java

示例2: createRouteBuilder

import org.apache.cxf.binding.soap.SoapFault; //导入方法依赖的package包/类
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            //a straight through proxy
            from("jetty:http://localhost:8090/testWS")
                    .to("jetty:http://localhost:8090/targetWS?bridgeEndpoint=true&throwExceptionOnFailure=false");

            SoapFault fault = new SoapFault("Pretend SOAP Fault", SoapFault.FAULT_CODE_CLIENT);

            from("cxf:http://localhost:8092/testWSFault?wsdlURL=data/PingService.wsdl&dataFormat=PAYLOAD")
                    .setFaultBody(constant(fault));

            SoapFault detailedFault = new SoapFault("Pretend Detailed SOAP Fault", SoapFault.FAULT_CODE_SERVER);
            detailedFault.setDetail(new XmlUtilities().getXmlAsDocument("<detail><foo/></detail>").getDocumentElement());

            from("cxf:http://localhost:8092/testWSFaultDetail?wsdlURL=data/PingService.wsdl&dataFormat=PAYLOAD")
                    .setFaultBody(constant(detailedFault));

            from("jetty:http://localhost:8093/jsonPingService")
                    .setBody(constant("{\"response\":\"PONG\"}"));
        }
    };
}
 
开发者ID:uoa-group-applications,项目名称:morc,代码行数:26,代码来源:WebServiceProxyTest.java

示例3: testFaultDetailValidator

import org.apache.cxf.binding.soap.SoapFault; //导入方法依赖的package包/类
@Test
public void testFaultDetailValidator() throws Exception {
    XmlUtilities xmlUtilities = new XmlUtilities();

    SoapFaultTestResource resource = new SoapFaultTestResource(new QName("www.foo.com", "baz"),
            "message", new XmlTestResource(xmlUtilities.getXmlAsDocument("<foo/>")));

    Exchange e = new DefaultExchange(new DefaultCamelContext());
    SoapFault fault = new SoapFault("message", new QName("www.foo.com", "baz"));
    fault.setDetail(xmlUtilities.getXmlAsDocument("<detail><foo/></detail>").getDocumentElement());
    e.setProperty(Exchange.EXCEPTION_CAUGHT, fault);
    assertTrue(resource.matches(e));
}
 
开发者ID:uoa-group-applications,项目名称:morc,代码行数:14,代码来源:SOAPFaultPredicateTest.java

示例4: testInvalidFaultDetail

import org.apache.cxf.binding.soap.SoapFault; //导入方法依赖的package包/类
@Test
public void testInvalidFaultDetail() throws Exception {
    XmlUtilities xmlUtilities = new XmlUtilities();

    SoapFaultTestResource resource = new SoapFaultTestResource(new QName("www.foo.com", "baz"),
            "message", new XmlTestResource(xmlUtilities.getXmlAsDocument("<foo/>")));

    Exchange e = new DefaultExchange(new DefaultCamelContext());
    SoapFault fault = new SoapFault("message", new QName("www.foo.com", "baz"));
    fault.setDetail(xmlUtilities.getXmlAsDocument("<foo1/>").getDocumentElement());
    e.setProperty(Exchange.EXCEPTION_CAUGHT, fault);
    assertFalse(resource.matches(e));
}
 
开发者ID:uoa-group-applications,项目名称:morc,代码行数:14,代码来源:SOAPFaultPredicateTest.java


注:本文中的org.apache.cxf.binding.soap.SoapFault.setDetail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。