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()));
}
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;
}
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);
}
}
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);
}
}
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);
}
}
Aggregations