document
style
* soapBindings
*/
private static final String DOCUMENT = "document";
/**
* Constant String "rpc" used to specify rpc
style
* soapBindings
*/
private static final String RPC = "rpc";
/**
* Constant String "literal" used to create literal
use binddings
*/
private static final String LITERAL = "literal";
/**
* Constant String to flag the URL to replace at runtime for the endpoint
*/
private static final String REPLACE_WITH_ACTUAL_URL = "REPLACE_WITH_ACTUAL_URL";
private Setmethod
is wrapper style
* @param method The {@link JavaMethod} to check if it is wrapper style
* @return true if the method is wrapper style, otherwise, false.
*/
protected boolean isWrapperStyle(JavaMethodImpl method) {
if (method.getRequestParameters().size() > 0) {
ParameterImpl param = method.getRequestParameters().iterator().next();
return param.isWrapperStyle();
}
return false;
}
/**
* Determines if a {@link JavaMethod} is rpc/literal
* @param method The method to check
* @return true if method is rpc/literal, otherwise, false
*/
protected boolean isRpcLit(JavaMethodImpl method) {
return method.getBinding().getStyle() == Style.RPC;
}
/**
* Generates the parameterOrder for a PortType operation
* @param operation The operation to generate the parameterOrder for
* @param method The {@link JavaMethod} to generate the parameterOrder from
*/
protected void generateParameterOrder(Operation operation, JavaMethodImpl method) {
if (method.getMEP() == MEP.ONE_WAY)
return;
if (isRpcLit(method))
generateRpcParameterOrder(operation, method);
else
generateDocumentParameterOrder(operation, method);
}
/**
* Generates the parameterOrder for a PortType operation
* @param operation the operation to generate the parameterOrder for
* @param method the {@link JavaMethod} to generate the parameterOrder from
*/
protected void generateRpcParameterOrder(Operation operation, JavaMethodImpl method) {
String partName;
StringBuffer paramOrder = new StringBuffer();
Set* For example, {@code relative("http://www.sun.com/abc/def","http://www.sun.com/pqr/stu") => "../abc/def"} * *
* This method only works on hierarchical URI's, not opaque URI's (refer to the * java.net.URI * javadoc for complete definitions of these terms. * *
* This method will not normalize the relative URI. * @param uri the URI to relativize * * * @param baseUri the base URI to use for the relativization * @return the relative URI or the original URI if a relative one could not be computed */ protected static String relativize(String uri, String baseUri) { try { assert uri!=null; if(baseUri==null) return uri; URI theUri = new URI(escapeURI(uri)); URI theBaseUri = new URI(escapeURI(baseUri)); if (theUri.isOpaque() || theBaseUri.isOpaque()) return uri; if (!equalsIgnoreCase(theUri.getScheme(), theBaseUri.getScheme()) || !equal(theUri.getAuthority(), theBaseUri.getAuthority())) return uri; String uriPath = theUri.getPath(); String basePath = theBaseUri.getPath(); // normalize base path if (!basePath.endsWith("/")) { basePath = normalizeUriPath(basePath); } if( uriPath.equals(basePath)) return "."; String relPath = calculateRelativePath(uriPath, basePath); if (relPath == null) return uri; // recursion found no commonality in the two uris at all StringBuffer relUri = new StringBuffer(); relUri.append(relPath); if (theUri.getQuery() != null) relUri.append('?').append(theUri.getQuery()); if (theUri.getFragment() != null) relUri.append('#').append(theUri.getFragment()); return relUri.toString(); } catch (URISyntaxException e) { throw new InternalError("Error escaping one of these uris:\n\t"+uri+"\n\t"+baseUri); } } private static String calculateRelativePath(String uri, String base) { if (base == null) { return null; } if (uri.startsWith(base)) { return uri.substring(base.length()); } else { return "../" + calculateRelativePath(uri, getParentUriPath(base)); } } /** * Implements the SchemaOutputResolver used by JAXB to */ protected class JAXWSOutputSchemaResolver extends SchemaOutputResolver { /** * Creates the {@link Result} object used by JAXB to generate a schema for the * namesapceUri namespace. * @param namespaceUri The namespace for the schema being generated * @param suggestedFileName the JAXB suggested file name for the schema file * @return the {@link Result} for JAXB to generate the schema into * @throws java.io.IOException thrown if on IO error occurs */ public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { return inlineSchemas ? createInlineSchema(namespaceUri, suggestedFileName) : createOutputFile(namespaceUri, suggestedFileName); } } private void register(WSDLGeneratorExtension h) { extensionHandlers.add(h); } }