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";
static public final String XsdNs = "http://www.w3.org/2001/XMLSchema";
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;
StringBuilder paramOrder = new StringBuilder();
Setbody
parameter
*/
protected boolean isBodyParameter(ParameterImpl parameter) {
ParameterBinding paramBinding = parameter.getBinding();
return paramBinding.isBody();
}
protected boolean isHeaderParameter(ParameterImpl parameter) {
ParameterBinding paramBinding = parameter.getBinding();
return paramBinding.isHeader();
}
protected boolean isAttachmentParameter(ParameterImpl parameter) {
ParameterBinding paramBinding = parameter.getBinding();
return paramBinding.isAttachment();
}
/**
* Generates the Binding section of the WSDL
*/
protected void generateBinding() {
Binding newBinding = serviceDefinitions.binding().name(model.getBoundPortTypeName().getLocalPart());
extension.addBindingExtension(newBinding);
newBinding.type(model.getPortTypeName());
boolean first = true;
for (JavaMethodImpl method : model.getJavaMethods()) {
if (first) {
SOAPBinding sBinding = method.getBinding();
SOAPVersion soapVersion = sBinding.getSOAPVersion();
if (soapVersion == SOAPVersion.SOAP_12) {
com.sun.xml.internal.ws.wsdl.writer.document.soap12.SOAPBinding soapBinding = newBinding.soap12Binding();
soapBinding.transport(this.binding.getBindingId().getTransport());
if (sBinding.getStyle().equals(Style.DOCUMENT))
soapBinding.style(DOCUMENT);
else
soapBinding.style(RPC);
} else {
com.sun.xml.internal.ws.wsdl.writer.document.soap.SOAPBinding soapBinding = newBinding.soapBinding();
soapBinding.transport(this.binding.getBindingId().getTransport());
if (sBinding.getStyle().equals(Style.DOCUMENT))
soapBinding.style(DOCUMENT);
else
soapBinding.style(RPC);
}
first = false;
}
if (this.binding.getBindingId().getSOAPVersion() == SOAPVersion.SOAP_12)
generateSOAP12BindingOperation(method, newBinding);
else
generateBindingOperation(method, newBinding);
}
}
protected void generateBindingOperation(JavaMethodImpl method, Binding binding) {
BindingOperationType operation = binding.operation().name(method.getOperationName());
extension.addBindingOperationExtension(operation, method);
String targetNamespace = model.getTargetNamespace();
QName requestMessage = new QName(targetNamespace, method.getOperationName());
List* 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
StringBuilder relUri = new StringBuilder();
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 {
ArrayList