You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by mu...@apache.org on 2003/12/15 12:18:00 UTC
cvs commit: ws-axis/contrib/axismora/src/org/apache/axismora MessageContext.java
muthulee 2003/12/15 03:18:00
Modified: contrib/axismora/src/org/apache/axismora/soap
BasicMessageContext.java
contrib/axismora/src/org/apache/axismora MessageContext.java
Added: contrib/axismora/src/org/apache/axismora/wsdl2ws/doclit
AllDocLitParamWriter.java DocLitBeanWriter.java
DocLitArrayWriter.java
contrib/axismora/src .project .classpath
contrib/axismora/src/org/apache/axismora/provider/serializer
DocLiteralSerializer.java
Log:
Changing the way serialization is managed.
Revision Changes Path
1.1 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/doclit/AllDocLitParamWriter.java
Index: AllDocLitParamWriter.java
===================================================================
package org.apache.axismora.wsdl2ws.doclit;
import java.util.Iterator;
import org.apache.axismora.wsdl2ws.WrapperConstants;
import org.apache.axismora.wsdl2ws.WrapperFault;
import org.apache.axismora.wsdl2ws.info.Type;
import org.apache.axismora.wsdl2ws.info.TypeMap;
import org.apache.axismora.wsdl2ws.info.WebServiceContext;
/**
* Geberates all parmeter classes for document literal web service.
* This is what the BP says;
*
* R2201 A document-literal binding in a DESCRIPTION MUST,
* in each of its soapbind:body element(s),
* have at most one part listed in the parts attribute,
* if the parts attribute is specified.
* I am a bit confused about R2201 ????
*
* R2204 A document-literal binding in a DESCRIPTION MUST refer,
* in each of its soapbind:body element(s),
* only to wsdl:part element(s)
* that have been defined using the element attribute.
*
* R2210 If a document-literal binding in a DESCRIPTION
* does not specify the parts attribute on a soapbind:body element,
* the corresponding abstract wsdl:message MUST define zero or one wsdl:parts.
*
* @author Dimuthu Leelaratne. muthulee@yahoo.com
*
*/
public class AllDocLitParamWriter {
/* TODO :: Check for R2201 compliance.
* NO support for arrays of enums ?????
* Arrays can exist only inside beans ..... and how is the problem
*/
private WebServiceContext wscontext;
public AllDocLitParamWriter(WebServiceContext wscontext) {
this.wscontext = wscontext;
}
/**
* Calls the DocLit BeanParam writer for all parameters.
* According to BP only elements should travel on wire.
*
* @throws WrapperFault if simple types or arrays.
* @see org.apache.axismora.wsdl2ws.SourceWriter#writeSource()
*/
public void writeSource() throws WrapperFault {
Iterator allTypes = wscontext.getTypemap().getTypes().iterator();
String generator = wscontext.getWrapInfo().getImplStyle();
Type type;
while (allTypes.hasNext()) {
try {
type = (Type) allTypes.next();
if(TypeMap.isSimpleType(type.getName()))
System.out.println(" +++++++++++++ simple type met ");
//throw new WrapperFault("Simple types not allowed. Only elements are allowed.\n Refer R2204 of BP.");
//TODO :: Check whether to put break;
// change the things
if (wscontext.getWrapInfo().getImplStyle().equals(WrapperConstants.IMPL_STYLE_STRUCT)) {
if(type.getEnumerationdata() != null){
System.out.println("Enumeration not supported yet ... in docLit");
}else if (type.isArray()) {
TypeMap.regestorArrayTypeToCreate(type);
} else {
System.out.println("DocLitBeanWriter is called ......");
(new DocLitBeanWriter(wscontext, type)).writeSource();
}
}
} catch (Exception e) {
System.out.println(
"Error occured yet we continue to genarate other classes ... you should check the error");
e.printStackTrace();
}
}
Iterator arrayTypes = TypeMap.getUnregisterdArrayTypes();
while(arrayTypes.hasNext()){
System.out.println("Array writer called ......");
(new DocLitArrayWriter(wscontext, (Type)arrayTypes.next())).writeSource();
}
}
}
1.1 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/doclit/DocLitBeanWriter.java
Index: DocLitBeanWriter.java
===================================================================
package org.apache.axismora.wsdl2ws.doclit;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import javax.xml.namespace.QName;
import org.apache.axismora.encoding.AxisPullParser;
import org.apache.axismora.wsdl2ws.java.JavaClassWriter;
import org.apache.axismora.wsdl2ws.java.JavaUtils;
import org.apache.axismora.wsdl2ws.WrapperConstants;
import org.apache.axismora.wsdl2ws.WrapperFault;
import org.apache.axismora.wsdl2ws.WrapperUtils;
import org.apache.axismora.wsdl2ws.info.ElementInfo;
import org.apache.axismora.wsdl2ws.info.Type;
import org.apache.axismora.wsdl2ws.info.TypeMap;
import org.apache.axismora.wsdl2ws.info.WebServiceContext;
/**
* This class do not handle arrays.
* Just handles the deserialization and serialization of in and out parameters.
* @author Dimuthu Leelaratne.
* @author JeyaKumaran.
*
*
*/
public class DocLitBeanWriter extends JavaClassWriter{
WebServiceContext wscontext;
Type type; // type of this param
String[][] attribs;
public DocLitBeanWriter(WebServiceContext wscontext, Type type) throws WrapperFault {
super(WrapperUtils.getPackegeName4QualifiedName(type.getLanguageSpecificName()),
WrapperUtils.getClassNameFromFullyQualifiedName(
type.getLanguageSpecificName()));
this.wscontext = wscontext;
this.type = type;
if (type.isArray())
throw new WrapperFault("I am doclit in, out param writer. I do not write arrays");
this.attribs =
this.getAttribList(wscontext.getSerInfo().getQualifiedServiceName());
}
/**
* This method handle the logic of deserialization.
* @throws WrapperFault
*/
public void writeDesireializeCode() throws WrapperFault{
// TODO :: Write deserialize code.
}
/**
* This method handle the logic of serialization.
* @throws WrapperFault
*/
public void writeSerialieCode() throws WrapperFault{
try {
if (attribs.length == 0) {
//nothing to print if this is simple type we have inbuild types
System.out.println(
"possible error calss with no attributes....................");
return;
}
writer.write(
"\t\tString m_URI =\"" + type.getName().getNamespaceURI() + "\";\n");
writer.write(
"\t\tString type_name = \"" + type.getName().getLocalPart() + "\";\n");
writer.write(
"\t\t\torg.apache.axismora.wsdl2ws.java.ParmWriter.tagWritten = false;\n");
writer.write("\t\t//write the parameters\n\n");
for (int i = 0; i < attribs.length; i++) {
/**
* if(WrapperConstants.STYLE_DOCUMENT.equals(this.wscontext.getWrapInfo().getWrapperStyle()));
* write the type=typename code here
*/
Type t;
boolean check4null = !JavaUtils.isJavaSimpleType(attribs[i][1]);
if (TypeMap.isSimpleType(attribs[i][1])) {
//for simple type
writer.write(
"\t\tcontext.writeString(\"<" + attribs[i][0] + ">\");\n");
writer.write(
check4null
? "\t\tif(this." + attribs[i][0] + "!=null){\n"
: "");
if (JavaUtils.isUnwrapperdSimpleType(attribs[i][1]))
writer.write(
"\t\t\tcontext.writeString(String.valueOf("
+ attribs[i][0]
+ ".getParam()));\n");
else
writer.write(
"\t\t\tcontext.writeString(String.valueOf("
+ attribs[i][0]
+ "));\n");
} else if (attribs[i][1].endsWith("[]")){
//TODO :: for array type
// QName arrayType = new QName(attribs[i][5],attribs[i][6]);
// String arrTypeAdditionalString =
// " xsi:type=\\\"soapenc:Array\\\" soapenc:arrayType=\\\"ns2:"
// + arrayType.getLocalPart()
// + "[]\\\" xmlns:ns2 = \\\""
// + arrayType.getNamespaceURI()
// + "\\\"";
// writer.write(
// "\t\tcontext.writeString(\"<"
// + attribs[i][0]
// + arrTypeAdditionalString
// + ">\");\n");
// writer.write(
// check4null
// ? "\t\tif(this." + attribs[i][0] + "!=null){\n"
// : "");
// writer.write("\t\t\tcontext.writeString(\"\\n\");\n");
// writer.write("\t\t\t"
// + attribs[i][4]+ " item" + i
// + " = new " + attribs[i][4] + "();\n");
// writer.write(
// "\t\t\titem" + i + ".setParam(" + attribs[i][0] + ");\n");
// writer.write(
// "\t\t\torg.apache.axismora.wsdl2ws.java.ParmWriter.tagWritten = true;\n");
// writer.write("\t\t\titem" + i + ".serialize(context);\n");
//
} else {
//for complex type
writer.write(
"\t\tcontext.writeString(\"<" + attribs[i][0] + ">\");\n");
writer.write(
check4null
? "\t\tif(this." + attribs[i][0] + "!=null){\n"
: "");
writer.write(
"\t\t\torg.apache.axismora.wsdl2ws.java.ParmWriter.tagWritten = true;\n");
writer.write("\t\t\t" + attribs[i][0] + ".serialize(context);\n");
}
writer.write(check4null ? "\t\t}\n" : "");
writer.write(
"\t\tcontext.writeString(\"</" + attribs[i][0] + ">\\n\");\n\n");
}
} catch (IOException e) {
e.printStackTrace();
throw new WrapperFault(e);
}
}
protected String getimplementsPart() {
return " implements org.apache.axismora.encoding.InOutParameter";
}
protected void writeClassComment() throws WrapperFault {
try {
writer.write("/**\n * <p>This class is genarated by the tool WSDL2Ws.\n" +
" * It take care of the serialization and the desirialization of\n" +
" * the in and out parameters of document literal web service.\n" +
" */ \n");
} catch (IOException e) {
e.printStackTrace();
throw new WrapperFault(e);
}
}
protected void writeImportStatements() throws WrapperFault {
}
protected void writeAttributes() throws WrapperFault {
try {
for (int i = 0; i < attribs.length; i++) {
//if((t = wscontext.getTypemap().getType(new QName(attribs[i][2],attribs[i][3])))!= null && t.isArray()) continue;
writer.write(
"\tprivate "
+ attribs[i][1]
+ " "
+ attribs[i][0]
+ ";\n");
}
writer.write("\n");
} catch (IOException e) {
throw new WrapperFault(e);
}
}
protected void writeConstructors() throws WrapperFault {
try {
if(attribs.length>0){
writer.write(
"\tpublic "
+ WrapperUtils.getClassNameFromFullyQualifiedName(
type.getLanguageSpecificName())
+ "(){\n");
//this.writeInitializer();
writer.write("\t}\n");
}
writeAttributesConstructor();
writer.write("\n");
} catch (IOException e) {
throw new WrapperFault(e);
}
}
protected void writeMethods() throws WrapperFault {
try {
writer.write("\n");
writeDesirializeMethod();
writer.write("\n");
writeSerializeMethod();
writer.write("\n");
writeGettersAndSetter();
//writeEqual();
} catch (IOException e) {
throw new WrapperFault(e);
}
}
public void writeDesirializeMethod() throws WrapperFault {
try {
writer.write(
"\tpublic org.apache.axismora.encoding.InParameter desierialize(org.apache.axismora.MessageContext msgdata)throws org.apache.axis.AxisFault{\n");
this.writeDesireializeCode();
writer.write("\t\treturn this;\n");
writer.write("\n\t}\n");
} catch (IOException e) {
e.printStackTrace();
throw new WrapperFault(e);
}
}
public void writeSerializeMethod() throws WrapperFault {
try {
writer.write(
"\tpublic void serialize(org.apache.axis.encoding.SerializationContext context)throws java.io.IOException{\n");
this.writeSerialieCode();
writer.write("\t}\n");
} catch (IOException e) {
e.printStackTrace();
throw new WrapperFault(e);
}
}
/**
* get the path to the file.
* @return
*/
protected File getJavaFilePath() {
new File(
wscontext.getWrapInfo().getTargetOutputLocation()
+ "/"
+ WrapperUtils.getPackegeName4QualifiedName(
type.getLanguageSpecificName()).replace(
'.',
'/'))
.mkdirs();
String fileName =
wscontext.getWrapInfo().getTargetOutputLocation()
+ "/"
+ type.getLanguageSpecificName().replace('.', '/')
+ ".java";
return new File(fileName);
}
/** genarate the arrtibs into an array
* Odd numbers for names.
* Even numbers for types.
* */
public String[][] getAttribList(String Qualifiedname) throws WrapperFault {
String[][] attribs;
ArrayList attribfeilds = new ArrayList();
ArrayList elementfeilds = new ArrayList();
//this is for encoded stuff afford to consider the
//attributes and elemnts equal
Enumeration names = type.getAttributeNames();
while (names.hasMoreElements()) {
attribfeilds.add(names.nextElement());
}
names = type.getElementnames();
while (names.hasMoreElements()) {
elementfeilds.add(names.nextElement());
}
//get all the fields
attribs = new String[attribfeilds.size()+elementfeilds.size()][];
for (int i = 0; i < attribfeilds.size(); i++) {
attribs[i] = new String[7];
attribs[i][0] = ((String) attribfeilds.get(i));
Type t = type.getTypForAttribName(attribs[i][0]);
attribs[i][1] = t.getLanguageSpecificName();
QName name = t.getName();
attribs[i][2] = name.getNamespaceURI();
attribs[i][3] = name.getLocalPart();
attribs[i][4] = attribs[i][1];
attribs[i][5] = null;
attribs[i][6] = null;
}
for (int i = attribfeilds.size(); i < attribfeilds.size()+elementfeilds.size(); i++) {
attribs[i] = new String[7];
attribs[i][0] = ((String) elementfeilds.get(i - attribfeilds.size()));
ElementInfo element = type.getElementForElementName(attribs[i][0]);
Type t = element.getType();
attribs[i][1] = t.getLanguageSpecificName();
QName name = t.getName();
attribs[i][2] = name.getNamespaceURI();
attribs[i][3] = name.getLocalPart();
attribs[i][4] = attribs[i][1];
if(t.isArray()){
attribs[i][4] = attribs[i][1];
Type arrayType = WrapperUtils.getArrayType(t);
attribs[i][1] = arrayType.getLanguageSpecificName()+"[]";
attribs[i][5] = arrayType.getName().getNamespaceURI();
attribs[i][6] = arrayType.getName().getLocalPart();
}
if(element.getMaxOccurs() > 1){
attribs[i][1] = attribs[i][1] + "[]";
Type typedata = new Type(new QName(name.getNamespaceURI(),name.getLocalPart()+"Array")
,null,false,WrapperConstants.LANGUAGE_JAVA);
typedata.setTypeNameForElementName(new ElementInfo(new QName("item"),t));
typedata.setArray(true);
attribs[i][4] = TypeMap.regestorArrayTypeToCreate(typedata);
attribs[i][5] = t.getName().getNamespaceURI();
attribs[i][6] = t.getName().getLocalPart();
}
}
return attribs;
}
private void writeGettersAndSetter() throws IOException, WrapperFault {
for (int i = 0; i < this.attribs.length; i++) {
writer.write(
"\tpublic void set"
+ WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+ "("
+ attribs[i][1]
+ " "
+ attribs[i][0]
+ "){\n\t\tthis."
+ attribs[i][0]
+ " = "
+ attribs[i][0]
+ ";\n\t}\n");
writer.write(
"\tpublic "
+ attribs[i][1]
+ " get"
+ WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+ "(){\n\t\treturn "
+ attribs[i][0]
+ ";\n\t}\n");
}
}
protected void writeAttributesConstructor() throws WrapperFault {
try {
writer.write(
"\tpublic "
+ WrapperUtils.getClassNameFromFullyQualifiedName(
type.getLanguageSpecificName())
+ "(");
if (attribs.length > 0) {
writer.write(attribs[0][1]
+ " "
+ attribs[0][0]);
for (int i = 1; i < this.attribs.length; i++)
writer.write(attribs[i][1]
+ " "
+ attribs[i][0]);
}
writer.write("){\n");
for (int i = 0; i < this.attribs.length; i++)
writer.write("\t\tthis." + attribs[i][0] + " = " + attribs[i][0] + ";\n");
writer.write("\t}\n");
} catch (IOException e) {
throw new WrapperFault(e);
}
}
public void writeInitializer() throws IOException, WrapperFault {
String temp = null;
for (int i = 0; i < attribs.length; i++) {
String name =attribs[i][1];
writer.write("this." + attribs[i][0] + " =");
if (name.endsWith("[]")) {
writer.write(!"byte[]".equals(name) ? (" new " + name + "{") : "");
temp = attribs[i][1];
attribs[i][1] = name.substring(0, name.length() - 2);
}
if ("boolean".equals(attribs[i][1]))
writer.write("false");
else if (
"int".equals(attribs[i][1])
|| "long".equals(attribs[i][1])
|| "float".equals(attribs[i][1])
|| "double".equals(attribs[i][1])
|| "short".equals(attribs[i][1]))
writer.write(String.valueOf(i));
else if ("byte".equals(attribs[i][1]))
writer.write("\"string" + i + "\".getBytes();\n");
else if ("char".equals(attribs[i][1]))
writer.write("\'" + i + "\'");
else if ("java.lang.String".equals(attribs[i][1]))
writer.write("\"string" + i + "\"");
else
writer.write("new " + attribs[i][1] + "()");
if (name.endsWith("[]")) {
writer.write(!"byte[]".equals(name) ? "}" : "");
attribs[i][1] = temp;
}
writer.write(";\n");
}
}
public void writeEqual() throws IOException, WrapperFault {
writer.write("\tpublic boolean equals(Object obj) {\n");
writer.write(
"\t\tif(!(obj instanceof "
+ type.getLanguageSpecificName()
+ "))\n\t\t\treturn false;\n");
writer.write(
"\t\t"
+ type.getLanguageSpecificName()
+ " value = ("
+ type.getLanguageSpecificName()
+ ")obj;\n");
for (int i = 0; i < attribs.length; i++) {
String name = attribs[i][1];
//TODO :: Dimuthu remve this. if array
// extends part
if (name.endsWith("[]")) {
String tname = name.substring(0, name.length() - 2);
writer.write(
"\t\tif("
+ attribs[i][0]
+ "!=null && "
+ attribs[i][0]
+ ".length !=0){\n");
if ("int".equals(tname)
|| "long".equals(tname)
|| "float".equals(tname)
|| "double".equals(tname)
|| "short".equals(tname)
|| "byte".equals(tname)
|| "char".equals(tname)
|| "boolean".equals(tname)) {
writer.write(
"\t\tif("
+ attribs[i][0]
+ "[0] != value.get"
+ WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+ "()[0])\n\t\t\treturn false;\n");
} else {
//else
writer.write(
"\t\tif(!"
+ attribs[i][0]
+ "[0].equals(value.get"
+ WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+ "()[0]))\n\t\t\treturn false;\n");
}
writer.write("\t\t}\n");
//if simple type
} else if (
"int".equals(attribs[i][1])
|| "long".equals(attribs[i][1])
|| "float".equals(attribs[i][1])
|| "double".equals(attribs[i][1])
|| "short".equals(attribs[i][1])
|| "byte".equals(attribs[i][1])
|| "char".equals(attribs[i][1])
|| "boolean".equals(attribs[i][1])) {
writer.write(
"\t\tif("
+ attribs[i][0]
+ " != value.get"
+ WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+ "())\n\t\t\treturn false;\n");
} else {
//else
writer.write(
"\t\tif(!"
+ attribs[i][0]
+ ".equals(value.get"
+ WrapperUtils.capitalizeFirstCaractor(attribs[i][0])
+ "()))\n\t\t\treturn false;\n");
}
}
writer.write("\t\treturn false;");
writer.write("\t}\n");
}
}
1.1 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/doclit/DocLitArrayWriter.java
Index: DocLitArrayWriter.java
===================================================================
package org.apache.axismora.wsdl2ws.doclit;
import org.apache.axismora.wsdl2ws.info.Type;
import org.apache.axismora.wsdl2ws.info.WebServiceContext;
/**
* @author Dimuthu Leelaratne
*
*/
public class DocLitArrayWriter {
public DocLitArrayWriter(WebServiceContext wscontext, Type type){
System.out.println("Array types not supported yet .....");
}
public void writeSource(){
}
}
1.1 ws-axis/contrib/axismora/src/.project
Index: .project
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>apacheMora</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
1.1 ws-axis/contrib/axismora/src/.classpath
Index: .classpath
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="E:/lib/xpp3-1.1.3.2.jar"/>
<classpathentry kind="lib" path="E:/lib/ant.jar"/>
<classpathentry kind="lib" path="E:/lib/axis.jar"/>
<classpathentry kind="lib" path="E:/lib/axis-ant.jar"/>
<classpathentry kind="lib" path="E:/lib/bsf.jar"/>
<classpathentry kind="lib" path="E:/lib/commons-collections.jar"/>
<classpathentry kind="lib" path="E:/lib/commons-dbcp.jar"/>
<classpathentry kind="lib" path="E:/lib/commons-discovery.jar"/>
<classpathentry kind="lib" path="E:/lib/commons-logging.jar"/>
<classpathentry kind="lib" path="E:/lib/commons-logging-api.jar"/>
<classpathentry kind="lib" path="E:/lib/commons-pool.jar"/>
<classpathentry kind="lib" path="E:/lib/jasper-compiler.jar"/>
<classpathentry kind="lib" path="E:/lib/jasper-runtime.jar"/>
<classpathentry kind="lib" path="E:/lib/jaxrpc.jar"/>
<classpathentry kind="lib" path="E:/lib/jdbc2_0-stdext.jar"/>
<classpathentry kind="lib" path="E:/lib/jndi.jar"/>
<classpathentry kind="lib" path="E:/lib/js.jar"/>
<classpathentry kind="lib" path="E:/lib/jta.jar"/>
<classpathentry kind="lib" path="E:/lib/junit3.8.1.jar"/>
<classpathentry kind="lib" path="E:/lib/log4j-1.2.4.jar"/>
<classpathentry kind="lib" path="E:/lib/mail.jar"/>
<classpathentry kind="lib" path="E:/lib/naming-common.jar"/>
<classpathentry kind="lib" path="E:/lib/naming-factory.jar"/>
<classpathentry kind="lib" path="E:/lib/naming-resources.jar"/>
<classpathentry kind="lib" path="E:/lib/saaj.jar"/>
<classpathentry kind="lib" path="E:/lib/servlet.jar"/>
<classpathentry kind="lib" path="E:/lib/wsdl4j.jar"/>
<classpathentry kind="lib" path="E:/lib/xercesImpl.jar"/>
<classpathentry kind="lib" path="E:/lib/xml-apis.jar"/>
<classpathentry kind="lib" path="E:/lib/xmlParserAPIs.jar"/>
<classpathentry kind="lib" path="E:/lib/activation.jar"/>
<classpathentry kind="output" path=""/>
</classpath>
1.4 +12 -3 ws-axis/contrib/axismora/src/org/apache/axismora/soap/BasicMessageContext.java
Index: BasicMessageContext.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/soap/BasicMessageContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BasicMessageContext.java 15 Dec 2003 03:22:25 -0000 1.3
+++ BasicMessageContext.java 15 Dec 2003 11:17:59 -0000 1.4
@@ -308,9 +308,6 @@
public boolean setSoapBodyContent(Object result) throws AxisFault {
if (result instanceof OutParameter){
- if(this.style.getName().equals("document")){
- this.resultValue = new DocLiteralResult((OutParameter)result);
- }else
this.resultValue = new RPCResult((OutParameter) result, this.methodName);
}else if (result instanceof Element[])
this.resultValue = new MSGResult((Element[]) result);
@@ -322,6 +319,18 @@
return true;
}
+ /**
+ * This method takes care of serializing of body according to the style.
+ * Style specific serialization is handled in the java classes in the package
+ * provider.serializers.
+ *
+ * @param styleProvider Manages serialization of the body acording to the style.
+ * @throws AxisFault
+ */
+ public void setSoapBodyContents(Serializable styleProvider) throws AxisFault{
+ this.resultValue = styleProvider;
+ }
+
public QName getMethodName() {
return this.methodName;
}
1.1 ws-axis/contrib/axismora/src/org/apache/axismora/provider/serializer/DocLiteralSerializer.java
Index: DocLiteralSerializer.java
===================================================================
package org.apache.axismora.provider.serializer;
import java.io.IOException;
import javax.xml.namespace.QName;
import org.apache.axismora.encoding.OutParameter;
import org.apache.axismora.encoding.Serializable;
import org.apache.axis.encoding.SerializationContext;
/**
* Manages serialization of the body.
* Serialization at both client and server side should be taken care of by this.
* @author Dimuthu Leelarathne.
*
*/
public class DocLiteralSerializer implements Serializable {
private OutParameter parm;
public DocLiteralSerializer(OutParameter param,QName qName) {
this.parm = param;
}
/**
* this method is called by the SOAPHeaderElement when serializing
*/
public void serialize(SerializationContext sc) throws IOException {
if(parm != null){
parm.serialize(sc);
} else System.out.println("DEBUG - The param is null");
}
}
1.4 +12 -0 ws-axis/contrib/axismora/src/org/apache/axismora/MessageContext.java
Index: MessageContext.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/MessageContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MessageContext.java 15 Dec 2003 03:22:25 -0000 1.3
+++ MessageContext.java 15 Dec 2003 11:17:59 -0000 1.4
@@ -63,6 +63,7 @@
import org.apache.axismora.deployment.AxisDeployment;
import org.apache.axismora.encoding.AxisPullParser;
+import org.apache.axismora.encoding.Serializable;
import org.apache.axismora.soap.XMLTextData;
import org.apache.axis.AxisFault;
@@ -123,6 +124,17 @@
* @param result
* @return
*/
+
+ /**
+ * This method takes care of serializing of body according to the style.
+ * Style specific serialization is handled in the java classes in the package
+ * provider.serializers.
+ *
+ * @param styleProvider Manages serialization of the body acording to the style.
+ * @throws AxisFault
+ */
+ public void setSoapBodyContents(Serializable styleProvider) throws AxisFault;
+
public boolean setSoapBodyContent(Object result) throws AxisFault;
/**
* get the name of the method (wsdl operation) invoke by this requst