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


Java SOAPFaultBuilder.createSOAPFaultMessage方法代码示例

本文整理汇总了Java中com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createSOAPFaultMessage方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPFaultBuilder.createSOAPFaultMessage方法的具体用法?Java SOAPFaultBuilder.createSOAPFaultMessage怎么用?Java SOAPFaultBuilder.createSOAPFaultMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.xml.internal.ws.fault.SOAPFaultBuilder的用法示例。


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

示例1: createMUSOAPFaultMessage

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
/**
 * This should be used only in ServerMUPipe
 *
 * @param notUnderstoodHeaders
 * @return Message representing a SOAPFault
 *         In SOAP 1.1, notUnderstoodHeaders are added in the fault Detail
 *         in SOAP 1.2, notUnderstoodHeaders are added as the SOAP Headers
 */

final Message createMUSOAPFaultMessage(Set<QName> notUnderstoodHeaders) {
    try {
        String faultString = MUST_UNDERSTAND_FAULT_MESSAGE_STRING;
        if (soapVersion == SOAP_11) {
            faultString = "MustUnderstand headers:" + notUnderstoodHeaders + " are not understood";
        }
        Message  muFaultMessage = SOAPFaultBuilder.createSOAPFaultMessage(
                soapVersion,faultString,soapVersion.faultCodeMustUnderstand);

        if (soapVersion == SOAP_12) {
            addHeader(muFaultMessage, notUnderstoodHeaders);
        }
        return muFaultMessage;
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:MUTube.java

示例2: createServiceResponseForException

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
@Override
public Packet createServiceResponseForException(final ThrowableContainerPropertySet tc,
                                                final Packet      responsePacket,
                                                final SOAPVersion soapVersion,
                                                final WSDLPort    wsdlPort,
                                                final SEIModel    seiModel,
                                                final WSBinding   binding)
{
    // This will happen in addressing if it is enabled.
    if (tc.isFaultCreated()) return responsePacket;

    final Message faultMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, tc.getThrowable());
    final Packet result = responsePacket.createServerResponse(faultMessage, wsdlPort, seiModel, binding);
    // Pass info to upper layers
    tc.setFaultMessage(faultMessage);
    tc.setResponsePacket(responsePacket);
    tc.setFaultCreated(true);
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:WSEndpointImpl.java

示例3: getWSDLOperationMapping

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
public @NotNull WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
    WSDLOperationMapping opName;
    for(WSDLOperationFinder finder: opFinders) {
        opName = finder.getWSDLOperationMapping(request);
        if(opName != null)
            return opName;
    }
    //No way to dispatch this request
    String err = MessageFormat.format("Request=[SOAPAction={0},Payload='{'{1}'}'{2}]",
            request.soapAction, request.getMessage().getPayloadNamespaceURI(),
            request.getMessage().getPayloadLocalPart());
    String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(err);
    Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage(
            binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient);
    throw new DispatchException(faultMsg);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:OperationDispatcher.java

示例4: processRequest

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
@Override
public NextAction processRequest(Packet request) {
    if (isNoValidation() || !feature.isInbound() || !request.getMessage().hasPayload() || request.getMessage().isFault()) {
        return super.processRequest(request);
    }
    try {
        doProcess(request);
    } catch(SAXException se) {
        LOGGER.log(Level.WARNING, "Client Request doesn't pass Service's Schema Validation", se);
        // Client request is invalid. So sending specific fault code
        // Also converting this to fault message so that handlers may get
        // to see the message.
        SOAPVersion soapVersion = binding.getSOAPVersion();
        Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage(
                soapVersion, null, se, soapVersion.faultCodeClient);
        return doReturnWith(request.createServerResponse(faultMsg,
                wsdlPort, seiModel, binding));
    }
    return super.processRequest(request);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:ServerSchemaValidationTube.java

示例5: getWSDLOperationMapping

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
/**
     *
     * @return not null if it finds a unique handler for the request
     *         null if it cannot idenitify a unique wsdl operation from the Payload QName.
     *
     * @throws DispatchException if the payload itself is incorrect, this happens when the payload is not accepted by
     *          any operation in the port.
     */
//  public QName getWSDLOperationQName(Packet request) throws DispatchException{

    public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
        Message message = request.getMessage();
        String localPart = message.getPayloadLocalPart();
        String nsUri;
        if (localPart == null) {
            localPart = EMPTY_PAYLOAD_LOCAL;
            nsUri = EMPTY_PAYLOAD_NSURI;
        } else {
            nsUri = message.getPayloadNamespaceURI();
            if(nsUri == null)
                nsUri = EMPTY_PAYLOAD_NSURI;
        }
        WSDLOperationMapping op = methodHandlers.get(nsUri, localPart);

        // Check if payload itself is correct. Usually it is, so let us check last
        if (op == null && !unique.containsKey(nsUri,localPart)) {
            String dispatchKey = "{" + nsUri + "}" + localPart;
            String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(dispatchKey);
            throw new DispatchException(SOAPFaultBuilder.createSOAPFaultMessage(
                 binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient));
        }
        return op;
    }
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:34,代码来源:PayloadQNameBasedOperationFinder.java

示例6: getWSDLOperationQName

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
/**
 *
 * @param request Packet
 * @return QName of the wsdl operation.
 * @throws DispatchException if a unique operartion cannot be associated with this packet.
 */
public @NotNull QName getWSDLOperationQName(Packet request) throws DispatchException {
    QName opName;
    for(WSDLOperationFinder finder: opFinders) {
        opName = finder.getWSDLOperationQName(request);
        if(opName != null)
            return opName;
    }
    //No way to dispatch this request
    String err = MessageFormat.format("Request=[SOAPAction={0},Payload='{'{1}'}'{2}]",
            request.soapAction, request.getMessage().getPayloadNamespaceURI(),
            request.getMessage().getPayloadLocalPart());
    String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(err);
    Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage(
            binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient);
    throw new DispatchException(faultMsg);

}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:24,代码来源:OperationDispatcher.java

示例7: getWSDLOperationQName

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
/**
 *
 * @return not null if it finds a unique handler for the request
 *         null if it cannot idenitify a unique wsdl operation from the Payload QName.
 *
 * @throws DispatchException if the payload itself is incorrect, this happens when the payload is not accepted by
 *          any operation in the port.
 */
public QName getWSDLOperationQName(Packet request) throws DispatchException{
    Message message = request.getMessage();
    String localPart = message.getPayloadLocalPart();
    String nsUri;
    if (localPart == null) {
        localPart = EMPTY_PAYLOAD_LOCAL;
        nsUri = EMPTY_PAYLOAD_NSURI;
    } else {
        nsUri = message.getPayloadNamespaceURI();
        if(nsUri == null)
            nsUri = EMPTY_PAYLOAD_NSURI;
    }
    QName op = methodHandlers.get(nsUri, localPart);

    // Check if payload itself is correct. Usually it is, so let us check last
    if (op == null && !unique.containsKey(nsUri,localPart)) {
        String dispatchKey = "{" + nsUri + "}" + localPart;
        String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(dispatchKey);
        throw new DispatchException(SOAPFaultBuilder.createSOAPFaultMessage(
             binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient));
    }
    return op;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:32,代码来源:PayloadQNameBasedOperationFinder.java

示例8: getFaultMessage

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
public Message getFaultMessage() {
    QName faultCode = (soapVersion == SOAPVersion.SOAP_11)
        ? SOAPConstants.FAULT_CODE_VERSION_MISMATCH
        : SOAP12Constants.FAULT_CODE_VERSION_MISMATCH;
    return SOAPFaultBuilder.createSOAPFaultMessage(
            soapVersion, getLocalizedMessage(), faultCode);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:VersionMismatchException.java

示例9: createResponse

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
public Message createResponse(JavaCallInfo call) {
        Message responseMessage;
        if (call.getException() == null) {
            responseMessage = isOneWay ? null : createResponseMessage(call.getParameters(), call.getReturnValue());
        } else {
            Throwable e = call.getException();
            Throwable serviceException = getServiceException(e);
            if (e instanceof InvocationTargetException || serviceException != null) {
//              Throwable cause = e.getCause();
              //if (!(cause instanceof RuntimeException) && cause instanceof Exception) {
                if (serviceException != null) {
                    // Service specific exception
                    LOGGER.log(Level.FINE, serviceException.getMessage(), serviceException);
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion,
                            javaMethodModel.getCheckedException(serviceException.getClass()), serviceException);
                } else {
                    Throwable cause = e.getCause();
                    if (cause instanceof ProtocolException) {
                        // Application code may be throwing it intentionally
                        LOGGER.log(Level.FINE, cause.getMessage(), cause);
                    } else {
                        // Probably some bug in application code
                        LOGGER.log(Level.SEVERE, cause.getMessage(), cause);
                    }
                    responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, cause);
                }
            } else if (e instanceof DispatchException) {
                responseMessage = ((DispatchException)e).fault;
            } else {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
                responseMessage = SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
            }
        }
//        return req.createServerResponse(responseMessage, req.endpoint.getPort(), javaMethodModel.getOwner(), req.endpoint.getBinding());

        return responseMessage;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:TieHandler.java

示例10: createPipeHead

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
public @NotNull
PipeHead createPipeHead() {
    return new PipeHead() {
        private final Tube tube = TubeCloner.clone(masterTubeline);

        public @NotNull
        Packet process(Packet request, WebServiceContextDelegate wscd,
                TransportBackChannel tbc) {
            Container old = ContainerResolver.getDefault().enterContainer(container);
            try {
                request.webServiceContextDelegate = wscd;
                request.transportBackChannel = tbc;
                request.endpoint = WSEndpointImpl.this;
                request.addSatellite(wsdlProperties);

                Fiber fiber = engine.createFiber();
                Packet response;
                try {
                    response = fiber.runSync(tube, request);
                } catch (RuntimeException re) {
                    // Catch all runtime exceptions so that transport
                    // doesn't
                    // have to worry about converting to wire message
                    // TODO XML/HTTP binding
                    Message faultMsg = SOAPFaultBuilder
                            .createSOAPFaultMessage(soapVersion, null, re);
                    response = request.createServerResponse(faultMsg,
                            request.endpoint.getPort(), null,
                            request.endpoint.getBinding());
                }
                return response;
            } finally {
                ContainerResolver.getDefault().exitContainer(old);
            }
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:WSEndpointImpl.java

示例11: create

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
/**
 * Creates a fault {@link Message} that captures the code/subcode/subsubcode
 * defined by WS-Addressing if wsa:Action is not supported.
 *
 * @param unsupportedAction The unsupported Action. Must not be null.
 * @param av The WS-Addressing version of the message. Must not be null.
 * @param sv The SOAP Version of the message. Must not be null.
 *
 * @return
 *      A message representing SOAPFault that contains the WS-Addressing code/subcode/subsubcode.
 */
public static Message create(@NotNull String unsupportedAction, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    QName subcode = av.actionNotSupportedTag;
    String faultstring = String.format(av.actionNotSupportedText, unsupportedAction);

    Message faultMessage;
    SOAPFault fault;
    try {
        if (sv == SOAPVersion.SOAP_12) {
            fault = SOAPVersion.SOAP_12.getSOAPFactory().createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            Detail detail = fault.addDetail();
            SOAPElement se = detail.addChildElement(av.problemActionTag);
            se = se.addChildElement(av.actionTag);
            se.addTextNode(unsupportedAction);
        } else {
            fault = SOAPVersion.SOAP_11.getSOAPFactory().createFault();
            fault.setFaultCode(subcode);
        }
        fault.setFaultString(faultstring);

        faultMessage = SOAPFaultBuilder.createSOAPFaultMessage(sv, fault);
        if (sv == SOAPVersion.SOAP_11) {
            faultMessage.getHeaders().add(new ProblemActionHeader(unsupportedAction, av));
        }
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    return faultMessage;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:Messages.java

示例12: create

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
/**
 * Creates a fault {@link Message} that captures the code/subcode/subsubcode
 * defined by WS-Addressing if wsa:Action is not supported.
 *
 * @param unsupportedAction The unsupported Action. Must not be null.
 * @param av The WS-Addressing version of the message. Must not be null.
 * @param sv The SOAP Version of the message. Must not be null.
 *
 * @return
 *      A message representing SOAPFault that contains the WS-Addressing code/subcode/subsubcode.
 */
public static Message create(@NotNull String unsupportedAction, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    QName subcode = av.actionNotSupportedTag;
    String faultstring = String.format(av.actionNotSupportedText, unsupportedAction);

    Message faultMessage;
    SOAPFault fault;
    try {
        if (sv == SOAPVersion.SOAP_12) {
            fault = SOAPVersion.SOAP_12.saajSoapFactory.createFault();
            fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
            fault.appendFaultSubcode(subcode);
            Detail detail = fault.addDetail();
            SOAPElement se = detail.addChildElement(av.problemActionTag);
            se = se.addChildElement(av.actionTag);
            se.addTextNode(unsupportedAction);
        } else {
            fault = SOAPVersion.SOAP_11.saajSoapFactory.createFault();
            fault.setFaultCode(subcode);
        }
        fault.setFaultString(faultstring);

        faultMessage = SOAPFaultBuilder.createSOAPFaultMessage(sv, fault);
        if (sv == SOAPVersion.SOAP_11) {
            faultMessage.getHeaders().add(new ProblemActionHeader(unsupportedAction, av));
        }
    } catch (SOAPException e) {
        throw new WebServiceException(e);
    }

    return faultMessage;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:43,代码来源:Messages.java

示例13: createPipeHead

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
public @NotNull PipeHead createPipeHead() {
    return new PipeHead() {
        private final Tube tube = TubeCloner.clone(masterTubeline);

        public @NotNull Packet process(Packet request, WebServiceContextDelegate wscd, TransportBackChannel tbc) {
            request.webServiceContextDelegate = wscd;
            request.transportBackChannel = tbc;
            request.endpoint = WSEndpointImpl.this;
            if (wsdlProperties != null) {
                request.addSatellite(wsdlProperties);
            }
            Fiber fiber = engine.createFiber();
            Packet response;
            try {
                response = fiber.runSync(tube,request);
            } catch (RuntimeException re) {
                // Catch all runtime exceptions so that transport doesn't
                // have to worry about converting to wire message
                // TODO XML/HTTP binding
                re.printStackTrace();
                Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage(
                        soapVersion, null, re);
                response = request.createServerResponse(faultMsg, request.endpoint.getPort(), null, request.endpoint.getBinding());
            }
            return response;
        }
    };
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:29,代码来源:WSEndpointImpl.java

示例14: getResponseMessage

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
protected Message getResponseMessage(Exception e) {
    return SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:SOAPProviderArgumentBuilder.java

示例15: getResponseMessage

import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; //导入方法依赖的package包/类
@Override
protected Message getResponseMessage(Exception e) {
    // Will be called by AsyncProviderCallbackImpl.sendError
    return SOAPFaultBuilder.createSOAPFaultMessage(soapVersion, null, e);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:ProviderArgumentsBuilder.java


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