private static URL asCallbackWsdlURL(URL wsdlURL) {
if (wsdlURL == null) {
return null;
}
final CallbackInfo cbInfo = CallContext.createCallbackInfo(wsdlURL);
if (cbInfo.getCallbackServiceName() == null) {
// old-style callback definition without callback service.
return null;
}
String protocol = wsdlURL.getProtocol();
if (!("http".equals(protocol) || "https".equals(protocol))) {
// not a service registry query, return as it is.
return wsdlURL;
}
final String path = wsdlURL.getPath();
if (!path.startsWith("/services/registry/lookup/wsdl/")) {
// not a service registry query, return as it is.
return wsdlURL;
}
try {
final String urlString = wsdlURL.toExternalForm();
final String resString = urlString.substring(0,
urlString.indexOf(SR_QUERY_PATH) + SR_QUERY_PATH_LEN)
+ URLEncoder.encode(cbInfo.getCallbackServiceName().toString(), "UTF-8")
+ "?mergeWithPolicies=true&participant=provider";
return new URL(resString);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {