in axis-rt-core/src/main/java/org/apache/axis/wsdl/fromJava/Emitter.java [561:710]
protected void init(int mode) {
// 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");
}
}