Methods Summary |
---|
protected javax.wsdl.Definition | createDefinition()Build a Definition from the input wsdl file or create
a new Definition
Definition def;
if (inputWSDL == null) {
def = WSDLFactory.newInstance().newDefinition();
} else {
javax.wsdl.xml.WSDLReader reader =
WSDLFactory.newInstance().newWSDLReader();
Document doc = XMLUtils.newDocument(inputWSDL);
def = reader.readWSDL(null, doc);
// The input wsdl types section is deleted. The
// types will be added back in at the end of processing.
def.setTypes(null);
}
return def;
|
private void | createDocumentFragment()Method createDocumentFragment
try {
this.docHolder = XMLUtils.newDocument();
} catch (ParserConfigurationException e) {
// This should not occur
throw new InternalException(e);
}
|
protected org.w3c.dom.Element | createDocumentationElement(java.lang.String documentation)Create a documentation element
Element element = docHolder.createElementNS(Constants.NS_URI_WSDL11, "documentation");
element.setPrefix(Constants.NS_PREFIX_WSDL);
Text textNode =
docHolder.createTextNode(documentation);
element.appendChild(textNode);
return element;
|
protected javax.xml.namespace.QName | createMessageName(javax.wsdl.Definition def, java.lang.String methodName)Method createMessageName
QName qName = new QName(intfNS, methodName);
// Check the make sure there isn't a message with this name already
int messageNumber = 1;
while (def.getMessage(qName) != null) {
StringBuffer namebuf = new StringBuffer(methodName);
namebuf.append(messageNumber);
qName = new QName(intfNS, namebuf.toString());
messageNumber++;
}
return qName;
|
protected Types | createTypes(javax.wsdl.Definition def)Build a Types object and load the input wsdl types
types = new Types(def, tm, (TypeMapping)tmr.getDefaultTypeMapping(),
namespaces, intfNS, stopClasses, serviceDesc, this);
if (inputWSDL != null) {
types.loadInputTypes(inputWSDL);
}
if (inputSchema != null) {
StringTokenizer tokenizer = new StringTokenizer(inputSchema, ", ");
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
types.loadInputSchema(token);
}
}
// If we're supposed to emit all mapped types, do it now.
if (emitAllTypes && tm != null) {
Class[] mappedTypes = tm.getAllClasses();
for (int i = 0; i < mappedTypes.length; i++) {
Class mappedType = mappedTypes[i];
QName name = tm.getTypeQName(mappedType);
if (name.getLocalPart().indexOf(SymbolTable.ANON_TOKEN) != -1) {
// If this is an anonymous type, it doesn't need to be
// written out here (and trying to do so will generate an
// error). Skip it.
continue;
}
/**
* If it's a non-standard type, make sure it shows up in
* our WSDL
*/
if (standardTypes.getSerializer(mappedType) == null) {
types.writeTypeForPart(mappedType, name);
}
}
// Don't bother checking for subtypes, since we already wrote
// all the possibilities.
types.mappedTypes = null;
}
return types;
|
public void | emit(java.lang.String filename1, java.lang.String filename2)Generates WSDL documents for a given Class
// Get interface and implementation defs
Definition intf = getIntfWSDL();
Definition impl = getImplWSDL();
// Supply reasonable file names if not supplied
if (filename1 == null) {
filename1 = getServicePortName() + "_interface.wsdl";
}
if (filename2 == null) {
filename2 = getServicePortName() + "_implementation.wsdl";
}
for (int i = 0; (extraClasses != null) && (i < extraClasses.length);
i++) {
types.writeTypeForPart(extraClasses[i], null);
}
// types.updateNamespaces();
// Write out the interface def
Document doc =
WSDLFactory.newInstance().newWSDLWriter().getDocument(intf);
types.insertTypesFragment(doc);
prettyDocumentToFile(doc, filename1);
// Write out the implementation def
doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(impl);
prettyDocumentToFile(doc, filename2);
|
public void | emit(java.lang.String filename)Generates a complete WSDL document for a given Class
emit(filename, MODE_ALL);
|
public org.w3c.dom.Document | emit(int mode)Generates a WSDL document for a given Class .
The WSDL generated is controlled by the mode parameter
mode 0: All
mode 1: Interface
mode 2: Implementation
Document doc;
Definition def;
switch (mode) {
default:
case MODE_ALL:
def = getWSDL();
for (int i = 0;
(extraClasses != null) && (i < extraClasses.length);
i++) {
types.writeTypeForPart(extraClasses[i], null);
}
// types.updateNamespaces();
doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(
def);
types.insertTypesFragment(doc);
break;
case MODE_INTERFACE:
def = getIntfWSDL();
for (int i = 0;
(extraClasses != null) && (i < extraClasses.length);
i++) {
types.writeTypeForPart(extraClasses[i], null);
}
// types.updateNamespaces();
doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(
def);
types.insertTypesFragment(doc);
break;
case MODE_IMPLEMENTATION:
def = getImplWSDL();
doc = WSDLFactory.newInstance().newWSDLWriter().getDocument(
def);
break;
}
// Add Axis version info as comment to beginnning of generated WSDL
if (versionMessage == null) {
versionMessage = Messages.getMessage(
"wsdlCreated00",
XMLUtils.xmlEncodeString(Version.getVersion()));
}
// If version is empty string, don't emit one
if (versionMessage != null && versionMessage.length() > 0) {
Comment wsdlVersion = doc.createComment(versionMessage);
doc.getDocumentElement().insertBefore(
wsdlVersion, doc.getDocumentElement().getFirstChild());
}
// Return the document
return doc;
|
public void | emit(java.lang.String filename, int mode)Generates a WSDL document for a given Class .
The WSDL generated is controlled by the mode parameter
mode 0: All
mode 1: Interface
mode 2: Implementation
Document doc = emit(mode);
// Supply a reasonable file name if not supplied
if (filename == null) {
filename = getServicePortName();
switch (mode) {
case MODE_ALL:
filename += ".wsdl";
break;
case MODE_INTERFACE:
filename += "_interface.wsdl";
break;
case MODE_IMPLEMENTATION:
filename += "_implementation.wsdl";
break;
}
}
prettyDocumentToFile(doc, filename);
|
public java.lang.String | emitToString(int mode)Generates a String containing the WSDL for a given Class .
The WSDL generated is controlled by the mode parameter
mode 0: All
mode 1: Interface
mode 2: Implementation
Document doc = emit(mode);
StringWriter sw = new StringWriter();
XMLUtils.PrettyDocumentToWriter(doc, sw);
return sw.toString();
|
public java.util.Vector | getAllowedMethods()Returns a vector of methods to export
return allowedMethods;
|
public java.lang.String | getBindingName()Returns the String representation of the binding name
return bindingName;
|
public java.lang.Class | getCls()Returns the Class to export
return cls;
|
public org.apache.axis.encoding.TypeMapping | getDefaultTypeMapping()Returns the defaultTypeMapping used by the service
return (TypeMapping) tmr.getDefaultTypeMapping();
|
public java.lang.String | getDescription()Returns the service description
return description;
|
public java.util.Vector | getDisallowedMethods()Return list of methods that should not be exported
return disallowedMethods;
|
public java.lang.Class[] | getExtraClasses()Return the list of extra classes that the emitter will produce WSDL for.
return extraClasses;
|
public java.lang.Class | getImplCls()Returns the implementation Class if set
return implCls;
|
public java.lang.String | getImplNamespace()Returns the implementation namespace
return implNS;
|
public javax.wsdl.Definition | getImplWSDL()Get implementation WSDL Definition for the
current configuration parameters
// Invoke the init() method to ensure configuration is setup
init(MODE_IMPLEMENTATION);
// Create a Definition for the output wsdl
Definition def = createDefinition();
// Write implementation header and import
writeDefinitions(def, implNS);
writeImport(def, intfNS, importUrl);
// Write the implementation WSDL constructs and return Definition
Binding binding = writeBinding(def, false); // Don't add binding to def
writeService(def, binding);
return def;
|
public java.lang.String | getImportUrl()Returns the String representation of the interface import location URL
return importUrl;
|
public java.lang.String | getInputSchema()
return inputSchema;
|
public java.lang.String | getInputWSDL()Get the name of the input WSDL
return inputWSDL;
|
public java.lang.String | getIntfNamespace()Returns the interface namespace
return intfNS;
|
public javax.wsdl.Definition | getIntfWSDL()Get a interface WSDL Definition for the
current configuration parameters
// Invoke the init() method to ensure configuration is setup
init(MODE_INTERFACE);
// Create a definition for the output wsdl
Definition def = createDefinition();
// Write interface header
writeDefinitions(def, intfNS);
// Create Types
types = createTypes(def);
// Write the interface WSDL constructs and return the Definition
Binding binding = writeBinding(def, true);
writePortType(def, binding);
return def;
|
public java.lang.String | getLocationUrl()Returns the String representation of the service endpoint URL
return locationUrl;
|
public int | getMode()getMode (gets the mode based on the style setting)
if (style == Style.RPC) {
return MODE_RPC;
} else if (style == Style.DOCUMENT) {
return MODE_DOCUMENT;
} else if (style == Style.WRAPPED) {
return MODE_DOC_WRAPPED;
}
return -1;
|
public java.util.Map | getNamespaceMap()get the packagename to namespace map
return namespaces;
|
public java.lang.String | getPortTypeName()Returns the String representation of the portType name
return portTypeName;
|
public java.util.HashMap | getQName2ClassMap()Return the type qname to java type mapping
return qName2ClassMap;
|
protected javax.xml.namespace.QName | getRequestQName(org.apache.axis.description.OperationDesc oper)Method getRequestQName
qualifyOperation(oper);
QName qname = oper.getElementQName();
if (qname == null) {
qname = new QName(oper.getName());
}
return qname;
|
protected javax.xml.namespace.QName | getResponseQName(org.apache.axis.description.OperationDesc oper)Method getResponseQName
qualifyOperation(oper);
QName qname = oper.getElementQName();
if (qname == null) {
return new QName(oper.getName() + "Response");
}
return new QName(qname.getNamespaceURI(),
qname.getLocalPart() + "Response");
|
public org.apache.axis.description.ServiceDesc | getServiceDesc()Method getServiceDesc
return serviceDesc;
|
public java.lang.String | getServiceElementName()Returns the String representation of the service element name
return serviceElementName;
|
public java.lang.String | getServicePortName()Returns the String representation of the service port name
return servicePortName;
|
public java.lang.String | getSoapAction()Returns the soapAction option value
return soapAction;
|
public java.util.ArrayList | getStopClasses()Return the list of classes which stop inhertance searches
return stopClasses;
|
public org.apache.axis.constants.Style | getStyle()getStyle
return style;
|
public java.lang.String | getTargetService()Returns the target service name
return targetService;
|
public org.apache.axis.encoding.TypeMapping | getTypeMapping()Returns the TypeMapping used by the service
return tm;
|
public org.apache.axis.constants.Use | getUse()getUse
return use;
|
public boolean | getUseInheritedMethods()Indicates if the emitter will search classes for inherited methods
return useInheritedMethods;
|
public java.lang.String | getVersionMessage()Return the version message
return versionMessage;
|
public javax.wsdl.Definition | getWSDL()Get a Full WSDL Definition for the current
configuration parameters
// Invoke the init() method to ensure configuration is setup
init(MODE_ALL);
// Create a Definition for the output wsdl
Definition def = createDefinition();
// Write interface header
writeDefinitions(def, intfNS);
// Create Types
types = createTypes(def);
// Write the WSDL constructs and return full Definition
Binding binding = writeBinding(def, true);
writePortType(def, binding);
writeService(def, binding);
return def;
|
protected void | init(int mode)Invoked prior to building a definition to ensure parms
and data are set up.
// Default use depending on setting of style
if (use == null) {
if (style == Style.RPC) {
use = Use.ENCODED;
} else {
use = Use.LITERAL;
}
}
if (tm == null) {
String encodingStyle = "";
if (use == Use.ENCODED) {
encodingStyle = Constants.URI_SOAP11_ENC;
/** TODO : Set this correctly if we do SOAP 1.2 support here */
}
tm = (TypeMapping)tmr.getTypeMapping(encodingStyle);
}
// Set up a ServiceDesc to use to introspect the Service
if (serviceDesc == null) {
JavaServiceDesc javaServiceDesc = new JavaServiceDesc();
serviceDesc = javaServiceDesc;
javaServiceDesc.setImplClass(cls);
// Set the typeMapping to the one provided.
serviceDesc.setTypeMapping(tm);
javaServiceDesc.setStopClasses(stopClasses);
serviceDesc.setAllowedMethods(allowedMethods);
javaServiceDesc.setDisallowedMethods(disallowedMethods);
serviceDesc.setStyle(style);
serviceDesc.setUse(use);
// If the class passed in is a portType,
// there may be an implClass that is used to
// obtain the method parameter names. In this case,
// a serviceDesc2 is built to get the method parameter names.
if ((implCls != null) && (implCls != cls)
&& (serviceDesc2 == null)) {
serviceDesc2 = new JavaServiceDesc();
serviceDesc2.setImplClass(implCls);
// Set the typeMapping to the one provided.
serviceDesc2.setTypeMapping(tm);
serviceDesc2.setStopClasses(stopClasses);
serviceDesc2.setAllowedMethods(allowedMethods);
serviceDesc2.setDisallowedMethods(disallowedMethods);
serviceDesc2.setStyle(style);
}
}
if (encodingList == null) {
// if cls contains a Class object with the service implementation use the Name of the
// class else use the service name
if (cls != null) {
clsName = cls.getName();
clsName = clsName.substring(clsName.lastIndexOf('.") + 1);
} else {
clsName = getServiceDesc().getName();
}
// Default the portType name
if (getPortTypeName() == null) {
setPortTypeName(clsName);
}
// Default the serviceElementName
if (getServiceElementName() == null) {
setServiceElementName(getPortTypeName() + "Service");
}
// If service port name is null, construct it from location or className
if (getServicePortName() == null) {
String name = getLocationUrl();
if (name != null) {
if (name.lastIndexOf('/") > 0) {
name = name.substring(name.lastIndexOf('/") + 1);
} else if (name.lastIndexOf('\\") > 0) {
name = name.substring(name.lastIndexOf('\\") + 1);
} else {
name = null;
}
// if we got the name from the location, strip .jws from it
if ((name != null) && name.endsWith(".jws")) {
name = name.substring(0, (name.length()
- ".jws".length()));
}
}
if ((name == null) || name.equals("")) {
name = clsName;
}
setServicePortName(name);
}
// Default the bindingName
if (getBindingName() == null) {
setBindingName(getServicePortName() + "SoapBinding");
}
encodingList = new ArrayList();
encodingList.add(Constants.URI_DEFAULT_SOAP_ENC);
if (intfNS == null) {
Package pkg = cls.getPackage();
intfNS = namespaces.getCreate((pkg == null)
? null
: pkg.getName());
}
// Default the implementation namespace to the interface
// namespace if not split wsdl mode.
if (implNS == null) {
if (mode == MODE_ALL) {
implNS = intfNS;
} else {
implNS = intfNS + "-impl";
}
}
// set the namespaces in the serviceDesc(s)
serviceDesc.setDefaultNamespace(intfNS);
if (serviceDesc2 != null) {
serviceDesc2.setDefaultNamespace(implNS);
}
if (cls != null) {
String clsName = cls.getName();
int idx = clsName.lastIndexOf(".");
if (idx > 0) {
String pkgName = clsName.substring(0, idx);
namespaces.put(pkgName, intfNS, "intf");
}
}
namespaces.putPrefix(implNS, "impl");
}
|
protected void | prettyDocumentToFile(org.w3c.dom.Document doc, java.lang.String filename)Write a prettified document to a file.
FileOutputStream fos = new FileOutputStream(new File(filename));
XMLUtils.PrettyDocumentToStream(doc, fos);
fos.close();
|
private void | qualifyOperation(org.apache.axis.description.OperationDesc oper)Method qualifyOperation
if ((style == Style.WRAPPED) && (use == Use.LITERAL)) {
QName qname = oper.getElementQName();
if (qname == null) {
qname = new QName(intfNS, oper.getName());
} else if (qname.getNamespaceURI().equals("")) {
qname = new QName(intfNS, qname.getLocalPart());
}
oper.setElementQName(qname);
}
|
public void | setAllowedMethods(java.lang.String text)Add a list of methods to export
if (text != null) {
StringTokenizer tokenizer = new StringTokenizer(text, " ,+");
if (allowedMethods == null) {
allowedMethods = new Vector();
}
while (tokenizer.hasMoreTokens()) {
allowedMethods.add(tokenizer.nextToken());
}
}
|
public void | setAllowedMethods(java.util.Vector allowedMethods)Add a Vector of methods to export
if (this.allowedMethods == null) {
this.allowedMethods = new Vector();
}
this.allowedMethods.addAll(allowedMethods);
|
public void | setBindingName(java.lang.String bindingName)Set the String representation of the binding name
this.bindingName = bindingName;
|
public void | setCls(java.lang.Class cls)Sets the Class to export
this.cls = cls;
|
public void | setCls(java.lang.String className)Sets the Class to export
cls = ClassUtils.forName(className);
|
public void | setClsSmart(java.lang.Class cls, java.lang.String location)Sets the Class to export.
if ((cls == null) || (location == null)) {
return;
}
// Strip off \ and / from location
if (location.lastIndexOf('/") > 0) {
location = location.substring(location.lastIndexOf('/") + 1);
} else if (location.lastIndexOf('\\") > 0) {
location = location.substring(location.lastIndexOf('\\") + 1);
}
// Get the constructors of the class
java.lang.reflect.Constructor[] constructors =
cls.getDeclaredConstructors();
Class intf = null;
for (int i = 0; (i < constructors.length) && (intf == null); i++) {
Class[] parms = constructors[i].getParameterTypes();
// If the constructor has a single parameter
// that is an interface which
// matches the location, then use this as the interface class.
if ((parms.length == 1) && parms[0].isInterface()
&& (parms[0].getName() != null)
&& Types.getLocalNameFromFullName(
parms[0].getName()).equals(location)) {
intf = parms[0];
}
}
if (intf != null) {
setCls(intf);
if (implCls == null) {
setImplCls(cls);
}
} else {
setCls(cls);
}
|
public void | setDefaultTypeMapping(org.apache.axis.encoding.TypeMapping tm)Sets the defaultTypeMapping used by the service
tmr.registerDefault(tm);
|
public void | setDescription(java.lang.String description)Set the service description
this.description = description;
|
public void | setDisallowedMethods(java.util.Vector disallowedMethods)Add a list of methods NOT to export
if (this.disallowedMethods == null) {
this.disallowedMethods = new Vector();
}
this.disallowedMethods.addAll(disallowedMethods);
|
public void | setDisallowedMethods(java.lang.String text)Add a list of methods NOT to export
if (text != null) {
StringTokenizer tokenizer = new StringTokenizer(text, " ,+");
if (disallowedMethods == null) {
disallowedMethods = new Vector();
}
disallowedMethods = new Vector();
while (tokenizer.hasMoreTokens()) {
disallowedMethods.add(tokenizer.nextToken());
}
}
|
public void | setEmitAllTypes(boolean emitAllTypes)
this.emitAllTypes = emitAllTypes;
|
public void | setExtraClasses(java.lang.String text)Provide a comma or space seperated list of classes which
the emitter will produce WSDL type definitions for.
The classes will be added to the current list.
ArrayList clsList = new ArrayList();
if (text != null) {
StringTokenizer tokenizer = new StringTokenizer(text, " ,");
while (tokenizer.hasMoreTokens()) {
String clsName = tokenizer.nextToken();
// Let the caller handler ClassNotFoundException
Class cls = ClassUtils.forName(clsName);
clsList.add(cls);
}
}
// Allocate the new array
Class[] ec;
int startOffset = 0;
if (extraClasses != null) {
ec = new Class[clsList.size() + extraClasses.length];
// copy existing elements
for (int i = 0; i < extraClasses.length; i++) {
Class c = extraClasses[i];
ec[i] = c;
}
startOffset = extraClasses.length;
} else {
ec = new Class[clsList.size()];
}
// copy the new classes
for (int i = 0; i < clsList.size(); i++) {
Class c = (Class) clsList.get(i);
ec[startOffset + i] = c;
}
// set the member variable
this.extraClasses = ec;
|
public void | setExtraClasses(java.lang.Class[] extraClasses)Provide a list of classes which the emitter will produce WSDL
type definitions for.
this.extraClasses = extraClasses;
|
public void | setImplCls(java.lang.Class implCls)Sets the implementation Class
this.implCls = implCls;
|
public void | setImplCls(java.lang.String className)Sets the implementation Class
try {
implCls = ClassUtils.forName(className);
} catch (Exception ex) {
ex.printStackTrace();
}
|
public void | setImplNamespace(java.lang.String ns)Set the implementation namespace
this.implNS = ns;
|
public void | setImportUrl(java.lang.String importUrl)Set the String representation of the interface location URL
for importing
this.importUrl = importUrl;
|
public void | setInputSchema(java.lang.String inputSchema)Set the name of the input schema
this.inputSchema = inputSchema;
|
public void | setInputWSDL(java.lang.String inputWSDL)Set the name of the input WSDL
this.inputWSDL = inputWSDL;
|
public void | setIntfNamespace(java.lang.String ns)Set the interface namespace
this.intfNS = ns;
|
public void | setLocationUrl(java.lang.String locationUrl)Set the String representation of the service endpoint URL
this.locationUrl = locationUrl;
|
public void | setMode(int mode)setMode (sets style and use)
if (mode == MODE_RPC) {
setStyle(Style.RPC);
setUse(Use.ENCODED);
} else if (mode == MODE_DOCUMENT) {
setStyle(Style.DOCUMENT);
setUse(Use.LITERAL);
} else if (mode == MODE_DOC_WRAPPED) {
setStyle(Style.WRAPPED);
setUse(Use.LITERAL);
}
|
public void | setNamespaceMap(java.util.Map map)Set the packagename to namespace map with the given map
if (map != null) {
namespaces.putAll(map);
}
|
public void | setPortTypeName(java.lang.String portTypeName)Set the String representation of the portType name
this.portTypeName = portTypeName;
|
public void | setServiceDesc(org.apache.axis.description.ServiceDesc serviceDesc)Method setServiceDesc
this.serviceDesc = serviceDesc;
|
public void | setServiceElementName(java.lang.String serviceElementName)Set the String representation of the service element name
this.serviceElementName = serviceElementName;
|
public void | setServicePortName(java.lang.String servicePortName)Set the String representation of the service port name
this.servicePortName = servicePortName;
|
public void | setSoapAction(java.lang.String value)Sets the soapAction option value
soapAction = value;
|
public void | setStopClasses(java.util.ArrayList stopClasses)Adds a list of classes (fully qualified) that will stop the traversal
of the inheritance tree if encounter in method or complex type generation
if (this.stopClasses == null) {
this.stopClasses = new ArrayList();
}
this.stopClasses.addAll(stopClasses);
|
public void | setStopClasses(java.lang.String text)Add a list of classes (fully qualified) that will stop the traversal
of the inheritance tree if encounter in method or complex type generation
if (text != null) {
StringTokenizer tokenizer = new StringTokenizer(text, " ,+");
if (stopClasses == null) {
stopClasses = new ArrayList();
}
while (tokenizer.hasMoreTokens()) {
stopClasses.add(tokenizer.nextToken());
}
}
|
public void | setStyle(java.lang.String value)setStyle
setStyle(Style.getStyle(value));
|
public void | setStyle(org.apache.axis.constants.Style value)setStyle
style = value;
if (style.equals(Style.WRAPPED)) {
setUse(Use.LITERAL);
}
|
public void | setTargetService(java.lang.String targetService)Set the target service name
this.targetService = targetService;
|
public void | setTypeMapping(org.apache.axis.encoding.TypeMapping tm)Sets the TypeMapping used by the service
this.tm = tm;
|
public void | setTypeMappingRegistry(org.apache.axis.encoding.TypeMappingRegistry tmr)Set the TypeMappingRegistry for this Emitter.
this.tmr = tmr;
|
public void | setUse(java.lang.String value)setUse
use = Use.getUse(value);
|
public void | setUse(org.apache.axis.constants.Use value)setUse
use = value;
|
public void | setUseInheritedMethods(boolean useInheritedMethods)Turn on or off inherited method WSDL generation.
this.useInheritedMethods = useInheritedMethods;
|
public void | setVersionMessage(java.lang.String versionMessage)Set the version message that appears at the top of the WSDL
If not set, we use the default version message.
If set to an empty string, no version message will be emitted
this.versionMessage = versionMessage;
|
protected javax.wsdl.Binding | writeBinding(javax.wsdl.Definition def, boolean add)Create the binding.
QName bindingQName = new QName(intfNS, getBindingName());
// If a binding already exists, don't replace it.
Binding binding = def.getBinding(bindingQName);
if (binding != null) {
return binding;
}
// Create a binding
binding = def.createBinding();
binding.setUndefined(false);
binding.setQName(bindingQName);
SOAPBinding soapBinding = new SOAPBindingImpl();
String styleStr = (style == Style.RPC)
? "rpc"
: "document";
soapBinding.setStyle(styleStr);
soapBinding.setTransportURI(Constants.URI_SOAP11_HTTP);
binding.addExtensibilityElement(soapBinding);
if (add) {
def.addBinding(binding);
}
return binding;
|
protected javax.wsdl.BindingOperation | writeBindingOperation(javax.wsdl.Definition def, javax.wsdl.Binding binding, javax.wsdl.Operation oper, org.apache.axis.description.OperationDesc desc)Create a Binding Operation
BindingOperation bindingOper = def.createBindingOperation();
BindingInput bindingInput = def.createBindingInput();
BindingOutput bindingOutput = null;
// TODO : Make this deal with all MEPs
if (OperationType.REQUEST_RESPONSE.equals(desc.getMep()))
bindingOutput = def.createBindingOutput();
bindingOper.setName(oper.getName());
bindingOper.setOperation(oper);
SOAPOperation soapOper = new SOAPOperationImpl();
// If the soapAction option is OPERATION, force
// soapAction to the name of the operation. If NONE,
// force soapAction to "".
// Otherwise use the information in the operationDesc.
String soapAction;
if (getSoapAction().equalsIgnoreCase("OPERATION")) {
soapAction = oper.getName();
} else if (getSoapAction().equalsIgnoreCase("NONE")) {
soapAction = "";
} else {
soapAction = desc.getSoapAction();
if (soapAction == null) {
soapAction = "";
}
}
soapOper.setSoapActionURI(soapAction);
// Until we have per-operation configuration, this will always be
// the same as the binding default.
// soapOper.setStyle("rpc");
bindingOper.addExtensibilityElement(soapOper);
// Add soap:body element to the binding <input> element
ExtensibilityElement inputBody = writeSOAPBody(desc.getElementQName());
bindingInput.addExtensibilityElement(inputBody);
// add soap:headers, if any, to binding <input> element
// only when we write the Message and parts.
// Add soap:body element to the binding <output> element
if (bindingOutput != null) {
ExtensibilityElement outputBody = writeSOAPBody(desc.getReturnQName());
bindingOutput.addExtensibilityElement(outputBody);
bindingOper.setBindingOutput(bindingOutput);
// add soap:headers, if any, to binding <output> element
// only when we write the Message and parts.
}
// Add input to operation
bindingOper.setBindingInput(bindingInput);
// Faults clause
// Comment out the following part
// because it actually does the same thing as in writeMessages.
/*
ArrayList faultList = desc.getFaults();
if (faultList != null) {
for (Iterator it = faultList.iterator(); it.hasNext();) {
FaultDesc faultDesc = (FaultDesc) it.next();
// Get a soap:fault
ExtensibilityElement soapFault = writeSOAPFault(faultDesc);
// Get a wsdl:fault to put the soap:fault in
BindingFault bindingFault = new BindingFaultImpl();
bindingFault.setName(faultDesc.getName());
bindingFault.addExtensibilityElement(soapFault);
bindingOper.addBindingFault(bindingFault);
}
}
*/
binding.addBindingOperation(bindingOper);
return bindingOper;
|
protected void | writeDefinitions(javax.wsdl.Definition def, java.lang.String tns)Create the definition header information.
def.setTargetNamespace(tns);
def.addNamespace("intf", intfNS);
def.addNamespace("impl", implNS);
def.addNamespace(Constants.NS_PREFIX_WSDL_SOAP,
Constants.URI_WSDL11_SOAP);
namespaces.putPrefix(Constants.URI_WSDL11_SOAP,
Constants.NS_PREFIX_WSDL_SOAP);
def.addNamespace(Constants.NS_PREFIX_WSDL, Constants.NS_URI_WSDL11);
namespaces.putPrefix(Constants.NS_URI_WSDL11, Constants.NS_PREFIX_WSDL);
if (use == Use.ENCODED) {
def.addNamespace(Constants.NS_PREFIX_SOAP_ENC,
Constants.URI_DEFAULT_SOAP_ENC);
namespaces.putPrefix(Constants.URI_DEFAULT_SOAP_ENC,
Constants.NS_PREFIX_SOAP_ENC);
}
def.addNamespace(Constants.NS_PREFIX_SCHEMA_XSD,
Constants.URI_DEFAULT_SCHEMA_XSD);
namespaces.putPrefix(Constants.URI_DEFAULT_SCHEMA_XSD,
Constants.NS_PREFIX_SCHEMA_XSD);
def.addNamespace(Constants.NS_PREFIX_XMLSOAP, Constants.NS_URI_XMLSOAP);
namespaces.putPrefix(Constants.NS_URI_XMLSOAP,
Constants.NS_PREFIX_XMLSOAP);
|
protected javax.wsdl.Message | writeFaultMessage(javax.wsdl.Definition def, org.apache.axis.description.FaultDesc exception)Create a Fault Message
String pkgAndClsName = exception.getClassName();
String clsName =
pkgAndClsName.substring(pkgAndClsName.lastIndexOf('.") + 1,
pkgAndClsName.length());
// Do this to cover the complex type case with no meta data
exception.setName(clsName);
// The following code uses the class name for both the name= attribute
// and the message= attribute.
Message msg = (Message) exceptionMsg.get(pkgAndClsName);
if (msg == null) {
msg = def.createMessage();
QName qName = createMessageName(def, clsName);
msg.setQName(qName);
msg.setUndefined(false);
ArrayList parameters = exception.getParameters();
if (parameters != null) {
for (int i = 0; i < parameters.size(); i++) {
ParameterDesc parameter = (ParameterDesc) parameters.get(i);
writePartToMessage(def, msg, true, parameter);
}
}
exceptionMsg.put(pkgAndClsName, msg);
}
return msg;
|
private boolean | writeHeaderParts(javax.wsdl.Definition def, java.util.ArrayList parameters, javax.wsdl.BindingOperation bindop, javax.wsdl.Message msg, boolean request)Create parts of a Message for header parameters and write then in
to the provided Message element. Also create a soap:header element
in the binding
boolean wroteHeaderParts = false;
String partName;
// Loop over all the parameters for this operation
for (int i = 0; i < parameters.size(); i++) {
ParameterDesc parameter = (ParameterDesc) parameters.get(i);
// write the input or output header parts in to the Message
if (request && parameter.isInHeader()) {
// put part in message
partName = writePartToMessage(def, msg, request, parameter);
// Create a soap:header element
SOAPHeader hdr = writeSOAPHeader(parameter, msg.getQName(), partName);
// put it in the binding <input> element
bindop.getBindingInput().addExtensibilityElement(hdr);
wroteHeaderParts = true;
}
else if (!request && parameter.isOutHeader()) {
// put part in message
partName = writePartToMessage(def, msg, request, parameter);
// Create a soap:header element
SOAPHeader hdr = writeSOAPHeader(parameter, msg.getQName(), partName);
// put it in the binding <output> element
bindop.getBindingOutput().addExtensibilityElement(hdr);
wroteHeaderParts = true;
}
else {
continue; // body part
}
}
return wroteHeaderParts;
|
protected void | writeImport(javax.wsdl.Definition def, java.lang.String tns, java.lang.String loc)Create and add an import
Import imp = def.createImport();
imp.setNamespaceURI(tns);
if ((loc != null) && !loc.equals("")) {
imp.setLocationURI(loc);
}
def.addImport(imp);
|
protected void | writeMessages(javax.wsdl.Definition def, javax.wsdl.Operation oper, org.apache.axis.description.OperationDesc desc, javax.wsdl.BindingOperation bindingOper)Create a Message
Input input = def.createInput();
Message msg = writeRequestMessage(def, desc, bindingOper);
input.setMessage(msg);
// Give the input element a name that matches the
// message. This is necessary for overloading.
// The msg QName is unique.
String name = msg.getQName().getLocalPart();
input.setName(name);
bindingOper.getBindingInput().setName(name);
oper.setInput(input);
def.addMessage(msg);
if (OperationType.REQUEST_RESPONSE.equals(desc.getMep())) {
msg = writeResponseMessage(def, desc, bindingOper);
Output output = def.createOutput();
output.setMessage(msg);
// Give the output element a name that matches the
// message. This is necessary for overloading.
// The message QName is unique.
name = msg.getQName().getLocalPart();
output.setName(name);
bindingOper.getBindingOutput().setName(name);
oper.setOutput(output);
def.addMessage(msg);
}
ArrayList exceptions = desc.getFaults();
for (int i = 0; (exceptions != null) && (i < exceptions.size()); i++) {
FaultDesc faultDesc = (FaultDesc) exceptions.get(i);
msg = writeFaultMessage(def, faultDesc);
// Add the fault to the portType
Fault fault = def.createFault();
fault.setMessage(msg);
fault.setName(faultDesc.getName());
oper.addFault(fault);
// Add the fault to the binding
BindingFault bFault = def.createBindingFault();
bFault.setName(faultDesc.getName());
SOAPFault soapFault = writeSOAPFault(faultDesc);
bFault.addExtensibilityElement(soapFault);
bindingOper.addBindingFault(bFault);
// Add the fault message
if (def.getMessage(msg.getQName()) == null) {
def.addMessage(msg);
}
}
// Set the parameter ordering using the parameter names
ArrayList parameters = desc.getParameters();
Vector names = new Vector();
for (int i = 0; i < parameters.size(); i++) {
ParameterDesc param = (ParameterDesc) parameters.get(i);
names.add(param.getName());
}
if (names.size() > 0) {
if (style == Style.WRAPPED) {
names.clear();
} else {
oper.setParameterOrdering(names);
}
}
|
protected javax.wsdl.BindingOperation | writeOperation(javax.wsdl.Definition def, javax.wsdl.Binding binding, org.apache.axis.description.OperationDesc desc)Create a Operation
Operation oper = def.createOperation();
QName elementQName = desc.getElementQName();
if(elementQName != null && elementQName.getLocalPart() != null) {
oper.setName(elementQName.getLocalPart());
} else {
oper.setName(desc.getName());
}
oper.setUndefined(false);
return writeBindingOperation(def, binding, oper, desc);
|
public java.lang.String | writePartToMessage(javax.wsdl.Definition def, javax.wsdl.Message msg, boolean request, org.apache.axis.description.ParameterDesc param)Create a Part
// Return if this is a void type
if ((param == null) || (param.getJavaType() == java.lang.Void.TYPE)) {
return null;
}
// If Request message, only continue if IN or INOUT
// If Response message, only continue if OUT or INOUT
if (request && (param.getMode() == ParameterDesc.OUT)) {
return null;
}
if (!request && (param.getMode() == ParameterDesc.IN)) {
return null;
}
// Create the Part
Part part = def.createPart();
if (param.getDocumentation() != null) {
part.setDocumentationElement(
createDocumentationElement(
param.getDocumentation()));
}
// Get the java type to represent in the wsdl
// (if the mode is OUT or INOUT and this
// parameter does not represent the return type,
// the type held in the Holder is the one that should
// be written.)
Class javaType = param.getJavaType();
if ((param.getMode() != ParameterDesc.IN)
&& (param.getIsReturn() == false)) {
javaType = JavaUtils.getHolderValueType(javaType);
}
if ((use == Use.ENCODED) || (style == Style.RPC)) {
// Add the type representing the param
// Write <part name=param_name type=param_type>
QName typeQName = param.getTypeQName();
if (javaType != null) {
typeQName = types.writeTypeAndSubTypeForPart(javaType, typeQName);
}
// types.writeElementForPart(javaType, param.getTypeQName());
if (typeQName != null) {
part.setName(param.getName());
part.setTypeName(typeQName);
msg.addPart(part);
}
} else if (use == Use.LITERAL) {
// This is doc/lit. So we should write out an element
// declaration whose name and type may be found in the
// ParameterDesc.
QName qname = param.getQName();
if (param.getTypeQName() == null) {
log.warn(Messages.getMessage("registerTypeMappingFor01",
param.getJavaType().getName()));
QName qName = types.writeTypeForPart(param.getJavaType(),null);
if (qName != null) {
param.setTypeQName(qName);
} else {
param.setTypeQName(Constants.XSD_ANYTYPE);
}
}
if (param.getTypeQName().getNamespaceURI().equals("")) {
param.setTypeQName(
new QName(intfNS, param.getTypeQName().getLocalPart()));
}
if (param.getQName().getNamespaceURI().equals("")) {
qname = new QName(intfNS, param.getQName().getLocalPart());
param.setQName(qname);
}
// Make sure qname's value is unique.
ArrayList names = (ArrayList)
usedElementNames.get(qname.getNamespaceURI());
if (names == null) {
names = new ArrayList(1);
usedElementNames.put(qname.getNamespaceURI(), names);
}
else if (names.contains(qname.getLocalPart())) {
qname = new QName(qname.getNamespaceURI(),
JavaUtils.getUniqueValue(names, qname.getLocalPart()));
}
names.add(qname.getLocalPart());
types.writeElementDecl(qname,
param.getJavaType(),
param.getTypeQName(),
false,
param.getItemQName());
part.setName(param.getName());
part.setElementName(qname);
msg.addPart(part);
}
// return the name of the parameter added
return param.getName();
|
protected void | writePortType(javax.wsdl.Definition def, javax.wsdl.Binding binding)Create a PortType
QName portTypeQName = new QName(intfNS, getPortTypeName());
// Get or create a portType
PortType portType = def.getPortType(portTypeQName);
boolean newPortType = false;
if (portType == null) {
portType = def.createPortType();
portType.setUndefined(false);
portType.setQName(portTypeQName);
newPortType = true;
} else if (binding.getBindingOperations().size() > 0) {
// If both portType and binding already exist,
// no additional processing is needed.
return;
}
// Add the port and binding operations.
ArrayList operations = serviceDesc.getOperations();
for (Iterator i = operations.iterator(); i.hasNext();) {
OperationDesc thisOper = (OperationDesc) i.next();
BindingOperation bindingOper = writeOperation(def, binding,
thisOper);
Operation oper = bindingOper.getOperation();
OperationDesc messageOper = thisOper;
// add the documentation to oper
if (messageOper.getDocumentation() != null) {
oper.setDocumentationElement(
createDocumentationElement(
messageOper.getDocumentation()));
}
if (serviceDesc2 != null) {
// If a serviceDesc containing an impl class is provided,
// try and locate the corresponding operation
// (same name, same parm types and modes). If a
// corresponding operation is found, it is sent
// to the writeMessages method so that its parameter
// names will be used in the wsdl file.
OperationDesc[] operArray =
serviceDesc2.getOperationsByName(thisOper.getName());
boolean found = false;
if (operArray != null) {
for (int j = 0; (j < operArray.length) && !found; j++) {
OperationDesc tryOper = operArray[j];
if (tryOper.getParameters().size()
== thisOper.getParameters().size()) {
boolean parmsMatch = true;
for (int k =
0; (k < thisOper.getParameters().size())
&& parmsMatch; k++) {
if ((tryOper.getParameter(
k).getMode() != thisOper.getParameter(
k).getMode())
|| (!tryOper.getParameter(
k).getJavaType().equals(
thisOper.getParameter(
k).getJavaType()))) {
parmsMatch = false;
}
}
if (parmsMatch) {
messageOper = tryOper;
found = true;
}
}
}
}
}
writeMessages(def, oper, messageOper, bindingOper);
if (newPortType) {
portType.addOperation(oper);
}
}
if (newPortType) {
def.addPortType(portType);
}
binding.setPortType(portType);
|
protected javax.wsdl.Message | writeRequestMessage(javax.wsdl.Definition def, org.apache.axis.description.OperationDesc oper, javax.wsdl.BindingOperation bindop)Create a Request Message
String partName;
ArrayList bodyParts = new ArrayList();
ArrayList parameters = oper.getAllInParams();
Message msg = def.createMessage();
QName qName = createMessageName(def,
getRequestQName(oper).getLocalPart() + "Request");
msg.setQName(qName);
msg.setUndefined(false);
// output all the parts for headers
boolean headers = writeHeaderParts(def, parameters, bindop, msg, true);
if (oper.getStyle() == Style.MESSAGE) {
// If this is a MESSAGE-style operation, just write out
// <xsd:any> for now.
// TODO: Support custom schema in WSDD for these operations
QName qname = oper.getElementQName();
types.writeElementDecl(qname, Object.class,
Constants.XSD_ANYTYPE, false, null);
Part part = def.createPart();
part.setName("part");
part.setElementName(qname);
msg.addPart(part);
bodyParts.add(part.getName());
} else if (oper.getStyle() == Style.WRAPPED) {
// If we're WRAPPED, write the wrapper element first, and then
// fill in any params. If there aren't any params, we'll see
// an empty <complexType/> for the wrapper element.
partName = writeWrapperPart(def, msg, oper, true);
bodyParts.add(partName);
} else {
//Now we're either DOCUMENT or RPC. If we're doing doc/lit, and in the
//case of mulitple input params, we would warn user saying request
//message's type information is being written out as multiple parts
//than one single complexType and to interop with other soap stacks
//that do doc/lit by default, user might want to publish his service
//as a WRAPPED-LITERAL service instead.
//see http://issues.apache.org/jira/browse/AXIS-2017
if(oper.getStyle() == Style.DOCUMENT && parameters.size()>1 ) {
System.out.println(Messages.getMessage("warnDocLitInteropMultipleInputParts"));
}
// write a part for each non-header parameter
for (int i = 0; i < parameters.size(); i++) {
ParameterDesc parameter = (ParameterDesc) parameters.get(i);
if (!parameter.isInHeader() && !parameter.isOutHeader()) {
partName = writePartToMessage(def, msg, true, parameter);
bodyParts.add(partName);
}
}
}
// If we have headers, we must fill in the parts attribute of soap:body
// if not, we just leave it out (which means all parts)
if (headers) {
// Find soap:body in binding
List extensibilityElements = bindop.getBindingInput().getExtensibilityElements();
for (int i = 0; i < extensibilityElements.size(); i++)
{
Object ele = extensibilityElements.get(i);
if (ele instanceof SOAPBodyImpl)
{
SOAPBodyImpl soapBody = (SOAPBodyImpl) ele;
soapBody.setParts(bodyParts);
}
}
}
return msg;
|
protected javax.wsdl.Message | writeResponseMessage(javax.wsdl.Definition def, org.apache.axis.description.OperationDesc desc, javax.wsdl.BindingOperation bindop)Create a Response Message
String partName;
ArrayList bodyParts = new ArrayList();
ArrayList parameters = desc.getAllOutParams();
Message msg = def.createMessage();
QName qName =
createMessageName(def, getResponseQName(desc).getLocalPart());
msg.setQName(qName);
msg.setUndefined(false);
// output all the parts for headers
boolean headers = writeHeaderParts(def, parameters, bindop, msg, false);
if (desc.getStyle() == Style.WRAPPED) {
partName = writeWrapperPart(def, msg, desc, false);
bodyParts.add(partName);
} else {
// Write the return value part
ParameterDesc retParam = new ParameterDesc();
if (desc.getReturnQName() == null) {
String ns = "";
if (desc.getStyle() != Style.RPC) {
ns = getServiceDesc().getDefaultNamespace();
if ((ns == null) || "".equals(ns)) {
ns = "http://ws.apache.org/axis/defaultNS";
}
}
retParam.setQName(new QName(ns, desc.getName() + "Return"));
} else {
retParam.setQName(desc.getReturnQName());
}
retParam.setTypeQName(desc.getReturnType());
retParam.setMode(ParameterDesc.OUT);
retParam.setIsReturn(true);
retParam.setJavaType(desc.getReturnClass());
String returnPartName = writePartToMessage(def, msg, false, retParam);
bodyParts.add(returnPartName);
// write a part for each non-header parameter
for (int i = 0; i < parameters.size(); i++) {
ParameterDesc parameter = (ParameterDesc) parameters.get(i);
if (!parameter.isInHeader() && !parameter.isOutHeader()) {
partName = writePartToMessage(def, msg, false, parameter);
bodyParts.add(partName);
}
}
}
// If we have headers, we must fill in the parts attribute of soap:body
// if not, we just leave it out (which means all parts)
if (headers) {
// Find soap:body in binding
List extensibilityElements = bindop.getBindingOutput().getExtensibilityElements();
for (int i = 0; i < extensibilityElements.size(); i++)
{
Object ele = extensibilityElements.get(i);
if (ele instanceof SOAPBodyImpl)
{
SOAPBodyImpl soapBody = (SOAPBodyImpl) ele;
soapBody.setParts(bodyParts);
}
}
}
return msg;
|
protected javax.wsdl.extensions.ExtensibilityElement | writeSOAPBody(javax.xml.namespace.QName operQName)Method writeSOAPBody
SOAPBody soapBody = new SOAPBodyImpl();
// for now, if its document, it is literal use.
if (use == Use.ENCODED) {
soapBody.setUse("encoded");
soapBody.setEncodingStyles(encodingList);
} else {
soapBody.setUse("literal");
}
if (style == Style.RPC) {
if (targetService == null) {
soapBody.setNamespaceURI(intfNS);
} else {
soapBody.setNamespaceURI(targetService);
}
if ((operQName != null) && !operQName.getNamespaceURI().equals("")) {
soapBody.setNamespaceURI(operQName.getNamespaceURI());
}
}
// The parts attribute will get set if we have headers.
// This gets done when the Message & parts are generated
// soapBody.setParts(...);
return soapBody;
|
protected javax.wsdl.extensions.soap.SOAPFault | writeSOAPFault(org.apache.axis.description.FaultDesc faultDesc)Method writeSOAPFault
SOAPFault soapFault = new com.ibm.wsdl.extensions.soap.SOAPFaultImpl();
soapFault.setName(faultDesc.getName());
if (use != Use.ENCODED) {
soapFault.setUse("literal");
// no namespace for literal, gets it from the element
} else {
soapFault.setUse("encoded");
soapFault.setEncodingStyles(encodingList);
// Set the namespace from the fault QName if it exists
// otherwise use the target (or interface) namespace
QName faultQName = faultDesc.getQName();
if ((faultQName != null)
&& !faultQName.getNamespaceURI().equals("")) {
soapFault.setNamespaceURI(faultQName.getNamespaceURI());
} else {
if (targetService == null) {
soapFault.setNamespaceURI(intfNS);
} else {
soapFault.setNamespaceURI(targetService);
}
}
}
return soapFault;
|
protected javax.wsdl.extensions.soap.SOAPHeader | writeSOAPHeader(org.apache.axis.description.ParameterDesc p, javax.xml.namespace.QName messageQName, java.lang.String partName)Create a SOAPHeader element
SOAPHeaderImpl soapHeader = new SOAPHeaderImpl();
// for now, if its document, it is literal use.
if (use == Use.ENCODED) {
soapHeader.setUse("encoded");
soapHeader.setEncodingStyles(encodingList);
} else {
soapHeader.setUse("literal");
}
// Set namespace
if (targetService == null) {
soapHeader.setNamespaceURI(intfNS);
} else {
soapHeader.setNamespaceURI(targetService);
}
QName headerQName = p.getQName();
if ((headerQName != null) && !headerQName.getNamespaceURI().equals("")) {
soapHeader.setNamespaceURI(headerQName.getNamespaceURI());
}
// Set the Message and Part information
soapHeader.setMessage(messageQName);
soapHeader.setPart(partName);
return soapHeader;
|
protected void | writeService(javax.wsdl.Definition def, javax.wsdl.Binding binding)Create the service.
QName serviceElementQName = new QName(implNS, getServiceElementName());
// Locate an existing service, or get a new service
Service service = def.getService(serviceElementQName);
if (service == null) {
service = def.createService();
service.setQName(serviceElementQName);
def.addService(service);
}
if (description != null) {
service.setDocumentationElement(
createDocumentationElement(description));
} else if (serviceDesc.getDocumentation() != null) {
service.setDocumentationElement(
createDocumentationElement(
serviceDesc.getDocumentation()));
}
// Add the port
Port port = def.createPort();
port.setBinding(binding);
// Probably should use the end of the location Url
port.setName(getServicePortName());
SOAPAddress addr = new SOAPAddressImpl();
addr.setLocationURI(locationUrl);
port.addExtensibilityElement(addr);
service.addPort(port);
|
public java.lang.String | writeWrapperPart(javax.wsdl.Definition def, javax.wsdl.Message msg, org.apache.axis.description.OperationDesc oper, boolean request)Write out the schema definition for a WRAPPED operation request or
response.
QName qname = request
? getRequestQName(oper)
: getResponseQName(oper);
boolean hasParams;
if (request) {
hasParams = (oper.getNumInParams() > 0);
} else {
if (oper.getReturnClass() != void.class) {
hasParams = true;
} else {
hasParams = (oper.getNumOutParams() > 0);
}
}
// First write the wrapper element itself.
Element sequence = types.writeWrapperElement(qname, request, hasParams);
// If we got anything back above, there must be parameters in the
// operation, and it's a <sequence> node in which to write them...
if (sequence != null) {
ArrayList parameters = request
? oper.getAllInParams()
: oper.getAllOutParams();
if (!request) {
String retName;
if (oper.getReturnQName() == null) {
retName = oper.getName() + "Return";
} else {
retName = oper.getReturnQName().getLocalPart();
}
types.writeWrappedParameter(sequence, retName,
oper.getReturnType(),
oper.getReturnClass());
}
for (int i = 0; i < parameters.size(); i++) {
ParameterDesc parameter = (ParameterDesc) parameters.get(i);
// avoid headers
if (!parameter.isInHeader() && !parameter.isOutHeader())
{
types.writeWrappedParameter(sequence,
parameter.getName(),
parameter.getTypeQName(),
parameter.getJavaType());
}
}
}
// Finally write the part itself
Part part = def.createPart();
part.setName("parameters"); // We always use "parameters"
part.setElementName(qname);
msg.addPart(part);
return part.getName();
|