You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/09/14 15:40:29 UTC
svn commit: r443351 [3/4] - in /webservices/axis2/trunk/java/modules:
adb-codegen/src/org/apache/axis2/schema/template/
adb-codegen/src/org/apache/axis2/schema/writer/
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
codegen/src/org/apache/axis2/wsdl...
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java?view=diff&rev=443351&r1=443350&r2=443351
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/CStructWriter.java Thu Sep 14 06:40:28 2006
@@ -53,6 +53,7 @@
private Map modelMap = new HashMap();
private static final String DEFAULT_PACKAGE = "adb";
+ private static final String DEFAULT_C_CLASS_NAME = "axiom_node_t*";
private Map baseTypeMap = new JavaTypeMap().getTypeMap();
@@ -305,8 +306,9 @@
BeanWriterMetaInfoHolder metainf, ArrayList propertyNames, Map typeMap
) throws SchemaCompilationException {
- Element rootElt = XSLTUtils.getElement(model, "bean");
+ Element rootElt = XSLTUtils.getElement(model, "class");
XSLTUtils.addAttribute(model, "name", className, rootElt);
+ XSLTUtils.addAttribute(model, "caps-name", className.toUpperCase(), rootElt);
XSLTUtils.addAttribute(model, "originalName", originalName, rootElt);
XSLTUtils.addAttribute(model, "nsuri", qName.getNamespaceURI(), rootElt);
XSLTUtils.addAttribute(model, "nsprefix", getPrefixForURI(qName.getNamespaceURI(), qName.getPrefix()), rootElt);
@@ -405,39 +407,39 @@
XSLTUtils.addAttribute(model, "name", xmlName, property);
+
XSLTUtils.addAttribute(model, "nsuri", name.getNamespaceURI(), property);
- String javaName = makeUniqueCStructName(propertyNames, xmlName);
- XSLTUtils.addAttribute(model, "javaname", javaName, property);
+ XSLTUtils.addAttribute(model, "prefix", name.getPrefix(), property);
- String javaClassNameForElement = metainf.getClassNameForQName(name);
+ String CName = xmlName;//makeUniqueCStructName(propertyNames, xmlName);
+ XSLTUtils.addAttribute(model, "cname", CName, property);
- if (javaClassNameForElement == null) {
- throw new SchemaCompilationException(SchemaCompilerMessages.getMessage("schema.typeMissing", name.toString()));
- }
- int arrayBracketIndex = -1;
- arrayBracketIndex = javaClassNameForElement.indexOf('[');
- if ( arrayBracketIndex > 0) {
- javaClassNameForElement = javaClassNameForElement.substring(0, arrayBracketIndex );
+ String CClassNameForElement = metainf.getClassNameForQName(name);
+
+ if (CClassNameForElement == null) {
+ CClassNameForElement = CStructWriter.DEFAULT_C_CLASS_NAME;
}
+ CClassNameForElement= getShortTypeName(CClassNameForElement);
+
- XSLTUtils.addAttribute(model, "type", javaClassNameForElement, property);
+ XSLTUtils.addAttribute(model, "type", CClassNameForElement, property);
/**
* Caps for use in C macros
*/
- XSLTUtils.addAttribute(model, "caps-name", xmlName.toUpperCase(), property);
- XSLTUtils.addAttribute(model, "caps-type", javaClassNameForElement.toUpperCase(), property);
+ XSLTUtils.addAttribute(model, "caps-cname", CName.toUpperCase(), property);
+ XSLTUtils.addAttribute(model, "caps-type", CClassNameForElement.toUpperCase(), property);
- if (PrimitiveTypeFinder.isPrimitive(javaClassNameForElement)){
+ if (PrimitiveTypeFinder.isPrimitive(CClassNameForElement)){
XSLTUtils.addAttribute(model, "primitive", "yes", property);
}
//add an attribute that says the type is default
- if (isDefault(javaClassNameForElement)){
+ if (isDefault(CClassNameForElement)){
XSLTUtils.addAttribute(model, "default", "yes", property);
}
-
+
if (typeMap.containsKey(metainf.getSchemaQNameForQName(name))) {
XSLTUtils.addAttribute(model, "ours", "yes", property);
}
@@ -456,10 +458,10 @@
if (baseTypeMap.containsKey(metainf.getSchemaQNameForQName(name))){
shortTypeName= metainf.getSchemaQNameForQName(name).getLocalPart();
}else{
- shortTypeName = getShortTypeName(javaClassNameForElement);
+ shortTypeName = getShortTypeName(CClassNameForElement);
}
}else{
- shortTypeName = getShortTypeName(javaClassNameForElement);
+ shortTypeName = getShortTypeName(CClassNameForElement);
}
XSLTUtils.addAttribute(model, "shorttypename", shortTypeName, property);
@@ -496,15 +498,15 @@
XSLTUtils.addAttribute(
model,
"arrayBaseType",
- javaClassNameForElement,
+ CClassNameForElement,
property);
long maxOccurs = metainf.getMaxOccurs(name);
if (maxOccurs == Long.MAX_VALUE) {
XSLTUtils.addAttribute(model, "unbound", "yes", property);
- } else {
- XSLTUtils.addAttribute(model, "maxOccurs", maxOccurs + "", property);
}
+ XSLTUtils.addAttribute(model, "maxOccurs", maxOccurs + "", property);
+
}
}
}
@@ -682,8 +684,7 @@
if (typeClassName.endsWith("[]")){
typeClassName = typeClassName.substring(0,typeClassName.lastIndexOf("["));
}
-
- return typeClassName.substring(typeClassName.lastIndexOf(".")+1, typeClassName.length());
+ return typeClassName;
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java?view=diff&rev=443351&r1=443350&r2=443351
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java Thu Sep 14 06:40:28 2006
@@ -19,21 +19,35 @@
import org.apache.axis2.wsdl.codegen.writer.*;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.Utils;
+import org.apache.axis2.util.PolicyUtil;
import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.PolicyInclude;
import org.apache.axis2.description.AxisMessage;
+import org.apache.ws.policy.Policy;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
import java.util.Iterator;
import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
public class CEmitter extends AxisServiceBasedMultiLanguageEmitter {
- protected static final String C_PREFIX ="axis2_";
- protected static final String C_STUB_SUFFIX = "_stub";
+ protected static final String C_STUB_PREFIX = "axis2_stub_";
+ protected static final String C_SKEL_PREFIX = "axis2_skel_";
+ protected static final String C_SVC_SKEL_PREFIX = "axis2_svc_skel_";
+ protected static final String C_STUB_SUFFIX = "";
protected static final String C_SKEL_SUFFIX = "";
- protected static final String C_SVC_SKEL_SUFFIX = "_svc_skeleton";
+ protected static final String C_SVC_SKEL_SUFFIX = "";
+
+ protected static final String JAVA_DEFAULT_TYPE = "org.apache.axiom.om.OMElement";
+ protected static final String C_DEFAULT_TYPE = "axiom_node_t*";
+
+ protected static final String C_OUR_TYPE_PREFIX = "axis2_";
+ protected static final String C_OUR_TYPE_SUFFIX = "_t*";
/**
* Emit the stub
*
@@ -43,9 +57,7 @@
try {
// write interface implementations
- writeCStubSource();
-
- writeCStubHeader();
+ writeCStub();
} catch (Exception e) {
@@ -62,8 +74,7 @@
public void emitSkeleton() throws CodeGenerationException {
try {
// write skeleton
- writeCSkelSource();
- writeCSkelHeader();
+ writeCSkel();
// write a Service Skeleton for this particular service.
writeCServiceSkeleton();
@@ -77,11 +88,11 @@
}
/**
- * Writes the Stub header.
+ * Writes the Stub.
*
* @throws Exception
*/
- protected void writeCStubHeader() throws Exception {
+ protected void writeCStub() throws Exception {
// first check for the policies in this service and write them
Document interfaceImplModel = createDOMDocumentForInterfaceImplementation();
@@ -91,17 +102,7 @@
codeGenConfiguration.getOutputLanguage());
writeClass(interfaceImplModel, writerHStub);
- }
- /**
- * Writes the Stub source.
- *
- * @throws Exception
- */
- protected void writeCStubSource() throws Exception {
-
- // first check for the policies in this service and write them
- Document interfaceImplModel = createDOMDocumentForInterfaceImplementation();
CStubSourceWriter writerCStub =
new CStubSourceWriter(getOutputDirectory(codeGenConfiguration.getOutputLocation(), "src"),
@@ -110,12 +111,14 @@
writeClass(interfaceImplModel, writerCStub);
}
+
+
/**
- * Writes the Skel header.
+ * Writes the Skel.
*
* @throws Exception
*/
- protected void writeCSkelHeader() throws Exception {
+ protected void writeCSkel() throws Exception {
Document skeletonModel = createDOMDocumentForSkeleton(codeGenConfiguration.isServerSideInterface());
@@ -124,22 +127,13 @@
"src"), this.codeGenConfiguration.getOutputLanguage());
writeClass(skeletonModel, skeletonWriter);
- }
-
- /**
- * Writes the Skel source.
- *
- * @throws Exception
- */
- protected void writeCSkelSource() throws Exception {
-
- Document skeletonModel = createDOMDocumentForSkeleton(codeGenConfiguration.isServerSideInterface());
CSkelSourceWriter skeletonWriterStub = new CSkelSourceWriter(getOutputDirectory(this.codeGenConfiguration.getOutputLocation(),
"src"), this.codeGenConfiguration.getOutputLanguage());
writeClass(skeletonModel, skeletonWriterStub);
}
+
/**
* @throws Exception
*/
@@ -175,17 +169,21 @@
*/
protected Document createDOMDocumentForInterfaceImplementation() throws Exception {
- String localPart = makeJavaClassName(axisService.getName());
- String stubName = C_PREFIX + localPart + C_STUB_SUFFIX;
+ String serviceName = axisService.getName();
+ String serviceTns = axisService.getTargetNamespace();
+ String serviceCName = makeCClassName(axisService.getName());
+ String stubName = C_STUB_PREFIX + serviceCName + C_STUB_SUFFIX;
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("class");
addAttribute(doc, "name", stubName, rootElement);
- addAttribute(doc, "servicename", localPart, rootElement);
+ addAttribute( doc,"prefix", stubName, rootElement); //prefix to be used by the functions
+ addAttribute(doc, "qname", serviceName + "|" + serviceTns, rootElement);
+ addAttribute(doc, "servicename", serviceCName, rootElement);
addAttribute(doc, "package", "", rootElement);
- addAttribute(doc, "namespace", axisService.getTargetNamespace(), rootElement);
- addAttribute(doc, "interfaceName", localPart, rootElement);
+ addAttribute(doc, "namespace", serviceTns, rootElement);
+ addAttribute(doc, "interfaceName", serviceCName, rootElement);
/* The following block of code is same as for the
* AxisServiceBasedMultiLanguageEmitter createDOMDocumentForInterfaceImplementation()
@@ -251,12 +249,17 @@
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("interface");
- String localPart = makeJavaClassName(axisService.getName());
- String skelName = C_PREFIX + localPart + C_SKEL_SUFFIX;
+ String serviceCName = makeCClassName(axisService.getName());
+ String skelName = C_SKEL_PREFIX + serviceCName + C_SKEL_SUFFIX;
// only the name is used
addAttribute(doc, "name", skelName , rootElement);
addAttribute(doc, "package", "", rootElement);
+ String serviceName = axisService.getName();
+ String serviceTns = axisService.getTargetNamespace();
+ addAttribute( doc,"prefix", skelName, rootElement); //prefix to be used by the functions
+ addAttribute(doc, "qname", serviceName + "|" + serviceTns, rootElement);
+
fillSyncAttributes(doc, rootElement);
loadOperations(doc, rootElement, null);
@@ -273,13 +276,19 @@
Document doc = getEmptyDocument();
Element rootElement = doc.createElement("interface");
- String localPart = makeJavaClassName(axisService.getName());
- String svcSkelName = C_PREFIX + localPart + C_SVC_SKEL_SUFFIX;
- String skelName = C_PREFIX + localPart + C_SKEL_SUFFIX;
+ String localPart = makeCClassName(axisService.getName());
+ String svcSkelName = C_SVC_SKEL_PREFIX + localPart + C_SVC_SKEL_SUFFIX;
+ String skelName = C_SKEL_PREFIX + localPart + C_SKEL_SUFFIX;
// only the name is used
addAttribute(doc, "name", svcSkelName , rootElement);
+ addAttribute(doc, "prefix", svcSkelName , rootElement); //prefix to be used by the functions
+ String serviceName = axisService.getName();
+ String serviceTns = axisService.getTargetNamespace();
+ addAttribute(doc, "qname", serviceName + "|" + serviceTns, rootElement);
+
addAttribute(doc, "svcname", skelName , rootElement);
+ addAttribute(doc, "svcop_prefix", skelName , rootElement);
addAttribute(doc, "package", "", rootElement);
fillSyncAttributes(doc, rootElement);
@@ -287,7 +296,7 @@
// add SOAP version
addSoapVersion(doc, rootElement);
-
+
//attach a list of faults
rootElement.appendChild(getUniqueListofFaults(doc));
@@ -300,69 +309,307 @@
* @param word
* @return Returns character removed string.
*/
- protected String makeJavaClassName(String word) {
+ protected String makeCClassName(String word) {
//currently avoid only java key words
+
if (JavaUtils.isJavaKeyword(word)) {
return JavaUtils.makeNonJavaKeyword(word);
}
return word;
}
+
/**
+ * Loads the operations
* @param doc
- * @param operation
- * @param param
- */
- protected void addOursAttri (Document doc, AxisOperation operation, Element param ){
+ * @param rootElement
+ * @param mep
+ * @return operations found
+ */
+ protected boolean loadOperations(Document doc, Element rootElement, String mep) {
+ Element methodElement;
+ String portTypeName = makeJavaClassName(axisService.getName());
+
+ Iterator operations = axisService.getOperations();
+ boolean opsFound = false;
+ while (operations.hasNext()) {
+ AxisOperation axisOperation = (AxisOperation) operations.next();
+
+ // populate info holder with mep information. This will used in determining which
+ // message receiver to use, etc.,
+
+ String messageExchangePattern = axisOperation.getMessageExchangePattern();
+ if (infoHolder.get(messageExchangePattern) == null) {
+ infoHolder.put(messageExchangePattern, Boolean.TRUE);
+ }
+
+ if (mep == null) {
+
+ opsFound = true;
+
+ List soapHeaderInputParameterList = new ArrayList();
+ List soapHeaderOutputParameterList = new ArrayList();
+
+ methodElement = doc.createElement("method");
+
+ String localPart = axisOperation.getName().getLocalPart();
+ String opCName = makeCClassName(localPart);
+ String opNS = axisOperation.getName().getNamespaceURI();
+
+ addAttribute(doc, "name", opCName, methodElement);
+ addAttribute(doc, "localpart", localPart, methodElement);
+ addAttribute(doc, "qname", localPart+ "|"+ opNS, methodElement);
+
+ addAttribute(doc, "namespace", opNS, methodElement);
+ String style = axisOperation.getStyle();
+ addAttribute(doc, "style", style, methodElement);
+ addAttribute(doc, "dbsupportname", portTypeName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
+ methodElement);
+
+
+ addAttribute(doc, "mep", Utils.getAxisSpecifMEPConstant(axisOperation.getMessageExchangePattern()) + "", methodElement);
+ addAttribute(doc, "mepURI", axisOperation.getMessageExchangePattern(), methodElement);
+
+
+ addSOAPAction(doc, methodElement, axisOperation);
+ //add header ops for input
+ addHeaderOperations(soapHeaderInputParameterList, axisOperation, true);
+ //add header ops for output
+ addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
+
+ PolicyInclude policyInclude = axisOperation.getPolicyInclude();
+ Policy policy = policyInclude.getPolicy();
+ if (policy != null) {
+ addAttribute(doc, "policy", PolicyUtil.getPolicyAsString(policy), methodElement);
+ }
+
+ methodElement.appendChild(getInputElement(doc, axisOperation, soapHeaderInputParameterList));
+ methodElement.appendChild(getOutputElement(doc, axisOperation, soapHeaderOutputParameterList));
+ methodElement.appendChild(getFaultElement(doc, axisOperation));
+
+ rootElement.appendChild(methodElement);
+ } else {
+ //mep is present - we move ahead only if the given mep matches the mep of this operation
+
+ if (mep.equals(axisOperation.getMessageExchangePattern())) {
+ //at this point we know it's true
+ opsFound = true;
+ List soapHeaderInputParameterList = new ArrayList();
+ List soapHeaderOutputParameterList = new ArrayList();
+ methodElement = doc.createElement("method");
+ String localPart = axisOperation.getName().getLocalPart();
+ String opCName = makeCClassName(localPart);
+ String opNS = axisOperation.getName().getNamespaceURI();
+
+ addAttribute(doc, "name", opCName, methodElement);
+ addAttribute(doc, "localpart", localPart, methodElement);
+ addAttribute(doc, "qname", localPart+ "|"+ opNS, methodElement);
+
+ addAttribute(doc, "namespace", axisOperation.getName().getNamespaceURI(), methodElement);
+ addAttribute(doc, "style", axisOperation.getStyle(), methodElement);
+ addAttribute(doc, "dbsupportname", portTypeName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
+ methodElement);
+
+ addAttribute(doc, "mep", Utils.getAxisSpecifMEPConstant(axisOperation.getMessageExchangePattern()) + "", methodElement);
+ addAttribute(doc, "mepURI", axisOperation.getMessageExchangePattern(), methodElement);
+
+
+ addSOAPAction(doc, methodElement, axisOperation);
+ addHeaderOperations(soapHeaderInputParameterList, axisOperation, true);
+ addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
+
+ /*
+ * Setting the policy of the operation
+ */
+
+ Policy policy = axisOperation.getPolicyInclude().getPolicy();
+ if (policy != null) {
+ addAttribute(doc, "policy",
+ PolicyUtil.getPolicyAsString(policy),
+ methodElement);
+ }
+
+
+ methodElement.appendChild(getInputElement(doc,
+ axisOperation, soapHeaderInputParameterList));
+ methodElement.appendChild(getOutputElement(doc,
+ axisOperation, soapHeaderOutputParameterList));
+ methodElement.appendChild(getFaultElement(doc,
+ axisOperation));
+
+ rootElement.appendChild(methodElement);
+ //////////////////////
+ }
+
+ }
+
+ }
+
+ return opsFound;
+ }
+
+
+ /**
+ * A convenient method for the generating the parameter
+ * element
+ *
+ * @param doc
+ * @param paramName
+ * @param paramType
+ * @param opName
+ * @param paramName
+ */
+ protected Element generateParamComponent(Document doc,
+ String paramName,
+ String paramType,
+ QName opName,
+ String partName,
+ boolean isPrimitive) {
+
+ Element paramElement = doc.createElement("param");
+ //return paramElement;/*
+ addAttribute(doc, "name",
+ paramName, paramElement);
+
+ String typeMappingStr = (paramType == null)
+ ? ""
+ : paramType;
+
+
+ if ( JAVA_DEFAULT_TYPE == typeMappingStr)
+ {
+ typeMappingStr = C_DEFAULT_TYPE;
+ }
+
+ addAttribute(doc, "type", typeMappingStr, paramElement);
+ addAttribute(doc, "caps-type", typeMappingStr.toUpperCase(), paramElement);
- Map typeMap = CTypeInfo.getTypeMap();
- Iterator it= typeMap.keySet().iterator();
- AxisMessage inputMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- QName typeMapping = inputMessage.getElementQName();
+ //adds the short type
+ addShortType(paramElement,paramType);
- String paramType = this.mapper.getTypeMappingName(inputMessage.getElementQName());
- if ( doc ==null || paramType==null || param==null){
- return;
+ // add an extra attribute to say whether the type mapping is the default
+ if (mapper.getDefaultMappingName().equals(paramType)) {
+ addAttribute(doc, "default", "yes", paramElement);
}
- addAttribute(doc, "caps-type", paramType.toUpperCase(), param);
+ addAttribute(doc, "value", getParamInitializer(paramType), paramElement);
+ // add this as a body parameter
+ addAttribute(doc, "location", "body", paramElement);
+ //if the opName and partName are present , add them
+ if (opName!=null){
+ addAttribute(doc,"opname",opName.getLocalPart(),paramElement);
+
+ }
+ if (partName!= null){
+ addAttribute(doc,"partname",
+ JavaUtils.capitalizeFirstChar(partName),
+ paramElement);
+ }
+
+ if (isPrimitive){
+ addAttribute(doc,"primitive","yes",paramElement);
+ }
+
+ // the following methods are moved from addOurs functioin
+ Map typeMap = CTypeInfo.getTypeMap();
+ Iterator it= typeMap.keySet().iterator();
boolean isOurs = true;
while (it.hasNext()){
- if (it.next().equals(typeMapping)){
+ if (it.next().equals(typeMappingStr)){
isOurs = false;
break;
}
}
- if ( isOurs && !paramType.equals("") && !paramType.equals("void") &&
- !paramType.equals("org.apache.axiom.om.OMElement") ){
- addAttribute(doc, "ours", "yes", param);
+ if ( isOurs && !typeMappingStr.equals("") && !typeMappingStr.equals("void") &&
+ !typeMappingStr.equals(C_DEFAULT_TYPE) ){
+ addAttribute(doc, "ours", "yes", paramElement);
+ }
+ else
+ {
+ isOurs = false;
}
- }
- /**
- * @param doc
- * @param operation
- * @return Returns the parameter element.
- */
- protected Element[] getInputParamElement(Document doc, AxisOperation operation) {
- Element[] param = super.getInputParamElement( doc, operation);
- for (int i = 0; i < param.length; i++) {
- addOursAttri ( doc, operation, param[i]);
+ if ( isOurs)
+ {
+ typeMappingStr = C_OUR_TYPE_PREFIX + typeMappingStr + C_OUR_TYPE_SUFFIX;
}
- return param;
- }
+ addAttribute(doc, "axis2-type", typeMappingStr, paramElement);
+ addAttribute(doc, "axis2-caps-type", typeMappingStr.toUpperCase(), paramElement);
+
+ return paramElement; //*/
+ }
/**
* @param doc
* @param operation
* @return Returns Element.
*/
protected Element getOutputParamElement(Document doc, AxisOperation operation) {
- Element param = super.getOutputParamElement( doc, operation);
- addOursAttri ( doc, operation, param);
- return param;
+ Element paramElement = doc.createElement("param");
+ AxisMessage outputMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ String typeMappingStr;
+ String parameterName;
+
+ if (outputMessage != null) {
+ parameterName = this.mapper.getParameterName(outputMessage.getElementQName());
+ String typeMapping = this.mapper.getTypeMappingName(outputMessage.getElementQName());
+ typeMappingStr = (typeMapping == null)
+ ? ""
+ : typeMapping;
+ } else {
+ parameterName = "";
+ typeMappingStr = "";
+ }
+
+ if ( JAVA_DEFAULT_TYPE == typeMappingStr)
+ {
+ typeMappingStr = C_DEFAULT_TYPE;
+ }
+ addAttribute(doc, "name", parameterName, paramElement);
+ addAttribute(doc, "type", typeMappingStr, paramElement);
+ addAttribute(doc, "caps-type", typeMappingStr.toUpperCase(), paramElement);
+
+
+ // the following methods are moved from addOurs functioin
+ Map typeMap = CTypeInfo.getTypeMap();
+ Iterator it= typeMap.keySet().iterator();
+ boolean isOurs = true;
+ while (it.hasNext()){
+ if (it.next().equals(typeMappingStr)){
+ isOurs = false;
+ break;
+ }
+ }
+
+ if ( isOurs && !typeMappingStr.equals("") && !typeMappingStr.equals("void") &&
+ !typeMappingStr.equals(C_DEFAULT_TYPE) ){
+ addAttribute(doc, "ours", "yes", paramElement);
+ }
+ else
+ {
+ isOurs = false;
+ }
+
+ if ( isOurs)
+ {
+ typeMappingStr = C_OUR_TYPE_PREFIX + typeMappingStr + C_OUR_TYPE_SUFFIX;
+ }
+ //adds the short type
+ addShortType(paramElement,typeMappingStr);
+
+
+ // add an extra attribute to say whether the type mapping is the default
+ if (mapper.getDefaultMappingName().equals(typeMappingStr)) {
+ addAttribute(doc, "default", "yes", paramElement);
+ }
+
+ // add this as a body parameter
+ addAttribute(doc, "location", "body", paramElement);
+ addAttribute(doc, "opname", operation.getName().getLocalPart(), paramElement);
+
+ return paramElement;
}
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java?view=diff&rev=443351&r1=443350&r2=443351
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java Thu Sep 14 06:40:28 2006
@@ -59,7 +59,7 @@
//as for the base 64 encoded binary stuff we map it to a javax.
// activation.Datahandler object
CTypeInfo.addTypemapping(XSD_BASE64,
- "axis2_base64_binary_t*");
+ "void*");
CTypeInfo.addTypemapping(XSD_HEXBIN,
"void*");
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl?view=diff&rev=443351&r1=443350&r2=443351
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl Thu Sep 14 06:40:28 2006
@@ -4,18 +4,21 @@
<!--Template for in out message receiver -->
<xsl:template match="/interface">
<xsl:variable name="skeletonname"><xsl:value-of select="@name"/></xsl:variable>
+ <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+ <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+ <xsl:variable name="svcop-prefix"><xsl:value-of select="@svcop_prefix"/></xsl:variable>
<xsl:variable name="svcname"><xsl:value-of select="@svcname"/></xsl:variable>
<xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
/**
- * svc_skel_<xsl:value-of select="$skeletonname"/>.c
+ * <xsl:value-of select="@name"/>.c
*
- * This file was auto-generated from WSDL
+ * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
* by the Apache Axis2 version: #axisVersion# #today#
* <xsl:value-of select="$skeletonname"/>
*/
- #include "<xsl:value-of select="@svcname"/>.h"
+ #include "<xsl:value-of select="$svcop-prefix"/>.h"
#include <axis2_svc_skeleton.h>
#include <axis2_array_list.h>
#include <stdio.h>
@@ -26,36 +29,36 @@
/* On fault, handle the fault */
axiom_node_t* AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_on_fault(axis2_svc_skeleton_t *svc_skeleton,
+ <xsl:value-of select="$method-prefix"/>_on_fault(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env, axiom_node_t *node);
/* Free the service */
int AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_free(axis2_svc_skeleton_t *svc_skeleton,
+ <xsl:value-of select="$method-prefix"/>_free(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env);
/* This method invokes the right service method */
axiom_node_t* AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_invoke(axis2_svc_skeleton_t *svc_skeleton,
+ <xsl:value-of select="$method-prefix"/>_invoke(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env,
axiom_node_t *node,
axis2_msg_ctx_t *msg_ctx);
/* Initializing the environment */
int AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_init(axis2_svc_skeleton_t *svc_skeleton,
+ <xsl:value-of select="$method-prefix"/>_init(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env);
/* Create the service */
axis2_svc_skeleton_t* AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_create(const axis2_env_t *env);
+ <xsl:value-of select="$method-prefix"/>_create(const axis2_env_t *env);
/**
* Implementations for the functions
*/
axis2_svc_skeleton_t* AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_create(const axis2_env_t *env)
+ <xsl:value-of select="$method-prefix"/>_create(const axis2_env_t *env)
{
axis2_svc_skeleton_t *svc_skeleton = NULL;
svc_skeleton = AXIS2_MALLOC(env->allocator,
@@ -67,30 +70,30 @@
svc_skeleton->func_array = NULL;
- svc_skeleton->ops->free = <xsl:value-of select="$skeletonname"/>_free;
- svc_skeleton->ops->init = <xsl:value-of select="$skeletonname"/>_init;
- svc_skeleton->ops->invoke = <xsl:value-of select="$skeletonname"/>_invoke;
- svc_skeleton->ops->on_fault = <xsl:value-of select="$skeletonname"/>_on_fault;
+ svc_skeleton->ops->free = <xsl:value-of select="$method-prefix"/>_free;
+ svc_skeleton->ops->init = <xsl:value-of select="$method-prefix"/>_init;
+ svc_skeleton->ops->invoke = <xsl:value-of select="$method-prefix"/>_invoke;
+ svc_skeleton->ops->on_fault = <xsl:value-of select="$method-prefix"/>_on_fault;
return svc_skeleton;
}
int AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_init(axis2_svc_skeleton_t *svc_skeleton,
+ <xsl:value-of select="$method-prefix"/>_init(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env)
{
- svc_skeleton->func_array = axis2_array_list_create(env, 0);
- <xsl:for-each select="method">
- AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "<xsl:value-of select="@name"/>");
- </xsl:for-each>
+ svc_skeleton->func_array = axis2_array_list_create(env, 10);
+ <xsl:for-each select="method">
+ AXIS2_ARRAY_LIST_ADD(svc_skeleton->func_array, env, "<xsl:value-of select="@localpart"/>");
+ </xsl:for-each>
- /* Any initialization stuff of math goes here */
+ /* Any initialization stuff of <xsl:value-of select="$svcname"/> goes here */
return AXIS2_SUCCESS;
}
int AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_free(axis2_svc_skeleton_t *svc_skeleton,
+ <xsl:value-of select="$method-prefix"/>_free(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env)
{
if(svc_skeleton->func_array)
@@ -118,55 +121,40 @@
* This method invokes the right service method
*/
axiom_node_t* AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_invoke(axis2_svc_skeleton_t *svc_skeleton,
+ <xsl:value-of select="$method-prefix"/>_invoke(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env,
axiom_node_t *content_node,
axis2_msg_ctx_t *msg_ctx)
{
- /* Depending on the function name invoke the
- * corresponding method
+ /* depending on the function name invoke the
+ * corresponding method
*/
- <xsl:for-each select="method">
- <xsl:for-each select="input/param[@location='body']">
- <xsl:variable name="inputours"><xsl:if test="@type!='org.apache.axiom.om.OMElement'"><xsl:value-of select="@ours"></xsl:value-of></xsl:if></xsl:variable>
- <xsl:if test="$inputours and $inputours!=''">
- <xsl:variable name="paramname"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
- <xsl:variable name="paramtype"><xsl:if test="$inputours">axis2_</xsl:if><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">om_node</xsl:when><xsl:otherwise><xsl:value-of select="@type"></xsl:value-of></xsl:otherwise></xsl:choose><xsl:if test="$inputours">_t*</xsl:if></xsl:variable>
- <xsl:value-of select="$paramtype"/><xsl:text> </xsl:text><xsl:value-of select="$paramname"/>;
- </xsl:if>
- </xsl:for-each>
- <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
- <xsl:variable name="outputtype"><xsl:choose><xsl:when test="output/param/@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="output/param/@ours">axis2_</xsl:if><xsl:value-of select="output/param/@type"></xsl:value-of><xsl:if test="output/param/@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
- <xsl:value-of select="$outputtype"/> ret_value<xsl:value-of select="position()"></xsl:value-of> = NULL;
- </xsl:for-each>
+ axiom_element_t *element = NULL;
+ axiom_node_t *ret_node = NULL;
<xsl:for-each select="method">
- <xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
- <xsl:if test="position()=1">
- <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
- <xsl:for-each select="input/param[@location='body']">
- <xsl:variable name="inputours"><xsl:if test="@type!='org.apache.axiom.om.OMElement'"><xsl:value-of select="@ours"></xsl:value-of></xsl:if></xsl:variable>
- <xsl:if test="@type!='org.apache.axiom.om.OMElement' and $inputours!=''">
- axiom_element_t* payload_ele = NULL;
- <xsl:if test="position()=1 and $style='rpc'">
- axiom_namespace_t* ns1 = NULL;
- axiom_attribute_t* attri1 = NULL;
- </xsl:if>
- </xsl:if>
+ <xsl:text>
+ </xsl:text>
+ <xsl:variable name="position"><xsl:value-of select="position()"/></xsl:variable>
+ <xsl:variable name="outputtype">
+ <xsl:choose>
+ <xsl:when test="output/param/@ours">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:value-of select="$outputtype"/> ret_val<xsl:value-of select="$position"/><xsl:if test="output/param/@ours"> = NULL</xsl:if>;
+ <xsl:for-each select="input/param[@type!='']">
+ <xsl:variable name="inputtype">
+ <xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
+ </xsl:variable>
+ <xsl:value-of select="$inputtype"/> input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/><xsl:if test="input/param/@ours"> = NULL</xsl:if>;
</xsl:for-each>
-
- <xsl:if test="output/param/@type!='org.apache.axiom.om.OMElement'">
- axiom_node_t* payload = NULL;
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
-
+ </xsl:for-each>
if (content_node)
{
if (AXIOM_NODE_GET_NODE_TYPE(content_node, env) == AXIOM_ELEMENT)
{
- axiom_element_t *element = NULL;
element = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(content_node, env);
if (element)
{
@@ -174,70 +162,50 @@
if (op_name)
{
<xsl:for-each select="method">
- <xsl:variable name="outputours"><xsl:if test="output/param/@type!='org.apache.axiom.om.OMElement'">yes</xsl:if></xsl:variable>
- <xsl:variable name="outputtype"><xsl:choose><xsl:when test="output/param/@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="output/param/@ours">axis2_</xsl:if><xsl:value-of select="output/param/@type"></xsl:value-of><xsl:if test="output/param/@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
- <xsl:variable name="capsoutputtype"><xsl:if test="$outputours">AXIS2_</xsl:if><xsl:choose><xsl:when test="output/param/@type='org.apache.axiom.om.OMElement'">om_node</xsl:when><xsl:otherwise><xsl:value-of select="output/param/@caps-type"></xsl:value-of>RESPONSE</xsl:otherwise></xsl:choose></xsl:variable>
-
- <xsl:variable name="returnvariable"><xsl:value-of select="output/param/@name"/></xsl:variable>
- <xsl:variable name="namespace"><xsl:value-of select="@namespace"/></xsl:variable>
-
- <xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
- <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
- <xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
- <xsl:variable name="paramcount"><xsl:value-of select="count(input/param[@location='body'])"/></xsl:variable>
- <xsl:variable name="method-name"><xsl:value-of select="@name"/></xsl:variable>
- <xsl:variable name="method-ns"><xsl:value-of select="@namespace"/> </xsl:variable>
-
- if ( AXIS2_STRCMP(op_name, "<xsl:value-of select="@name"/>") == 0 )
- {
-
-
- <xsl:for-each select="input/param[@location='body']">
- <xsl:variable name="inputours"><xsl:if test="@type!='org.apache.axiom.om.OMElement'">yes</xsl:if></xsl:variable>
- <xsl:if test="$inputours and $inputours!=''">
- <xsl:variable name="paramname"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
- <xsl:variable name="paramtype">axis2_<xsl:value-of select="@type"></xsl:value-of></xsl:variable>
- <xsl:variable name="capsparamtype">AXIS2_<xsl:value-of select="@caps-type"></xsl:value-of></xsl:variable>
- <xsl:value-of select="$paramname"/> = <xsl:value-of select="$paramtype"/>_create ( env );
- <xsl:value-of select="$capsparamtype"/>_PARSE_OM ( <xsl:value-of select="$paramname"/>, env, content_node );
- </xsl:if>
-
- </xsl:for-each>
- <xsl:choose>
- <xsl:when test="not($outputtype) or $outputtype=''"></xsl:when>
- <xsl:otherwise>ret_value<xsl:value-of select="position()"></xsl:value-of> = </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="$svcname"/>_<xsl:value-of select="$name"/>(env <xsl:for-each select="input/param[@location='body']"> ,<xsl:variable name="inputours"><xsl:if test="@type!='org.apache.axiom.om.OMElement'">yes</xsl:if></xsl:variable>
- <xsl:choose><xsl:when test="$inputours and $inputours!=''"><xsl:value-of select="@name"/></xsl:when><xsl:otherwise>content_node</xsl:otherwise></xsl:choose>
- </xsl:for-each>);
- if ( NULL == ret_value<xsl:value-of select="position()"/> )
- return NULL;
- <xsl:choose>
- <xsl:when test="not($outputtype) or $outputtype=''">return NULL;</xsl:when>
- <xsl:when test="not($outputours) or $outputours=''">return ret_value<xsl:value-of select="position()"></xsl:value-of>;</xsl:when>
- <xsl:otherwise>
- ns1 =
- axiom_namespace_create (env,
- <xsl:choose><xsl:when test="$soapVersion='1.2'">AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when><xsl:when test="$soapVersion='1.1'">AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI</xsl:when></xsl:choose>,
- "soapenv");
- payload = <xsl:value-of select="$capsoutputtype"/>_BUILD_OM ( ret_value<xsl:value-of select="position()"></xsl:value-of>, env,NULL, NULL, NULL );
- payload_ele = AXIOM_NODE_GET_DATA_ELEMENT(payload, env);
-
- AXIOM_ELEMENT_DECLARE_NAMESPACE (payload_ele, env,
- payload, ns1);
- AXIOM_ELEMENT_SET_NAMESPACE ( payload_ele, env, ns1, payload );
- attri1 =
- axiom_attribute_create (env, "encodingStyle",
- "http://schemas.xmlsoap.org/soap/encoding/",
- ns1);
- AXIOM_ELEMENT_ADD_ATTRIBUTE (payload_ele, env,
- attri1, payload );
-
- return payload;
- </xsl:otherwise>
- </xsl:choose>
- }
- </xsl:for-each>
+ <xsl:variable name="position"><xsl:value-of select="position()"/></xsl:variable>
+ <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
+ <xsl:variable name="method-name"><xsl:value-of select="@name"/></xsl:variable>
+ <xsl:variable name="method-ns"><xsl:value-of select="@namespace"/> </xsl:variable>
+ <xsl:variable name="outputCapsType"><xsl:value-of select="@output/param/@caps-type"/> </xsl:variable>
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"/></xsl:variable>
+
+ if ( AXIS2_STRCMP(op_name, "<xsl:value-of select="@localpart"/>") == 0 )
+ {
+ <xsl:for-each select="input/param[@type!='']">
+ input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/> = <xsl:choose>
+ <xsl:when test="@ours">
+ axis2_<xsl:value-of select="@type"/>_create( env);
+ AXIS2_<xsl:value-of select="@caps-type"/>_BUILD_OM(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env, content_node );
+ </xsl:when>
+ <xsl:otherwise>content_node;</xsl:otherwise>
+ </xsl:choose>
+ ret_val<xsl:value-of select="$position"/> = <xsl:value-of select="$svcop-prefix"/>_<xsl:value-of select="$method-name"/>(env,
+ input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/> );
+ if ( NULL == ret_val<xsl:value-of select="$position"/> )
+ {
+ AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from <xsl:value-of select="$method-name"/> "
+ " %d :: %s", env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(env->error));
+ return <xsl:value-of select="$method-prefix"/>_on_fault( svc_skeleton, env, NULL);
+ }
+ ret_node = <xsl:choose>
+ <xsl:when test="@ours">
+ AXIS2_<xsl:value-of select="@caps-type"/>_PARSE_OM(ret_val<xsl:value-of select="$position"/>, env, NULL );
+ </xsl:when>
+ <xsl:otherwise>ret_val;</xsl:otherwise>
+ </xsl:choose>
+ return ret_node;
+ </xsl:for-each>
+
+ <!-- below was prior to the databinding -->
+ <!-- <xsl:if test="$outputtype!=''">return </xsl:if>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$svcop-prefix"/>_<xsl:value-of select="$method-name"/>(env <xsl:for-each select="input/param[@type!='']"> ,
+ content_node </xsl:for-each>);
+ <xsl:if test="$outputtype=''">return NULL;</xsl:if> -->
+
+ }
+ </xsl:for-each>
}
}
}
@@ -246,18 +214,17 @@
return content_node;
}
- axiom_node_t* AXIS2_CALL
- <xsl:value-of select="$skeletonname"/>_on_fault(axis2_svc_skeleton_t *svc_skeleton,
+ axiom_node_t* AXIS2_CALL
+ <xsl:value-of select="$method-prefix"/>_on_fault(axis2_svc_skeleton_t *svc_skeleton,
const axis2_env_t *env, axiom_node_t *node)
{
- axiom_node_t *error_node = NULL;
- axiom_node_t* text_node = NULL;
- axiom_element_t *error_ele = NULL;
- error_ele = axiom_element_create(env, node, "<xsl:value-of select="$skeletonname"/>Error", NULL,
- &error_node);
- AXIOM_ELEMENT_SET_TEXT(error_ele, env, "<xsl:value-of select="$skeletonname"/>failed",
- text_node);
- return error_node;
+ axiom_node_t *error_node = NULL;
+ axiom_element_t *error_ele = NULL;
+ error_ele = axiom_element_create(env, node, "fault", NULL,
+ &error_node);
+ AXIOM_ELEMENT_SET_TEXT(error_ele, env, "<xsl:value-of select="$qname"/> failed",
+ error_node);
+ return error_node;
}
@@ -269,29 +236,26 @@
axis2_get_instance(struct axis2_svc_skeleton **inst,
const axis2_env_t *env)
{
- *inst = <xsl:value-of select="$skeletonname"/>_create(env);
- /*if(NULL != *inst)
- {
- status = *inst->init();
- }*/
- if(!(*inst))
- {
- return AXIS2_FAILURE;
- }
+ *inst = <xsl:value-of select="$method-prefix"/>_create(env);
- return AXIS2_SUCCESS;
+ if(!(*inst))
+ {
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_SUCCESS;
}
AXIS2_EXTERN int AXIS2_CALL
axis2_remove_instance(axis2_svc_skeleton_t *inst,
const axis2_env_t *env)
{
- axis2_status_t status = AXIS2_FAILURE;
- if (inst)
- {
- status = AXIS2_SVC_SKELETON_FREE(inst, env);
- }
- return status;
+ axis2_status_t status = AXIS2_FAILURE;
+ if (inst)
+ {
+ status = AXIS2_SVC_SKELETON_FREE(inst, env);
+ }
+ return status;
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl?view=diff&rev=443351&r1=443350&r2=443351
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelHeaderTemplate.xsl Thu Sep 14 06:40:28 2006
@@ -2,15 +2,18 @@
<xsl:output method="text"/>
<xsl:template match="/interface">
<xsl:variable name="svc_name"><xsl:value-of select="@name"/></xsl:variable>
+ <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+ <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+
/**
* <xsl:value-of select="@name"/>.h
*
- * This file was auto-generated from WSDL
- * by the Apache Axis2/Java version: #axisVersion# #today#
+ * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+ * by the Apache Axis2/C version: #axisVersion# #today#
* <xsl:value-of select="@name"/> Axis2/C skeleton for the axisService- Header file
*/
-
+
#include <axis2_svc_skeleton.h>
#include <axis2_log_default.h>
#include <axis2_error_default.h>
@@ -21,12 +24,11 @@
<xsl:for-each select="method">
- <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
- <xsl:if test="$outputours and output/param/@type!='' and output/param/@type!='org.apache.axiom.om.OMElement'">
+ <xsl:if test="output/param[@ours and @type!='']">
<xsl:variable name="outputtype">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
#include "<xsl:value-of select="$outputtype"/>.h"
</xsl:if>
- <xsl:for-each select="input/param[@type!='' and @ours and @type!='org.apache.axiom.om.OMElement']">
+ <xsl:for-each select="input/param[@type!='' and @ours]">
<xsl:variable name="inputtype">axis2_<xsl:value-of select="@type"></xsl:value-of></xsl:variable>
#include "<xsl:value-of select="$inputtype"/>.h"
</xsl:for-each>
@@ -34,29 +36,33 @@
<xsl:for-each select="method">
- <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
+ <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
+ <xsl:variable name="outputtype">
+ <xsl:choose>
+ <xsl:when test="output/param/@ours">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:variable name="count"><xsl:value-of select="count(output/param)"/></xsl:variable>
- <xsl:variable name="outputtype"><xsl:choose><xsl:when test="output/param/@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="output/param/@ours">axis2_</xsl:if><xsl:value-of select="output/param/@type"></xsl:value-of><xsl:if test="output/param/@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
<!-- regardless of the sync or async status, the generated method signature would be just a usual
c function-->
/**
- * Auto generated function declaration
+ * auto generated function declaration
+ * for "<xsl:value-of select="@qname"/>" operation.
<!-- select only the body parameters -->
- <xsl:for-each select="input/param[@location='body' and @type!='']">
- <xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
- </xsl:text></xsl:if></xsl:for-each>
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
*/
<xsl:choose>
- <xsl:when test="$count=0">axis2_status_t </xsl:when>
<xsl:when test="$outputtype=''">axis2_status_t </xsl:when>
- <xsl:when test="$outputtype='axis2__t*'">void</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputtype"/>
- </xsl:otherwise>
+ <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
</xsl:choose>
- <xsl:value-of select="$svc_name"/>_<xsl:value-of select="@name"/> (const axis2_env_t* env <xsl:for-each select="input/param[@location='body' and @type!='']"> ,<xsl:variable name="paramtype"><xsl:if test="@ours">axis2_</xsl:if><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:value-of select="@type"></xsl:value-of></xsl:otherwise></xsl:choose><xsl:if test="@ours">_t*</xsl:if></xsl:variable>
- <xsl:value-of select="$paramtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/> (const axis2_env_t *env <xsl:for-each select="input/param[@type!='']"> ,
+ <xsl:variable name="inputtype">
+ <xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
+ </xsl:variable>
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
</xsl:for-each> );
</xsl:for-each>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl?view=diff&rev=443351&r1=443350&r2=443351
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/SkelSourceTemplate.xsl Thu Sep 14 06:40:28 2006
@@ -2,11 +2,14 @@
<xsl:output method="text"/>
<xsl:template match="/interface">
<xsl:variable name="svc_name"><xsl:value-of select="@name"/></xsl:variable>
+ <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+ <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+
/**
- * <xsl:value-of select="@name"/>.c
+ * <xsl:value-of select="@name"/>.c
*
- * This file was auto-generated from WSDL
- * by the Apache Axis2/Java version: #axisVersion# #today#
+ * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+ * by the Apache Axis2/C version: #axisVersion# #today#
* <xsl:value-of select="@name"/> Axis2/C skeleton for the axisService
*/
@@ -15,31 +18,34 @@
<xsl:for-each select="method">
<xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
<xsl:variable name="count"><xsl:value-of select="count(output/param)"/></xsl:variable>
- <xsl:variable name="outputtype"><xsl:choose><xsl:when test="output/param/@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="output/param/@ours">axis2_</xsl:if><xsl:value-of select="output/param/@type"></xsl:value-of><xsl:if test="output/param/@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
+ <xsl:variable name="outputtype">
+ <xsl:choose>
+ <xsl:when test="output/param/@ours">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<!-- regardless of the sync or async status, the generated method signature would be just a usual
c function-->
/**
- * Auto generated function definition
+ * auto generated function definition signature
+ * for "<xsl:value-of select="@qname"/>" operation.
<!-- select only the body parameters -->
- <xsl:for-each select="input/param[@location='body' and @type!='']">
- <xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
- </xsl:text></xsl:if></xsl:for-each>
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
*/
<xsl:choose>
- <xsl:when test="$count=0">axis2_status_t </xsl:when>
<xsl:when test="$outputtype=''">axis2_status_t </xsl:when>
- <xsl:when test="$outputtype='axis2__t*'">void</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputtype"/>
- </xsl:otherwise>
+ <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
</xsl:choose>
- <xsl:value-of select="$svc_name"/>_<xsl:value-of select="@name"/> (const axis2_env_t* env <xsl:for-each select="input/param[@location='body' and @type!='']"> ,<xsl:variable name="paramtype"><xsl:if test="@ours">axis2_</xsl:if><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:value-of select="@type"></xsl:value-of></xsl:otherwise></xsl:choose><xsl:if test="@ours">_t*</xsl:if></xsl:variable>
- <xsl:value-of select="$paramtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/> (const axis2_env_t *env <xsl:for-each select="input/param[@type!='']"> ,
+ <xsl:variable name="inputtype">
+ <xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
+ </xsl:variable>
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
</xsl:for-each> )
-
{
- /* Todo fill this with the necessary business logic */
+ /* TODO fill this with the necessary business logic */
<xsl:if test="$outputtype!=''">return NULL;</xsl:if>
<xsl:if test="$outputtype=''">return AXIS2_SUCCESS;</xsl:if>
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl?view=diff&rev=443351&r1=443350&r2=443351
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl Thu Sep 14 06:40:28 2006
@@ -1,29 +1,20 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
- <!-- import the databinding template-->
- <xsl:include href="databindsupporter"/>
- <!-- import the other templates for databinding
- Note - these names would be handled by a special
- URI resolver during the xslt transformations
- -->
- <xsl:include href="externalTemplate"/>
-
-
- <xsl:include href="policyExtensionTemplate"/>
-
<xsl:template match="/class">
<xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
- <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
<xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
<xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
<xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
<xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+ <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+ <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+
/**
* <xsl:value-of select="@name"/>.h
*
- * This file was auto-generated from WSDL for Axis2/C - stub code
- * by the Apache Axis2/Java version: #axisVersion# #today#
+ * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
+ * by the Apache Axis2/C version: #axisVersion# #today#
*/
#include <stdio.h>
@@ -34,52 +25,64 @@
#include <axis2_stub.h>
<xsl:for-each select="method">
- <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
- <xsl:if test="$outputours and output/param/@type!='' and output/param/@type!='org.apache.axiom.om.OMElement'">
+ <xsl:if test="output/param[@ours and @type!='']">
<xsl:variable name="outputtype">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
- #include "<xsl:value-of select="$outputtype"/>.h"
+ #include "<xsl:value-of select="$outputtype"/>.h"
</xsl:if>
- <xsl:for-each select="input/param[@type!='' and @ours and @type!='org.apache.axiom.om.OMElement']">
+ <xsl:for-each select="input/param[@type!='' and @ours ]">
<xsl:variable name="inputtype">axis2_<xsl:value-of select="@type"></xsl:value-of></xsl:variable>
#include "<xsl:value-of select="$inputtype"/>.h"
</xsl:for-each>
</xsl:for-each>
/* function prototypes - for header file*/
/**
- * axis2_<xsl:value-of select="$interfaceName"/>_stub_create
+ * <xsl:value-of select="$method-prefix"/>_create
* create and return the stub with services populated
* params - env : environment ( mandatory)
* - client_home : Axis2/C home ( mandatory )
* - endpoint_uri : service endpoint uri( optional ) - if NULL default picked from wsdl used
*/
axis2_stub_t*
- axis2_<xsl:value-of select="$interfaceName"/>_stub_create (const axis2_env_t *env,
+ <xsl:value-of select="$method-prefix"/>_create (const axis2_env_t *env,
axis2_char_t *client_home,
axis2_char_t *endpoint_uri);
/**
- * axis2_populate_axis_service
+ * <xsl:value-of select="$method-prefix"/>_populate_services
* populate the svc in stub with the service and operations
*/
- void axis2_populate_axis_service( axis2_stub_t* stub, const axis2_env_t* env);
+ void <xsl:value-of select="$method-prefix"/>_populate_services( axis2_stub_t *stub, const axis2_env_t *env);
/**
- * axis2_get_endpoint_uri_from_wsdl
+ * <xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl
* return the endpoint URI picked from wsdl
*/
- axis2_char_t* axis2_get_endpoint_uri_from_wsdl ( const axis2_env_t* env );
+ axis2_char_t *<xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl ( const axis2_env_t *env );
<xsl:if test="$isSync='1'">
<xsl:for-each select="method">
+ /**
+ * auto generated function declaration
+ * for "<xsl:value-of select="@qname"/>" operation.
+ <!-- select only the body parameters -->
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+ */
+
<xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
- <xsl:variable name="outputtype"><xsl:choose><xsl:when test="output/param/@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="output/param/@ours">axis2_</xsl:if><xsl:value-of select="output/param/@type"></xsl:value-of><xsl:if test="output/param/@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
+ <xsl:variable name="outputtype">
+ <xsl:choose>
+ <xsl:when test="output/param/@ours">axis2_<xsl:value-of select="output/param/@type"></xsl:value-of>_t*</xsl:when>
+ <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
<xsl:choose>
- <xsl:when test="not($outputtype) or $outputtype=''">axis2_status_t </xsl:when>
- <xsl:when test="$outputtype='axis2__t*'">void</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$outputtype"/>
- </xsl:otherwise>
+ <xsl:when test="$outputtype=''">axis2_status_t</xsl:when>
+ <xsl:when test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:when>
</xsl:choose>
- axis2_<xsl:value-of select="@name"/>( axis2_stub_t* stub, const axis2_env_t* env <xsl:for-each select="input/param[@type!='']"> ,<xsl:variable name="paramtype"><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"></xsl:value-of><xsl:if test="@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axis2_env_t *env<xsl:for-each select="input/param[@type!='']">,
+ <xsl:variable name="inputtype">
+ <xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
+ </xsl:variable>
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
</xsl:for-each>);
</xsl:for-each>
</xsl:if> <!--close for test="$isSync='1'-->
@@ -87,13 +90,25 @@
<!-- Async method prototype generation -->
<xsl:if test="$isAsync='1'">
<xsl:for-each select="method">
+ /**
+ * auto generated function declaration
+ * for "<xsl:value-of select="@qname"/>" operation.
+ <!-- select only the body parameters -->
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+ * @param on_complete callback to handle on complete
+ * @param on_error callback to handle on error
+ */
+
<xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
- <xsl:if test="not($mep='10')">
- void axis2_start_<xsl:value-of select="@name"/>( axis2_stub_t* stub, const axis2_env_t* env, <xsl:for-each select="input/param[@type!='']"><xsl:variable name="paramtype"><xsl:choose><xsl:when test="@type='org.apache.axiom.om.OMElement'">axiom_node_t*</xsl:when><xsl:otherwise><xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"></xsl:value-of><xsl:if test="@ours">_t*</xsl:if></xsl:otherwise></xsl:choose></xsl:variable>
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ <xsl:if test="$mep='12'">
+ void <xsl:value-of select="$method-prefix"/>_<xsl:value-of select="@name"/>_start( axis2_stub_t *stub, const axis2_env_t *env<xsl:for-each select="input/param[@type!='']">,
+ <xsl:variable name="inputtype">
+ <xsl:if test="@ours">axis2_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
+ </xsl:variable>
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
</xsl:for-each>,
- axis2_status_t ( AXIS2_CALL *on_complete ) (struct axis2_callback *, const axis2_env_t* ) ,
- axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback *, const axis2_env_t*, int ) );
+ axis2_status_t ( AXIS2_CALL *on_complete ) (struct axis2_callback *, const axis2_env_t* ) ,
+ axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback *, const axis2_env_t*, int ) );
</xsl:if> <!--close for test="$mep='http://www.w3.org/2004/08/wsdl/in-out'"-->
</xsl:for-each>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org