in src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java [504:597]
protected void writePreprocessorStatements() throws WrapperFault
{
try
{
c_writer.write("#include <axis/AxisUserAPI.hpp>\n");
c_writer.write("#include <axis/AxisUserAPIArrays.hpp>\n");
c_writer.write("#include <axis/IWrapperSoapDeSerializer.hpp>\n");
c_writer.write("#include <axis/IWrapperSoapSerializer.hpp>\n");
if (this.type.isFault())
{
c_writer.write("#include <axis/SoapFaultException.hpp>\n");
c_writer.write("\n");
c_writer.write("using namespace std;\n");
}
c_writer.write("AXIS_CPP_NAMESPACE_USE \n\n");
HashSet typeSet = new HashSet();
for (int i = 0; i < attribs.length; i++)
{
String basicType = attribs[i].getTypeName();
Type theType = attribs[i].getType();
if (theType.isRestriction() && !CUtils.isPrimitiveType(basicType))
typeSet.add(CUtils.sanitizeString(basicType));
else if (!attribs[i].isSimpleType() && !attribs[i].isAnyElement())
{
if ((attribs[i].isArray()) && !theType.isSimpleType())
typeSet.add(CUtils.sanitizeString(CUtils.getArrayNameForType(basicType)));
typeSet.add(CUtils.sanitizeString(basicType));
}
}
// TODO we really do not support xsd:extension correctly or completely!
if (extensionBaseAttrib != null
&& getCorrectParmNameConsideringArraysAndComplexTypes(extensionBaseAttrib) != null)
{
String extBaseType = getCorrectParmNameConsideringArraysAndComplexTypes(extensionBaseAttrib);
// TODO following is hack till we really support xsd:extension correctly
if (extBaseType.lastIndexOf("*") > -1)
extBaseType = extBaseType.substring(0, extBaseType.lastIndexOf("*"));
if (!CUtils.isPrimitiveType(extBaseType))
typeSet.add(CUtils.sanitizeString(extBaseType));
}
Iterator itr = typeSet.iterator();
if (itr.hasNext())
c_writer.write("\n");
while (itr.hasNext())
{
// Do not want to include the header file we are generating!
String includeFile = itr.next().toString();
if (!includeFile.equals(c_classname))
c_writer.write("#include \"" + includeFile + CUtils.getHeaderFileExtension() + "\"\n");
}
c_writer.write("\n");
//Local name and the URI for the type
c_writer.write("/*Local name and the URI for the type*/\n");
c_writer.write("static const char Axis_URI_" + c_classname + "[] = \""
+ type.getName().getNamespaceURI() + "\";\n");
c_writer.write("static const char Axis_TypeName_" + c_classname
+ "[] = \"" + type.getName().getLocalPart() + "\";\n\n");
// Define class to avoid compilation issues (cycle in includes).
// This is a must for complex wsdl files.
typeSet = new HashSet();
for (int i = 0; i < attribs.length; i++)
{
if (!attribs[i].isArray() &&
!(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType())
&& !attribs[i].isAnyElement())
{
typeSet.add(CUtils.sanitizeString(attribs[i].getTypeName()));
}
}
itr = typeSet.iterator();
while (itr.hasNext())
{
c_writer.write("class " + itr.next().toString() + ";\n");
}
}
catch (IOException e)
{
throw new WrapperFault(e);
}
}