Search in sources :

Example 31 with WebServiceException

use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.

the class WSServiceDelegate method addPort.

public void addPort(QName portName, String bindingId, String endpointAddress) throws WebServiceException {
    if (!ports.containsKey(portName)) {
        BindingID bid = (bindingId == null) ? BindingID.SOAP11_HTTP : BindingID.parse(bindingId);
        ports.put(portName, new PortInfo(this, (endpointAddress == null) ? null : EndpointAddress.create(endpointAddress), portName, bid));
    } else
        throw new WebServiceException(DispatchMessages.DUPLICATE_PORT(portName.toString()));
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) BindingID(com.sun.xml.ws.api.BindingID)

Example 32 with WebServiceException

use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.

the class WSServiceDelegate method createEndpointIFBaseProxy.

private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr, QName portName, Class<T> portInterface, WebServiceFeatureList webServiceFeatures, SEIPortInfo eif) {
    // fail if service doesnt have WSDL
    if (wsdlService == null) {
        throw new WebServiceException(ClientMessages.INVALID_SERVICE_NO_WSDL(serviceName));
    }
    if (wsdlService.get(portName) == null) {
        throw new WebServiceException(ClientMessages.INVALID_PORT_NAME(portName, buildWsdlPortNames()));
    }
    BindingImpl binding = eif.createBinding(webServiceFeatures, portInterface);
    InvocationHandler pis = getStubHandler(binding, eif, epr);
    T proxy = createProxy(portInterface, pis);
    if (serviceInterceptor != null) {
        serviceInterceptor.postCreateProxy((WSBindingProvider) proxy, portInterface);
    }
    return proxy;
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) WebServiceException(jakarta.xml.ws.WebServiceException) InvocationHandler(java.lang.reflect.InvocationHandler)

Example 33 with WebServiceException

use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.

the class DispatchImpl method invokeOneWay.

public final void invokeOneWay(T in) {
    Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
    try {
        if (LOGGER.isLoggable(Level.FINE)) {
            dumpParam(in, "invokeOneWay(T)");
        }
        try {
            checkNullAllowed(in, requestContext, binding, mode);
            Packet request = createPacket(in);
            request.setState(Packet.State.ClientRequest);
            setProperties(request, false);
            process(request, requestContext, this);
        } catch (WebServiceException e) {
            // it could be a WebServiceException or a ProtocolException
            throw e;
        } catch (Throwable e) {
            // WebServiceException
            throw new WebServiceException(e);
        }
    } finally {
        ContainerResolver.getDefault().exitContainer(old);
    }
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) Container(com.sun.xml.ws.api.server.Container) WebServiceException(jakarta.xml.ws.WebServiceException)

Example 34 with WebServiceException

use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.

the class JAXBDispatch method toReturnValue.

Object toReturnValue(Packet response) {
    try {
        Unmarshaller unmarshaller = jaxbcontext.createUnmarshaller();
        Message msg = response.getMessage();
        switch(mode) {
            case PAYLOAD:
                return msg.<Object>readPayloadAsJAXB(unmarshaller);
            case MESSAGE:
                Source result = msg.readEnvelopeAsSource();
                return unmarshaller.unmarshal(result);
            default:
                throw new WebServiceException("Unrecognized dispatch mode");
        }
    } catch (JAXBException e) {
        throw new WebServiceException(e);
    }
}
Also used : Message(com.sun.xml.ws.api.message.Message) JAXBDispatchMessage(com.sun.xml.ws.message.jaxb.JAXBDispatchMessage) WebServiceException(jakarta.xml.ws.WebServiceException) JAXBException(jakarta.xml.bind.JAXBException) Unmarshaller(jakarta.xml.bind.Unmarshaller) Source(javax.xml.transform.Source)

Example 35 with WebServiceException

use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.

the class WebServiceFeatureList method getWebServiceFeatureBeanViaBuilder.

private static WebServiceFeature getWebServiceFeatureBeanViaBuilder(final Annotation annotation, final Class<? extends WebServiceFeature> beanClass) {
    try {
        final Method featureBuilderMethod = beanClass.getDeclaredMethod("builder");
        final Object builder = featureBuilderMethod.invoke(beanClass);
        final Method buildMethod = builder.getClass().getDeclaredMethod("build");
        for (Method builderMethod : builder.getClass().getDeclaredMethods()) {
            if (!builderMethod.equals(buildMethod) && !builderMethod.isSynthetic()) {
                final String methodName = builderMethod.getName();
                final Method annotationMethod = annotation.annotationType().getDeclaredMethod(methodName);
                final Object annotationFieldValue = annotationMethod.invoke(annotation);
                final Object[] arg = { annotationFieldValue };
                if (skipDuringOrgJvnetWsToComOracleWebservicesPackageMove(builderMethod, annotationFieldValue)) {
                    continue;
                }
                builderMethod.invoke(builder, arg);
            }
        }
        final Object result = buildMethod.invoke(builder);
        if (result instanceof WebServiceFeature) {
            return (WebServiceFeature) result;
        } else {
            throw new WebServiceException("Not a WebServiceFeature: " + result);
        }
    } catch (final NoSuchMethodException e) {
        LOGGER.log(Level.INFO, "Unable to find builder method on webservice feature: " + beanClass.getName(), e);
        return null;
    } catch (final IllegalAccessException | InvocationTargetException e) {
        throw new WebServiceException(e);
    }
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) ImpliesWebServiceFeature(com.sun.xml.ws.api.ImpliesWebServiceFeature) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) WSDLFeaturedObject(com.sun.xml.ws.api.model.wsdl.WSDLFeaturedObject) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

WebServiceException (jakarta.xml.ws.WebServiceException)396 QName (javax.xml.namespace.QName)50 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)38 SOAPException (jakarta.xml.soap.SOAPException)35 JAXBException (jakarta.xml.bind.JAXBException)30 IOException (java.io.IOException)30 Node (org.w3c.dom.Node)29 JAXBContext (jakarta.xml.bind.JAXBContext)27 SOAPMessage (jakarta.xml.soap.SOAPMessage)26 XMLStreamException (javax.xml.stream.XMLStreamException)25 Source (javax.xml.transform.Source)23 ProtocolException (jakarta.xml.ws.ProtocolException)20 Dispatch (jakarta.xml.ws.Dispatch)19 MalformedURLException (java.net.MalformedURLException)19 URL (java.net.URL)18 Map (java.util.Map)18 MessageContext (jakarta.xml.ws.handler.MessageContext)17 StreamSource (javax.xml.transform.stream.StreamSource)17 HandlerTracker (fromwsdl.handler.common.HandlerTracker)14 HandlerTracker (handler.handler_processing.common.HandlerTracker)14