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


Java WebServiceException类代码示例

本文整理汇总了Java中javax.xml.ws.WebServiceException的典型用法代码示例。如果您正苦于以下问题:Java WebServiceException类的具体用法?Java WebServiceException怎么用?Java WebServiceException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: loadPropertiesFile

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
Properties loadPropertiesFile(String fileName) {
        ClassLoader classLoader = classLoader();
        Properties p = new Properties();
        try {
                InputStream is = null;
                if (classLoader == null) {
                        is = ClassLoader.getSystemResourceAsStream(fileName);
                } else {
                        is = classLoader.getResourceAsStream(fileName);
                }
                if (is != null) {
                        p.load(is);
                }
        } catch (Exception e) {
                throw new WebServiceException(e);
        }
        return p;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:DatabindingFactoryImpl.java

示例2: getPort

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
/**
     * Determines the reference to a web service provided by a technical
     * service.
     * 
     * @param <T>
     *            The type of service obtained.
     * @param localWsdlUrl
     *            The URL to a local service-related WSDL. The WSDL should be
     *            provided as file in a bundled .jar file.
     * @param serviceClass
     *            The service class implemented by the WSDL.
     * @return The web service reference.
     * @throws ParserConfigurationException
     * @throws WebServiceException
     *             Has to be caught by a caller, although it's a runtime
     *             exception
     */
    public <T> T getPort(URL localWsdlUrl, Class<T> serviceClass)
            throws ParserConfigurationException, WebServiceException {

        Service service = getService(localWsdlUrl, serviceClass);

        //EndpointReference epr = determineEndpointReference();
        T port = service.getPort(serviceClass);
        BindingProvider bindingProvider = (BindingProvider) port;
        Map<String, Object> clientRequestContext = bindingProvider
                .getRequestContext();
        clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, details.getEndpointURL());

        if (requiresUserAuthentication(userName, password)) {
//            BindingProvider bindingProvider = (BindingProvider) port;
//            Map<String, Object> clientRequestContext = bindingProvider
//                    .getRequestContext();
            clientRequestContext.put(BindingProvider.USERNAME_PROPERTY,
                    userName);
            clientRequestContext.put(BindingProvider.PASSWORD_PROPERTY,
                    password);
        }
        return port;
    }
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:41,代码来源:WSPortConnector.java

示例3: createMUSOAPFaultMessage

import javax.xml.ws.WebServiceException; //导入依赖的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

示例4: getPort

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
@Override
public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
    //get the portType from SEI
    QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
    WSDLService tmpWsdlService = this.wsdlService;
    if (tmpWsdlService == null) {
        // assigning it to local variable and not setting it back to this.wsdlService intentionally
        // as we don't want to include the service instance with information gathered from sei
        tmpWsdlService = getWSDLModelfromSEI(portInterface);
        //still null? throw error need wsdl metadata to create a proxy
        if(tmpWsdlService == null) {
            throw new WebServiceException(ProviderApiMessages.NO_WSDL_NO_PORT(portInterface.getName()));
        }
    }
    //get the first port corresponding to the SEI
    WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
    if (port == null) {
        throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
    }
    QName portName = port.getName();
    return getPort(portName, portInterface,features);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:WSServiceDelegate.java

