use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.
the class WSEndpointReference method writeWsdliLocation.
/**
* @param writer the writer should be at the start of element.
* @param service Namespace URI of servcie is used as targetNamespace of wsdl if wsdlTargetNamespace is not null
* @param wsdlAddress wsdl location
* @param wsdlTargetNamespace targetnamespace of wsdl to be put in wsdliLocation
*/
private static void writeWsdliLocation(StreamWriterBufferCreator writer, QName service, String wsdlAddress, String wsdlTargetNamespace) throws XMLStreamException {
String wsdliLocation = "";
if (wsdlTargetNamespace != null) {
wsdliLocation = wsdlTargetNamespace + " ";
} else if (service != null) {
wsdliLocation = service.getNamespaceURI() + " ";
} else {
throw new WebServiceException("WSDL target Namespace cannot be resolved");
}
wsdliLocation += wsdlAddress;
writer.writeNamespace(W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_PREFIX, W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_NAMESPACE);
writer.writeAttribute(W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_PREFIX, W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_NAMESPACE, W3CAddressingMetadataConstants.WSAM_WSDLI_ATTRIBUTE_LOCALNAME, wsdliLocation);
}
use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.
the class ManagementAssertion method getAssertion.
/**
* Return ManagementAssertion if one can be found in the policy map under
* the given service and port name.
*
* @param <T> The implementation class of the assertion.
* @param name The fully qualified name of the server or client assertion.
* @param policyMap The policy map. May be null.
* @param serviceName The WSDL service name. May not be null.
* @param portName The WSDL port name. May not be null.
* @param type The implementation class of the assertion.
* @return An instance of ManagementAssertion or null.
* @throws WebServiceException If computing the effective policy of the endpoint scope failed.
*/
protected static <T extends ManagementAssertion> T getAssertion(final QName name, final PolicyMap policyMap, QName serviceName, QName portName, Class<T> type) throws WebServiceException {
try {
PolicyAssertion assertion = null;
if (policyMap != null) {
final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
final Policy policy = policyMap.getEndpointEffectivePolicy(key);
if (policy != null) {
final Iterator<AssertionSet> assertionSets = policy.iterator();
if (assertionSets.hasNext()) {
final AssertionSet assertionSet = assertionSets.next();
final Iterator<PolicyAssertion> assertions = assertionSet.get(name).iterator();
if (assertions.hasNext()) {
assertion = assertions.next();
}
}
}
}
return assertion == null ? null : assertion.getImplementation(type);
} catch (PolicyException ex) {
throw LOGGER.logSevereException(new WebServiceException(ManagementMessages.WSM_1001_FAILED_ASSERTION(name), ex));
}
}
use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.
the class AddressingUtils method getFaultTo.
public static WSEndpointReference getFaultTo(@NotNull MessageHeaders headers, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
if (av == null) {
throw new IllegalArgumentException(AddressingMessages.NULL_ADDRESSING_VERSION());
}
Header h = getFirstHeader(headers, av.faultToTag, true, sv);
WSEndpointReference faultTo = null;
if (h != null) {
try {
faultTo = h.readAsEPR(av);
} catch (XMLStreamException e) {
throw new WebServiceException(AddressingMessages.FAULT_TO_CANNOT_PARSE(), e);
}
}
return faultTo;
}
use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.
the class AddressingUtils method getReplyTo.
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;
}
use of jakarta.xml.ws.WebServiceException in project metro-jax-ws by eclipse-ee4j.
the class BindingID method customize.
/**
* Parses parameter portion and returns appropriately populated {@link SOAPHTTPImpl}
*/
private static SOAPHTTPImpl customize(String lexical, SOAPHTTPImpl base) {
if (lexical.equals(base.toString()))
return base;
// otherwise we must have query parameter
// we assume the spec won't define any tricky parameters that require
// complicated handling (such as %HH or non-ASCII char), so this parser
// is quite simple-minded.
SOAPHTTPImpl r = new SOAPHTTPImpl(base.getSOAPVersion(), lexical, base.canGenerateWSDL());
// With X_SOAP12_HTTP, base != lexical and lexical does n't have any query string
if (lexical.indexOf('?') == -1) {
return r;
}
String query = URLDecoder.decode(lexical.substring(lexical.indexOf('?') + 1), StandardCharsets.UTF_8);
for (String token : query.split("&")) {
int idx = token.indexOf('=');
if (idx < 0)
throw new WebServiceException("Malformed binding ID (no '=' in " + token + ")");
r.parameters.put(token.substring(0, idx), token.substring(idx + 1));
}
return r;
}
Aggregations