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 ha...@apache.org on 2005/12/22 14:13:16 UTC
svn commit: r358562 -
/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
Author: hawkeye
Date: Thu Dec 22 05:13:12 2005
New Revision: 358562
URL: http://svn.apache.org/viewcvs?rev=358562&view=rev
Log:
Fix AXISCPP 753.
Modified:
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java?rev=358562&r1=358561&r2=358562&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java Thu Dec 22 05:13:12 2005
@@ -59,6 +59,8 @@
import org.apache.axis.wsdl.wsdl2ws.info.WrapperInfo;
import org.w3c.dom.Node;
+import sun.security.action.GetLongAction;
+
/**
* This this the main class for the WSDL2Ws Tool. This class reuses the code in the
* Axis java implementations to parse the WSDL file.
@@ -692,6 +694,7 @@
if (wsg == null)
throw new WrapperFault("WSDL2Ws does not support the option combination");
exposeReferenceTypes(wsContext);
+ exposeMessagePartsThatAreAnonymousTypes(wsContext);
if (WSDL2Ws.verbose)
{
@@ -705,6 +708,94 @@
}
/**
+ * @param wsContext
+ */
+ private void exposeMessagePartsThatAreAnonymousTypes(WebServiceContext wsContext)
+ {
+ // get the main types
+ Collection types = symbolTable.getTypeIndex().values();
+ Iterator typeIterator = types.iterator();
+ while(typeIterator.hasNext())
+ {
+ Object highLevelType = typeIterator.next();
+ if(!(highLevelType instanceof BaseType))
+ {
+ DefinedType type = (DefinedType)highLevelType;
+
+ if(type.getQName().getLocalPart().toString().startsWith(">")&& !(type.getQName().getLocalPart().toString().lastIndexOf(">")>1))
+ {
+ // this is an "inner" type that will not be exposed
+ // however, it needs to be if it is referenced in a message part.
+ // check all the messages
+ ArrayList methods = wsContext.getSerInfo().getMethods();
+ for(int i=0; i<methods.size(); i++)
+ {
+ MethodInfo method = (MethodInfo)methods.get(i);
+ Collection inputParameterTypes = method.getInputParameterTypes();
+ Iterator paramIterator = inputParameterTypes.iterator();
+ while(paramIterator.hasNext())
+ {
+ ParameterInfo parameterInfo =(ParameterInfo)paramIterator.next();
+ Type parameterType = parameterInfo.getType();
+ if(parameterType.getName().equals(type.getQName()))
+ {
+ QName oldName = parameterType.getName();
+ QName newTypeName = new QName(parameterType.getName().getNamespaceURI(), parameterType.getName().getLocalPart().substring(1));
+
+ Type innerClassType = wsContext.getTypemap().getType(parameterType.getName());
+ // innerClassType.setLanguageSpecificName(newTypeName);
+
+ // First thing to do is to expose the type so it gets created.
+ innerClassType.setLanguageSpecificName(newTypeName.getLocalPart().toString());
+
+ // also have to set the QName becuase this is used in generating the header info.
+ innerClassType.setName(newTypeName);
+
+ // The typemap we get back is a copy of the actual typemap so we have to set the new value explicitly
+ // firstly remove the old version
+ wsContext.getTypemap().removeType(oldName);
+ wsContext.getTypemap().addType(newTypeName, innerClassType);
+
+ Iterator AllTypes = symbolTable.getTypeIndex().values().iterator();
+ }
+ }
+ }
+
+ }
+ }
+ }
+
+
+// ArrayList methods = wsContext.getSerInfo().getMethods();
+// for(int i=0; i<methods.size(); i++)
+// {
+// MethodInfo method = (MethodInfo)methods.get(i);
+// Collection inputParameterTypes = method.getInputParameterTypes();
+// Iterator paramIterator = inputParameterTypes.iterator();
+// while(paramIterator.hasNext())
+// {
+// ParameterInfo parameterInfo =(ParameterInfo)paramIterator.next();
+// Type parameterType = parameterInfo.getType();
+// if(parameterType.getLanguageSpecificName().startsWith(">"))
+// {
+// // Then this type has not been exposed as a seperate class and it needs to be
+// System.out.println( "got to expose "+parameterType.getName().getLocalPart());
+// QName exposedName = new QName(parameterType.getName().getNamespaceURI(), parameterType.getName().getLocalPart().substring(1));
+// // There'#s no point in doing this unless the type map is changed
+// Type type = wsContext.getTypemap().getType(parameterType.getName());
+// type.setName(exposedName);
+// wsContext.getTypemap().removeType(parameterType.getName());
+// wsContext.getTypemap().addType(exposedName, type);
+// //parameterType.setLanguageSpecificName(new QName(parameterType.getLanguageSpecificName().substring(1)).toString() );
+//
+// // also have to set the QName becuase this is used in generating the header info.
+// //parameterType.setName(new QName(parameterType.getName().getNamespaceURI(), parameterType.getLanguageSpecificName()));
+//
+//
+// }
+
+ }
+ /**
* This code is taken from the org.apache.axis.wsdl.gen.Parser Class.
* WSDL file should have only one service, The first service
* find is utilized.
@@ -1168,7 +1259,6 @@
}
}
}
-
}
}