示例5: parse

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
public TubelineFeature parse(XMLEventReader reader) throws WebServiceException {
    try {
        final StartElement element = reader.nextEvent().asStartElement();
        boolean attributeEnabled = true;
        final Iterator iterator = element.getAttributes();
        while (iterator.hasNext()) {
            final Attribute nextAttribute = (Attribute) iterator.next();
            final QName attributeName = nextAttribute.getName();
            if (ENABLED_ATTRIBUTE_NAME.equals(attributeName)) {
                attributeEnabled = ParserUtil.parseBooleanValue(nextAttribute.getValue());
            } else if (NAME_ATTRIBUTE_NAME.equals(attributeName)) {
                // TODO use name attribute
            } else {
                // TODO logging message
                throw LOGGER.logSevereException(new WebServiceException("Unexpected attribute"));
            }
        }
        return parseFactories(attributeEnabled, element, reader);
    } catch (XMLStreamException e) {
        throw LOGGER.logSevereException(new WebServiceException("Failed to unmarshal XML document", e));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:TubelineFeatureReader.java

示例6: verifyPrimaryWSDL

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
/**
 * Verifies whether the given primaryWsdl contains the given serviceName.
 * If the WSDL doesn't have the service, it throws an WebServiceException.
 */
private static void verifyPrimaryWSDL(@NotNull SDDocumentSource primaryWsdl, @NotNull QName serviceName) {
    SDDocumentImpl primaryDoc = SDDocumentImpl.create(primaryWsdl,serviceName,null);
    if (!(primaryDoc instanceof SDDocument.WSDL)) {
        throw new WebServiceException(primaryWsdl.getSystemId()+
                " is not a WSDL. But it is passed as a primary WSDL");
    }
    SDDocument.WSDL wsdlDoc = (SDDocument.WSDL)primaryDoc;
    if (!wsdlDoc.hasService()) {
        if(wsdlDoc.getAllServices().isEmpty())
            throw new WebServiceException("Not a primary WSDL="+primaryWsdl.getSystemId()+
                    " since it doesn't have Service "+serviceName);
        else
            throw new WebServiceException("WSDL "+primaryDoc.getSystemId()
                    +" has the following services "+wsdlDoc.getAllServices()
                    +" but not "+serviceName+". Maybe you forgot to specify a serviceName and/or targetNamespace in @WebService/@WebServiceProvider?");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:EndpointFactory.java

示例7: validateServerPolicyMap

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
/**
 * Checks if the PolicyMap has only single alternative in the scope.
 *
 * @param policyMap
 *      PolicyMap that needs to be validated.
 */
private void validateServerPolicyMap(PolicyMap policyMap) {
    try {
        final ValidationProcessor validationProcessor = ValidationProcessor.getInstance();

        for (Policy policy : policyMap) {

            // TODO:  here is a good place to check if the actual policy has only one alternative...

            for (AssertionSet assertionSet : policy) {
                for (PolicyAssertion assertion : assertionSet) {
                    Fitness validationResult = validationProcessor.validateServerSide(assertion);
                    if (validationResult != Fitness.SUPPORTED) {
                        throw new PolicyException(PolicyMessages.WSP_1015_SERVER_SIDE_ASSERTION_VALIDATION_FAILED(
                                assertion.getName(),
                                validationResult));
                    }
                }
            }
        }
    } catch (PolicyException e) {
        throw new WebServiceException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:DefaultPolicyResolver.java

示例8: invoke

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
/**
 * Handelt het verzoek af.
 * @param request het verzoek
 * @return het response.
 */
@Bedrijfsregel(Regel.R1978)
@Bedrijfsregel(Regel.R1979)
@Override
public final DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("Synchronisatie Service");
    LOGGER.debug("SynchronisatieService aangeroepen");
    try {
        schemaValidatorService.valideer(request, SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("SynchronisatieService aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    return AlgemeneFoutHandler
            .doeBijFout(e1 -> {
                LOGGER.error("Algemene fout", e1);
                throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het verzoek.");
            }).voerUit(() -> maakResponse(request));
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:25,代码来源:SynchronisatieWebServiceImpl.java

示例9: readWrappedRequest

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
protected void readWrappedRequest(Message msg, Object[] args) throws JAXBException, XMLStreamException {
    if (!msg.hasPayload()) {
        throw new WebServiceException("No payload. Expecting payload with "+wrapperName+" element");
    }
    XMLStreamReader reader = msg.readPayload();
    XMLStreamReaderUtil.verifyTag(reader,wrapperName);
    reader.nextTag();
    while(reader.getEventType()==XMLStreamReader.START_ELEMENT) {
        // TODO: QName has a performance issue
        QName name = reader.getName();
        WrappedPartBuilder part = wrappedParts.get(name);
        if(part==null) {
            // no corresponding part found. ignore
            XMLStreamReaderUtil.skipElement(reader);
            reader.nextTag();
        } else {
            part.readRequest(args,reader, msg.getAttachments());
        }
        XMLStreamReaderUtil.toNextTag(reader, name);
    }

    // we are done with the body
    reader.close();
    XMLStreamReaderFactory.recycle(reader);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:EndpointArgumentsBuilder.java

示例10: getPayload

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
public Object getPayload(JAXBContext context) {
    if (context == null) {
        return getPayload(defaultJaxbContext);
    }
    if (context == null)
        throw new WebServiceException("JAXBContext parameter cannot be null");

    Object o;
    if (lm == null) {
        try {
            o = packet.getMessage().copy().readPayloadAsJAXB(context.createUnmarshaller());
        } catch (JAXBException e) {
            throw new WebServiceException(e);
        }
    } else {
        o = lm.getPayload(context);
        lm = new JAXBLogicalMessageImpl(context, o);
    }
    return o;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:LogicalMessageImpl.java

示例11: createDOM

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
private Document createDOM(SDDocument doc) {
    // Get infoset
    ByteArrayBuffer bab = new ByteArrayBuffer();
    try {
        doc.writeTo(null, resolver, bab);
    } catch (IOException ioe) {
        throw new WebServiceException(ioe);
    }

    // Convert infoset to DOM
    Transformer trans = XmlUtil.newTransformer();
    Source source = new StreamSource(bab.newInputStream(), null); //doc.getURL().toExternalForm());
    DOMResult result = new DOMResult();
    try {
        trans.transform(source, result);
    } catch(TransformerException te) {
        throw new WebServiceException(te);
    }
    return (Document)result.getNode();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:AbstractSchemaValidationTube.java

示例12: skipDuringOrgJvnetWsToComOracleWebservicesPackageMove

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
private static boolean skipDuringOrgJvnetWsToComOracleWebservicesPackageMove(
    final Method builderMethod,
    final Object annotationFieldValue)
{
    final Class<?> annotationFieldValueClass = annotationFieldValue.getClass();
    if (! annotationFieldValueClass.isEnum()) {
        return false;
    }
    final Class<?>[] builderMethodParameterTypes = builderMethod.getParameterTypes();
    if (builderMethodParameterTypes.length != 1) {
        throw new WebServiceException("expected only 1 parameter");
    }
    final String builderParameterTypeName = builderMethodParameterTypes[0].getName();
    if (! builderParameterTypeName.startsWith("com.oracle.webservices.internal.test.features_annotations_enums.apinew") &&
        ! builderParameterTypeName.startsWith("com.oracle.webservices.internal.api")) {
        return false;
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:WebServiceFeatureList.java

示例13: getReplyTo

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
public static WSEndpointReference getReplyTo(@NotNull MessageHeaders headers, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    if (av == null) {
        throw new IllegalArgumentException(AddressingMessages.NULL_ADDRESSING_VERSION());
    }

    Header h = getFirstHeader(headers, av.replyToTag, true, sv);
    WSEndpointReference replyTo;
    if (h != null) {
        try {
            replyTo = h.readAsEPR(av);
        } catch (XMLStreamException e) {
            throw new WebServiceException(AddressingMessages.REPLY_TO_CANNOT_PARSE(), e);
        }
    } else {
        replyTo = av.anonymousEpr;
    }

    return replyTo;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:AddressingUtils.java

示例14: invoke

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
/**
 * Voert het verzoek uit.
 * @param request de ingaande request
 * @return het response
 */
@Bedrijfsregel(Regel.R1978)
@Bedrijfsregel(Regel.R1979)
@Bedrijfsregel(Regel.R1984)
@Override
public final DOMSource invoke(final DOMSource request) {
    Thread.currentThread().setName("OnderhoudAfnemerindicatie");
    LOGGER.debug("AfnemerindicatiesService aangeroepen");
    try {
        schemaValidatorService.valideer(request, OnderhoudAfnemerindicatiesWebServiceImpl.SCHEMA);
    } catch (SchemaValidatorService.SchemaValidatieException schemaValidatieException) {
        LOGGER.debug("AfnemerindicatiesService aangeroepen met invalide xml", schemaValidatieException);
        throw new Fault(schemaValidatieException.getCause());
    }
    BrpNu.set(DatumUtil.nuAlsZonedDateTime());
    return AlgemeneFoutHandler.doeBijFout(
            e1 -> {
                LOGGER.error("Algemene fout", e1);
                throw new WebServiceException("Er is iets fout gegaan bij het verwerken van het verzoek.");
            }
    ).voerUit(() -> getDomSource(request));
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:27,代码来源:OnderhoudAfnemerindicatiesWebServiceImpl.java

示例15: createDispatch

import javax.xml.ws.WebServiceException; //导入依赖的package包/类
/**
 * Creates a new {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portName
 *      see {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param owner
 *      see <a href="#param">common parameters</a>
 * @param binding
 *      see <a href="#param">common parameters</a>
 * @param clazz
 *      Type of the {@link Dispatch} to be created.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param mode
 *      The mode of the dispatch.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param next
 *      see <a href="#param">common parameters</a>
 * @param epr
 *      see <a href="#param">common parameters</a>
 * TODO: are these parameters making sense?
 */
@SuppressWarnings("unchecked")
    public static <T> Dispatch<T> createDispatch(QName portName,
                                             WSService owner,
                                             WSBinding binding,
                                             Class<T> clazz, Service.Mode mode, Tube next,
                                             @Nullable WSEndpointReference epr) {
    if (clazz == SOAPMessage.class) {
        return (Dispatch<T>) createSAAJDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == Source.class) {
        return (Dispatch<T>) createSourceDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == DataSource.class) {
        return (Dispatch<T>) createDataSourceDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == Message.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createMessageDispatch(portName, owner, binding, next, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Message>");
    } else if (clazz == Packet.class) {
        return (Dispatch<T>) createPacketDispatch(portName, owner, binding, next, epr);
    } else
        throw new WebServiceException("Unknown class type " + clazz.getName());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:Stubs.java


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