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 he...@apache.org on 2004/02/19 13:39:04 UTC
cvs commit: ws-axis/contrib/axismora/src AxisServlet.java
hemapani 2004/02/19 04:39:03
Modified: contrib/axismora/src/org/apache/axismora/wsdl2ws/java
BeanParamWriter.java ArrayParamWriter.java
DeploymentWriter.java
contrib/axismora/src/org/apache/axismora/wsdl2ws/testing
RPCTestCaseWriter.java TestUtils.java
contrib/axismora/src/org/apache/axismora/encoding
DesirializationContext.java
contrib/axismora/src/org/apache/axismora/provider/result
DocLiteralSerializer.java RPCResult.java
MSGResult.java HandlerResetResult.java
contrib/axismora/src/org/apache/axismora/wrappers/simpleType
StringParam.java IntParam.java
contrib/axismora/src/org/apache/axismora/engine
AxisEngine.java
contrib/axismora/src/org/apache/axismora/encoding/ser
SerializationContext.java NSmap.java
EnhancedWriter.java
contrib/axismora/src/org/apache/axismora/util
ByteArrayStack.java PerfLog.java
contrib/axismora/src/org/apache/axismora/provider/serializer
DocLiteralSerializer.java
contrib/axismora/src/org/apache/axismora/soap
BasicMessageContext.java
contrib/axismora/src/org/apache/axismora/server
SimpleAxisServer.java
contrib/axismora/src AxisServlet.java
Log:
refactor the code to imporve the Enhanced Writer
fix the test case generation
fix the Array serialization when the paramaters is null
address the Integer serialization when white spaces are around
Revision Changes Path
1.8 +89 -7 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/java/BeanParamWriter.java
Index: BeanParamWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/java/BeanParamWriter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BeanParamWriter.java 27 Jan 2004 05:55:45 -0000 1.7
+++ BeanParamWriter.java 19 Feb 2004 12:39:02 -0000 1.8
@@ -104,13 +104,94 @@
Type t;
boolean check4null = !JavaUtils.isJavaSimpleType(attribs[i].javaType);
+ if (TypeMap.isSimpleType(attribs[i].javaType)) {
+ //for simple type
+ writer.write(
+ "\t\tcontext.writeString(\"<" + attribs[i].javaNm + ">\");\n");
+ writer.write(
+ check4null
+ ? "\t\tif(this." + attribs[i].javaNm + "!=null){\n"
+ : "");
+ writer.write(
+ "\t\t\tcontext.writeSafeString(java.lang.String.valueOf("
+ + attribs[i].javaNm
+ + "));\n");
+
+ } else if (attribs[i].javaType.endsWith("[]") && !"byte[]".equals(attribs[i].javaType)){
+ //for array type
+ QName arrayType = attribs[i].xmlType;
+ String arrTypeAdditionalString =
+ " xsi:type=\\\"soapenc:Array\\\" soapenc:arrayType=\\\"ns2:"
+ + arrayType.getLocalPart()
+ + "[]\\\" xmlns:ns2 = \\\""
+ + arrayType.getNamespaceURI()
+ + "\\\"";
+ writer.write(
+ "\t\tcontext.writeString(\"<"
+ + attribs[i].javaNm
+ + arrTypeAdditionalString
+ + ">\");\n");
+ writer.write(
+ check4null
+ ? "\t\tif(this." + attribs[i].javaNm + "!=null){\n"
+ : "");
+ writer.write("\t\t\tcontext.writeString(\"\\n\");\n");
+ writer.write("\t\t\t"
+ + attribs[i].wrapName+ " item" + i
+ + " = new " + attribs[i].wrapName + "();\n");
+ writer.write(
+ "\t\t\titem" + i + ".setParam(" + attribs[i].javaNm + ");\n");
+ writer.write("\t\t\titem" + i + ".serialize(context);\n");
+ } else {
+ //for complex type
+ writer.write(
+ "\t\tcontext.writeString(\"<" + attribs[i].javaNm + ">\");\n");
+ writer.write(
+ check4null
+ ? "\t\tif(this." + attribs[i].javaNm + "!=null){\n"
+ : "");
+ writer.write("\t\t\t" + attribs[i].javaNm + ".serialize(context);\n");
+ }
+ writer.write(check4null ? "\t\t}\n" : "");
+ writer.write(
+ "\t\tcontext.writeString(\"</" + attribs[i].javaNm + ">\\n\");\n\n");
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new WrapperFault(e);
+ }
+ }
+
+ public void writeSerialieCode1() 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\tjava.lang.String m_URI =\"" + type.getName().getNamespaceURI() + "\";\n");
+ writer.write(
+ "\t\tjava.lang.String type_name = \"" + type.getName().getLocalPart() + "\";\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].javaType);
if (TypeMap.isSimpleType(attribs[i].javaType)) {
//for simple type
writer.write(
- "\t\tcontext.startTag(\"" + attribs[i].javaNm + "\",null);\n");
-
+ "\t\tcontext.writeString(\"<" + attribs[i].javaNm + ">\");\n");
writer.write(
check4null
? "\t\tif(this." + attribs[i].javaNm + "!=null){\n"
@@ -130,10 +211,10 @@
+ arrayType.getNamespaceURI()
+ "\\\"";
writer.write(
- "\t\tcontext.startTag(\""
- + attribs[i].javaNm +"\"" + "," +"\""
+ "\t\tcontext.writeString(\"<"
+ + attribs[i].javaNm
+ arrTypeAdditionalString
- + "\");\n");
+ + ">\");\n");
writer.write(
check4null
? "\t\tif(this." + attribs[i].javaNm + "!=null){\n"
@@ -148,7 +229,7 @@
} else {
//for complex type
writer.write(
- "\t\tcontext.startTag(\"" + attribs[i].javaNm + "\",null);\n");
+ "\t\tcontext.writeString(\"<" + attribs[i].javaNm + ">\");\n");
writer.write(
check4null
? "\t\tif(this." + attribs[i].javaNm + "!=null){\n"
@@ -157,7 +238,7 @@
}
writer.write(check4null ? "\t\t}\n" : "");
writer.write(
- "\t\tcontext.endTag();\n\n");
+ "\t\tcontext.writeString(\"</" + attribs[i].javaNm + ">\\n\");\n\n");
}
} catch (IOException e) {
@@ -165,6 +246,7 @@
throw new WrapperFault(e);
}
}
+
public String capitalizeFirstCaractor(String value) {
char[] chars = value.toCharArray();
1.7 +27 -3 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/java/ArrayParamWriter.java
Index: ArrayParamWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/java/ArrayParamWriter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ArrayParamWriter.java 27 Jan 2004 05:55:46 -0000 1.6
+++ ArrayParamWriter.java 19 Feb 2004 12:39:02 -0000 1.7
@@ -173,11 +173,12 @@
public void writeSerialieCode() throws WrapperFault {
try {
+ writer.write("\t\tif(param == null)\n\t\t\treturn;\n");
writer.write("\t\tfor (int i = 0; i < param.length; i++) {\n");
writer.write(
- "\t\t\tcontext.startTag(\"item\"+i,\""
+ "\t\t\tcontext.writeString(\"<item\"+i+ \" "
+ org.apache.axismora.wsdl2ws.WrapperUtils.getParamTypeString(qname)
- + "\");\n");
+ + ">\");\n");
writer.write(
JavaUtils.isJavaSimpleType(arrtype) ? "" : "\t\t\tif(param[i]!=null){\n");
if (!org.apache.axismora.wsdl2ws.info.TypeMap.isSimpleType(arrtype)) {
@@ -185,11 +186,34 @@
} else
writer.write("\t\t\t\tcontext.writeSafeString(java.lang.String.valueOf(param[i]));\n");
writer.write(JavaUtils.isJavaSimpleType(arrtype) ? "" : "\t\t\t}\n");
- writer.write("\t\t\tcontext.endTag();\n\t\t}\n");
+ writer.write("\t\t\tcontext.writeString(\"</item\"+i+ \">\");\n\t\t}\n");
} catch (IOException e) {
e.printStackTrace();
throw new WrapperFault(e);
}
}
+
+ public void writeSerialieCode1() throws WrapperFault {
+ try {
+
+ writer.write("\t\tfor (int i = 0; i < param.length; i++) {\n");
+ writer.write(
+ "\t\t\tcontext.writeString(\"<item\"+i+ \" "
+ + org.apache.axismora.wsdl2ws.WrapperUtils.getParamTypeString(qname)
+ + ">\");\n");
+ writer.write(
+ JavaUtils.isJavaSimpleType(arrtype) ? "" : "\t\t\tif(param[i]!=null){\n");
+ if (!org.apache.axismora.wsdl2ws.info.TypeMap.isSimpleType(arrtype)) {
+ writer.write("\t\t\t\tparam[i].serialize(context);\n");
+ } else
+ writer.write("\t\t\t\tcontext.writeSafeString(java.lang.String.valueOf(param[i]));\n");
+ writer.write(JavaUtils.isJavaSimpleType(arrtype) ? "" : "\t\t\t}\n");
+ writer.write("\t\t\tcontext.writeString(\"</item\"+i+ \">\");\n\t\t}\n");
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new WrapperFault(e);
+ }
+ }
+
}
1.2 +1 -1 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/java/DeploymentWriter.java
Index: DeploymentWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/java/DeploymentWriter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeploymentWriter.java 10 Oct 2003 01:56:03 -0000 1.1
+++ DeploymentWriter.java 19 Feb 2004 12:39:02 -0000 1.2
@@ -105,7 +105,7 @@
writer.write(
"<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\" xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">\n");
writer.write(
- "\t<service name==\"" + servicename + "\" provider=\"java:RPC\">\n");
+ "\t<service name=\"" + servicename + "\" provider=\"java:RPC\">\n");
writer.write("\t\t<parameter name=\"allowedMethods\" value=\"*\"/>\n");
writer.write(
"\t\t<parameter name=\"className\" value=\" " + servcieclass + "\"/>\n");
1.3 +11 -9 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/testing/RPCTestCaseWriter.java
Index: RPCTestCaseWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/testing/RPCTestCaseWriter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RPCTestCaseWriter.java 27 Jan 2004 05:55:46 -0000 1.2
+++ RPCTestCaseWriter.java 19 Feb 2004 12:39:02 -0000 1.3
@@ -118,7 +118,9 @@
//writer.write("\t}\n");
writer.write("\n\tpublic " + classname + "()" + "{\n");
- writer.write("\n\t\tstub = (new HeavyTestLocator(enduri)).getStub();\n");
writer.write("\t}\n");
+ writer.write("\n\t\tstub = (new "+
+ wscontext.getSerInfo().getQualifiedServiceName()
+ +"Locator(enduri)).getStub();\n");
writer.write("\t}\n");
} catch (Exception e) {
e.printStackTrace();
throw new WrapperFault(e);
@@ -165,7 +167,7 @@
Vector params = new Vector(minfo.getParameterTypes());
for (int j = 0; j <params.size(); j++){
- ParameterInfo parm = (ParameterInfo)params.get(0);
+ ParameterInfo parm = (ParameterInfo)params.get(j);
t = parm.getType();
if(t.isArray()){
@@ -182,7 +184,7 @@
writer.write("\t\taparam"+ var +".init();\n");
}else{
writer.write("\t\t"+wrappername + " atparam"+ var +" = new "+ wrappername + "();\n");
- writer.write("\t\tatparam"+ var +".init();");
+ writer.write("\t\tatparam"+ var +".init();\n");
writer.write("\t\t"+javaType + " aparam"+ var +" = atparam.getParam();\n");
}
@@ -201,18 +203,18 @@
String javaType = t.getLanguageSpecificName();
String wrappername = TypeMap.getWrapperCalssNameForJavaClass(javaType);
if(javaType.equals(wrappername)){
- writer.write("\t\t"+javaType + " param"+j+" = new "+ javaType + "()\n");
+ writer.write("\t\t"+javaType + " param"+j+" = new "+ javaType + "();\n");
writer.write("\t\tparam"+j+".init();\n");
}else{
- writer.write(wrappername + " tparam"+j+" = new "+ wrappername + "();\n");
- writer.write("\t\ttparam"+j+".init();");
- writer.write("\t\t"+javaType + " param"+j+" = tparam.getParam();\n");
+ writer.write("\t\t"+wrappername + " tparam"+j+" = new "+ wrappername + "();\n");
+ writer.write("\t\ttparam"+j+".init();\n");
+ writer.write("\t\t"+javaType + " param"+j+" = tparam"+j+".getParam();\n");
}
}
}
writer.write("\t\t");
if(!"void".equals(outparam))
- writer.write(outparam + "returnVal = ");
+ writer.write(outparam + " returnVal = ");
writer.write("stub."+minfo.getMethodname() +"(");
if(params.size()>0){
writer.write("param0");
@@ -220,7 +222,7 @@
for (int j = 1; j<params.size(); j++)
writer.write(",param"+j);
writer.write(");\n");
- writer.write("\tSystem.out.println(\"test"+minfo.getMethodname()+" passes\");");
+ writer.write("\tSystem.out.println(\"test"+minfo.getMethodname()+" passes\");\n");
writer.write("\t}\n");
}
} catch (Exception e) {
1.3 +1 -1 ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/testing/TestUtils.java
Index: TestUtils.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/wsdl2ws/testing/TestUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestUtils.java 27 Jan 2004 05:55:46 -0000 1.2
+++ TestUtils.java 19 Feb 2004 12:39:03 -0000 1.3
@@ -7,7 +7,7 @@
* @author Srinath Perera(hemapani@opensource.lk)
*/
public class TestUtils {
- public static String ENDPOINT_URI = "http://127.0.0.1:8080/axismora/servlet/AxisServlet";
+ public static String ENDPOINT_URI = "http://127.0.0.1:5555/axismora/servlet/AxisServlet";
private static Random rand = new Random();
private HashMap initializeMap = new HashMap();
1.9 +5 -15 ws-axis/contrib/axismora/src/org/apache/axismora/encoding/DesirializationContext.java
Index: DesirializationContext.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/encoding/DesirializationContext.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DesirializationContext.java 27 Jan 2004 05:55:46 -0000 1.8
+++ DesirializationContext.java 19 Feb 2004 12:39:03 -0000 1.9
@@ -126,6 +126,7 @@
if(PerfLog.LOG_PERF){
PerfLog.recored(System.currentTimeMillis(),"MID_POINT");
}
+ log.info("preparing desirialization context");
//get the common document
this.doc = AxisUtils.getCommonDomDocument();
@@ -139,7 +140,7 @@
if(PerfLog.LOG_PERF){
PerfLog.recored(System.currentTimeMillis(),"MID_POINT5");
}
-
+ log.info("creating pull parser");
XmlPullParserFactory factory =
XmlPullParserFactory.newInstance(
System.getProperty(XmlPullParserFactory.PROPERTY_NAME),
@@ -149,29 +150,18 @@
factory.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
this.xpp = factory.newPullParser();
xpp.setInput(in);
+ log.info("creating axis pull parser");
this.axispullparser = new AxisPullParser(this.xpp);
if(PerfLog.LOG_PERF){
PerfLog.recored(System.currentTimeMillis(),"MID_POINT2");
}
- } catch (FactoryConfigurationError e) {
- log.error(e);
- e.printStackTrace();
- throw AxisUtils.getTheAixsFault(
- org.apache.axis.Constants.FAULT_SOAP12_RECEIVER,
- e.getMessage(),null,null,e);
- } catch (ParserConfigurationException e) {
- log.error(e);
- e.printStackTrace();
- throw AxisUtils.getTheAixsFault(
- org.apache.axis.Constants.FAULT_SOAP12_RECEIVER,
- e.getMessage(),null,null,e);
- } catch (XmlPullParserException e) {
+ } catch (Exception e) {
log.error(e);
e.printStackTrace();
throw AxisUtils.getTheAixsFault(
org.apache.axis.Constants.FAULT_SOAP12_RECEIVER,
e.getMessage(),null,null,e);
- }
+ }
}
// this constructor is written for the sole purpose of unit testing.
1.2 +9 -11 ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/DocLiteralSerializer.java
Index: DocLiteralSerializer.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/DocLiteralSerializer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DocLiteralSerializer.java 2 Jan 2004 08:34:12 -0000 1.1
+++ DocLiteralSerializer.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -7,8 +7,6 @@
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.
@@ -28,11 +26,11 @@
/**
* this method is called by the SOAPHeaderElement when serializing
*/
- public void serialize(SerializationContext sc) throws IOException {
+ public void serialize(org.apache.axis.encoding.SerializationContext sc) throws IOException {
- if(parm != null){
- //writing start tag
- StringBuffer buf = new StringBuffer();
+ if(parm != null){
+ //writing start tag
+ StringBuffer buf = new StringBuffer();
String uri = eleQName.getNamespaceURI();
if (uri != null && !("".equals(uri))) {
buf.append("<pre:").append(this.eleQName.getLocalPart());
@@ -40,13 +38,13 @@
buf.append("\">\n");
} else {
buf.append("<").append(this.eleQName.getLocalPart());
- buf.append(">\n");
+ buf.append(">\n");
}
sc.writeString(buf.toString());
- parm.serialize(sc);
+ parm.serialize(sc);
- //writing end tag
- buf = new StringBuffer();
+ //writing end tag
+ buf = new StringBuffer();
if (uri != null && !("".equals(uri))) {
buf.append("\n</pre:").append(this.eleQName.getLocalPart());
buf.append(">\n");
@@ -54,7 +52,7 @@
buf.append("\n</").append(this.eleQName.getLocalPart());
buf.append(">\n");
}
- sc.writeString(buf.toString());
+ sc.writeString(buf.toString());
} else System.out.println("DEBUG - The param is null");
}
1.4 +1 -3 ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/RPCResult.java
Index: RPCResult.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/RPCResult.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RPCResult.java 15 Dec 2003 03:22:25 -0000 1.3
+++ RPCResult.java 19 Feb 2004 12:39:03 -0000 1.4
@@ -63,8 +63,6 @@
import org.apache.axismora.encoding.Serializable;
import org.apache.axismora.soap.BasicMessageContext;
-import org.apache.axis.encoding.SerializationContext;
-
/**
* This calss is used for the represents the RPC style result
* @author Srianth Perera (hemapani@opensource.lk)
@@ -84,7 +82,7 @@
/**
* this method is called by the SOAPHeaderElement when serializing
*/
- public void serialize(SerializationContext sc) throws IOException {
+ public void serialize(org.apache.axis.encoding.SerializationContext sc) throws IOException {
StringBuffer buf = new StringBuffer();
if (parm != null) {
if (method != null) {
1.2 +2 -4 ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/MSGResult.java
Index: MSGResult.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/MSGResult.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MSGResult.java 10 Oct 2003 01:55:54 -0000 1.1
+++ MSGResult.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -57,10 +57,8 @@
import java.io.IOException;
-import org.apache.axismora.encoding.Serializable;
-
import org.apache.axis.components.logger.LogFactory;
-import org.apache.axis.encoding.SerializationContext;
+import org.apache.axismora.encoding.Serializable;
import org.apache.commons.logging.Log;
import org.w3c.dom.Element;
@@ -79,7 +77,7 @@
/**
* this method is called by the SOAPHeaderElement when serializing
*/
- public void serialize(SerializationContext sc) throws IOException {
+ public void serialize(org.apache.axis.encoding.SerializationContext sc) throws IOException {
for (int i = 0; i < msgResult.length; i++) {
sc.writeDOMElement(msgResult[i]);
}
1.2 +1 -3 ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/HandlerResetResult.java
Index: HandlerResetResult.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/provider/result/HandlerResetResult.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HandlerResetResult.java 10 Oct 2003 01:55:54 -0000 1.1
+++ HandlerResetResult.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -59,8 +59,6 @@
import org.apache.axismora.encoding.Serializable;
-import org.apache.axis.encoding.SerializationContext;
-
/**
* This calss is use to reset the result back to the SOAP body at the response Handlers
* @author Srinath Perera(hemapani@opensource.lk)
@@ -75,7 +73,7 @@
/**
* this method is called by the SOAPHeaderElement when serializing
*/
- public void serialize(SerializationContext sc) throws IOException {
+ public void serialize(org.apache.axis.encoding.SerializationContext sc) throws IOException {
sc.writeString(bodyContent);
}
}
1.4 +1 -1 ws-axis/contrib/axismora/src/org/apache/axismora/wrappers/simpleType/StringParam.java
Index: StringParam.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/wrappers/simpleType/StringParam.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StringParam.java 13 Jan 2004 10:24:22 -0000 1.3
+++ StringParam.java 19 Feb 2004 12:39:03 -0000 1.4
@@ -102,7 +102,7 @@
// buf.append(param);
// buf.append("</String>\n");
try {
- context.writeString(param);
+ context.writeSafeString(param);
} catch (IOException e) {
e.printStackTrace(); //ioexception
}
1.4 +1 -1 ws-axis/contrib/axismora/src/org/apache/axismora/wrappers/simpleType/IntParam.java
Index: IntParam.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/wrappers/simpleType/IntParam.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- IntParam.java 13 Jan 2004 12:14:12 -0000 1.3
+++ IntParam.java 19 Feb 2004 12:39:03 -0000 1.4
@@ -88,7 +88,7 @@
throws AxisFault {
String value = msgdata.nextText();
if (value != null)
- this.param = Integer.parseInt(value);
+ this.param = Integer.parseInt(value.trim());
return this;
}
1.5 +119 -107 ws-axis/contrib/axismora/src/org/apache/axismora/engine/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/engine/AxisEngine.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AxisEngine.java 27 Jan 2004 05:55:46 -0000 1.4
+++ AxisEngine.java 19 Feb 2004 12:39:03 -0000 1.5
@@ -57,7 +57,9 @@
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
@@ -83,9 +85,11 @@
import org.apache.axismora.soap.SOAPNodeInfo;
import org.apache.axismora.util.AxisUtils;
import org.apache.axismora.util.PerfLog;
+import org.apache.axismora.util.SingeltonException;
import org.apache.axis.AxisFault;
import org.apache.axis.components.logger.LogFactory;
+import org.apache.axis.deployment.wsdd.WSDDException;
import org.apache.axis.deployment.wsdd.WSDDService;
import org.apache.axis.encoding.SerializationContextImpl;
import org.apache.axis.message.SOAPEnvelope;
@@ -119,90 +123,93 @@
}
public AxisEngine(String filename,ServletContext servletcontext) throws Exception {
- this.servletcontext = servletcontext;
- log.info("Axis Engine initializing");
-
-
- File file = null;
-
- // the logic is borrowed from
- // org.apache.axis.configuration.EngineConfigurationFactoryServlet
- // LOGIC of the method
- // if(servlet)
- // load file using servlet context
- // else
- // load the file from .
- // if(file not exists)
- // create file
- //load the WSDDDeployment
-
- if(servletcontext != null){
- //The accsess is from the servlet try to get it from the WEB-INF
- String appWebInfPath = "/WEB-INF";
- String realWebInfPath = servletcontext.getRealPath(appWebInfPath);
-
- if (realWebInfPath != null)
- file = new File(realWebInfPath, filename);
- if(file == null || !file.exists()){
- /**
- * If path/file doesn't exist, it may still be accessible
- * as a resource-stream (i.e. it may be packaged in a JAR
- * or WAR file).
- */
- //String name = appWebInfPath + "/" + filename;
- //InputStream is = servletcontext.getResourceAsStream(name);
-
- //but the WSDDDeploymet accept only String in inputstreams ):
- //SO above code is TODO ... we will not support the file inside
- //JAR or WAR yet.
- file = new File(filename);
- }else{
- System.out.println(realWebInfPath +" is null");
- }
-
- }else
- //no servlets, try where u are.
- file = new File(filename);
-
-
-
-
- //if a configaration file does not exists create a file
- if (!file.exists()) {
- file.createNewFile();
- PrintWriter w = new PrintWriter(new FileOutputStream(file));
- BufferedReader re =
- new BufferedReader(
- new InputStreamReader(
- this.getClass().getClassLoader().getResourceAsStream(
- (Constants.CLIENT_CONFIG_FILE.equals(filename)
- ? "org/apache/axismora/client/"
- : "org/apache/axismora/server/")
- + filename)));
- String line;
- while ((line = re.readLine()) != null) {
- w.write(line + "\n");
+ try {
+ this.servletcontext = servletcontext;
+ log.info("Axis Engine initializing");
+ File file = null;
+
+ // the logic is borrowed from
+ // org.apache.axis.configuration.EngineConfigurationFactoryServlet
+ // LOGIC of the method
+ // if(servlet)
+ // load file using servlet context
+ // else
+ // load the file from .
+ // if(file not exists)
+ // create file
+ //load the WSDDDeployment
+
+ if(servletcontext != null){
+ //The accsess is from the servlet try to get it from the WEB-INF
+ String appWebInfPath = "/WEB-INF";
+ String realWebInfPath = servletcontext.getRealPath(appWebInfPath);
+
+ if (realWebInfPath != null)
+ file = new File(realWebInfPath, filename);
+ if(file == null || !file.exists()){
+ /**
+ * If path/file doesn't exist, it may still be accessible
+ * as a resource-stream (i.e. it may be packaged in a JAR
+ * or WAR file).
+ */
+ //String name = appWebInfPath + "/" + filename;
+ //InputStream is = servletcontext.getResourceAsStream(name);
+
+ //but the WSDDDeploymet accept only String in inputstreams ):
+ //SO above code is TODO ... we will not support the file inside
+ //JAR or WAR yet.
+ file = new File(filename);
+ }else{
+ System.out.println(realWebInfPath +" is null");
+ }
+
+ }else
+ //no servlets, try where u are.
+ file = new File(filename);
+
+
+
+
+ //if a configaration file does not exists create a file
+ if (!file.exists()) {
+ file.createNewFile();
+ PrintWriter w = new PrintWriter(new FileOutputStream(file));
+ BufferedReader re =
+ new BufferedReader(
+ new InputStreamReader(
+ this.getClass().getClassLoader().getResourceAsStream(
+ (Constants.CLIENT_CONFIG_FILE.equals(filename)
+ ? "org/apache/axismora/client/"
+ : "org/apache/axismora/server/")
+ + filename)));
+ String line;
+ while ((line = re.readLine()) != null) {
+ w.write(line + "\n");
+ }
+ w.flush();
+ w.close();
+ }
+
+ //create the deployment
+ deployment = WSDDDeployment.getInstance(file.getAbsolutePath());
+ pool = BasicHandlerPool.getInstance(deployment);
+ servicepool = new SimpleServicePool();
+ //initialize the handler pool
+ pool.init();
+ if (deployment == null) {
+ log.fatal("Can't continue make sure the server-config.wsdd is wellformed and exist");
+ throw AxisUtils.getTheAixsFault(
+ org.apache.axis.Constants.FAULT_SOAP12_RECEIVER,
+ "Internal Server Error : configaration fails",
+ deployment,
+ this.getName(),
+ null);
+ //we cant continue
}
- w.flush();
- w.close();
- }
-
- //create the deployment
- deployment = WSDDDeployment.getInstance(file.getAbsolutePath());
- pool = BasicHandlerPool.getInstance(deployment);
- servicepool = new SimpleServicePool();
- //initialize the handler pool
- pool.init();
- if (deployment == null) {
- log.fatal("Can't continue make sure the server-config.wsdd is wellformed and exist");
- throw AxisUtils.getTheAixsFault(
- org.apache.axis.Constants.FAULT_SOAP12_RECEIVER,
- "Internal Server Error : configaration fails",
- deployment,
- this.getName(),
- null);
- //we cant continue
- }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
}
public String getName() {
@@ -223,27 +230,29 @@
String usrname,
char[] passwd,
String encoding) {
-
- log.info("start processing service " + SOAPAction);
+ MessageContext data = null;
+ try {
+ log.info("start processing service " + SOAPAction);
- if(PerfLog.LOG_PERF){
- PerfLog.recored(System.currentTimeMillis(),"START");
- }
+ if(PerfLog.LOG_PERF){
+ PerfLog.recored(System.currentTimeMillis(),"START");
+ }
- // supporting both method name - Dimuthu.
- String methodName = "";
- String serviceName = "";
-
- int index = SOAPAction.indexOf('$');
- if(index==-1){
- serviceName=SOAPAction.trim();
- }else{
- serviceName=SOAPAction.substring(0,index).trim();
- methodName=SOAPAction.substring(index+1).trim();
- }
-
- MessageContext data = null;
- try {
+ // supporting both method name - Dimuthu.
+ String methodName = "";
+ String serviceName = "";
+
+ int index = SOAPAction.indexOf('$');
+ if(index==-1){
+ serviceName=SOAPAction.trim();
+ }else{
+ serviceName=SOAPAction.substring(0,index).trim();
+ methodName=SOAPAction.substring(index+1).trim();
+ }
+
+ log.info("loading handlers");
+
+
WSDDService service = deployment.getService(new QName(serviceName));
handlers = new Handler[7];
/**
@@ -262,6 +271,7 @@
/**
* get the handler Information and create a SOAPNodeInfo
*/
+ log.info("loading soap node information");
SOAPNodeInfo nodeinfo = new SOAPNodeInfo(deployment);
ArrayList roles = new ArrayList();
ArrayList headers = new ArrayList();
@@ -286,19 +296,20 @@
if(PerfLog.LOG_PERF){
PerfLog.recored(System.currentTimeMillis(),"START_INIT_DONE");
}
-
+ log.info("initializing done");
/**
* Initalize the MessageData
*/
data =
new BasicMessageContext(in, out, nodeinfo,
service, servicepool, session, encoding);
-
+ log.info("message context created");
+
if(!methodName.equals("")){
data.setMethodName(new QName(serviceName,methodName));
}
-
+ log.info("loading provider");
//load the provider
org.apache.axismora.provider.Provider provider
= ProviderFactory.getProvider(data);
@@ -306,8 +317,9 @@
if(PerfLog.LOG_PERF){
PerfLog.recored(System.currentTimeMillis(),"START_PARSING");
+ System.out.println(System.currentTimeMillis()+"START_PARSING");
}
-
+ log.info("start parsing");
data.parseAndValidateKnownTags();
//set http user detail
data.setUser(usrname);
@@ -355,6 +367,7 @@
pool.returnGlobelResponseFlowHandlers((HandlerChain) handlers[5]);
pool.returnTransportResponseFlowHandlers(Constants.HTTP, (HandlerChain) handlers[6]);
} catch (Exception e) {
+ e.printStackTrace();
log.error(e.getMessage(), e);
QName faultCode = org.apache.axis.Constants.FAULT_SOAP12_RECEIVER;
String message = e.getMessage();
@@ -378,7 +391,6 @@
log.info("MessageContext is null sending error");
sentTheSOAPFaultWhenMSGDataIsNull(e, out, faultCode);
}
- e.printStackTrace();
} finally {
//code to write the result to the out put using out.
try {
1.2 +5 -30 ws-axis/contrib/axismora/src/org/apache/axismora/encoding/ser/SerializationContext.java
Index: SerializationContext.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/encoding/ser/SerializationContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SerializationContext.java 27 Jan 2004 05:55:46 -0000 1.1
+++ SerializationContext.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -56,6 +56,7 @@
package org.apache.axismora.encoding.ser;
import java.io.IOException;
+import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Stack;
@@ -93,8 +94,7 @@
private final byte[] WSB = " ".getBytes();
private EnhancedWriter writer;
- private StringBuffer nameSapceBuffer = new StringBuffer();
- private boolean addNameSpace = false;
+
private HashMap namespaces = new NSmap();
private Stack sedStack = new Stack();
@@ -102,7 +102,6 @@
private StartElementData sed;
private ByteArrayStack stack = new ByteArrayStack();
-
/**
* @param writer
*/
@@ -205,33 +204,9 @@
writer.write(GTB);
}
-// /**
-// * use this if you can manage attributes but to parser to manage the elements Namesapces
-// */
-// public void startTag(String uri,String localName,String attributes)throws IOException{
-// if(uri == null ||"".equals(uri)){
-// if(attributes == null){
-// byte[] prefixedB = localName.getBytes();
-// writer.write(LTB);
-// writer.write(prefixedB);
-// writer.write(GTB);
-// stack.push(prefixedB);
-// }else{
-// byte[] prefixedB = localName.getBytes();
-// writer.write(LTB);
-// writer.write(prefixedB);
-// writer.write(WSB);
-// writer.write(attributes);
-//
-// writer.write(GTB);
-// stack.push(prefixedB);
-// }
-// }
-// }
-
- /**
- * use this if user can managed the all the prefixses
- */
+ /* (non-Javadoc)
+ * @see org.apache.axis.encoding.SerializationContext#startTag(java.lang.String, java.lang.String)
+ */
public void startTag(String prefixedName, String additional) throws IOException {
byte[] prefixedB = prefixedName.getBytes();
writer.write(LTB);
1.2 +1 -5 ws-axis/contrib/axismora/src/org/apache/axismora/encoding/ser/NSmap.java
Index: NSmap.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/encoding/ser/NSmap.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NSmap.java 27 Jan 2004 05:55:46 -0000 1.1
+++ NSmap.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -61,9 +61,6 @@
import org.apache.axismora.util.UtilityPool;
/**
- * This Map is a Hash map which can hold multiple values.
- * The request for the get() and remove() will work on the first
- * ocurance they found.
* @author Srinath Perera(hemapani@opensource.lk)
*/
@@ -76,7 +73,7 @@
Object obj = super.get(key);
if(obj instanceof ArrayList){
ArrayList list = ((ArrayList)obj);
- return list.get(list.size()-1);
+ return list.get(0);
}
return obj;
}
@@ -108,6 +105,5 @@
}
return super.remove(key);
}
-
}
1.2 +77 -66 ws-axis/contrib/axismora/src/org/apache/axismora/encoding/ser/EnhancedWriter.java
Index: EnhancedWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/encoding/ser/EnhancedWriter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EnhancedWriter.java 27 Jan 2004 05:55:46 -0000 1.1
+++ EnhancedWriter.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -55,6 +55,7 @@
package org.apache.axismora.encoding.ser;
+import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
@@ -66,18 +67,18 @@
*/
public class EnhancedWriter extends Writer{
private static final int BUF_LENGHTH = 8*1024;
- private OutputStream writer;
- private byte[] buffer = new byte[BUF_LENGHTH];
- private int index = 0; //index the position next byte to be written
+ private BufferedOutputStream writer;
+// private byte[] buffer = new byte[BUF_LENGHTH];
+// private int index = 0; //index the position next byte to be written
- public EnhancedWriter(OutputStream writer){
+ public EnhancedWriter(BufferedOutputStream writer){
this.writer = writer;
}
public void close() throws IOException {
- writer.write(buffer,0,index);
+// writer.write(buffer,0,index);
writer.close();
}
@@ -85,9 +86,9 @@
* @see java.io.Writer#flush()
*/
public void flush() throws IOException {
- writer.write(buffer,0,index);
+// writer.write(buffer,0,index);
writer.flush();
- index = 0;
+// index = 0;
}
/* (non-Javadoc)
@@ -95,53 +96,57 @@
*/
public void write(char[] cbuf, int off, int len) throws IOException {
byte[] bval = String.valueOf(cbuf,off,len).getBytes();
- int length = bval.length;
- for(int j = 0;j<length;j++){
- buffer[index] = bval[j];
- index++;
- if(index == BUF_LENGHTH){
- writer.write(buffer);
- index = 0;
- }
- }
+// int length = bval.length;
+// for(int j = 0;j<length;j++){
+// buffer[index] = bval[j];
+// index++;
+// if(index == BUF_LENGHTH){
+// writer.write(buffer);
+// index = 0;
+// }
+// }
+ writer.write(bval);
}
public void write(byte[] subBuf, int off, int len) throws IOException {
- int subBufLen = len;
- if(subBufLen + index < BUF_LENGHTH){
- System.arraycopy(subBuf, off,buffer,index ,subBufLen) ;
- index = index + subBufLen;
- }else{
- //add one as the index is not written
- int towrite = BUF_LENGHTH - index;
- //copy till the buffer fill
- System.arraycopy(subBuf, off,buffer,index ,towrite) ;
- //write the buffer
- writer.write(buffer);
- //write the what is left
- int lefttowrite = subBufLen - towrite;
- System.arraycopy(subBuf, towrite,buffer,0,lefttowrite) ;
- index = lefttowrite;
- }
+// int subBufLen = len;
+// if(subBufLen + index < BUF_LENGHTH){
+// System.arraycopy(subBuf, off,buffer,index ,subBufLen) ;
+// index = index + subBufLen;
+// }else{
+// //add one as the index is not written
+// int towrite = BUF_LENGHTH - index;
+// //copy till the buffer fill
+// System.arraycopy(subBuf, off,buffer,index ,towrite) ;
+// //write the buffer
+// writer.write(buffer);
+// //write the what is left
+// int lefttowrite = subBufLen - towrite;
+// System.arraycopy(subBuf, towrite,buffer,0,lefttowrite) ;
+// index = lefttowrite;
+
+// }
+ writer.write(subBuf,off,len);
}
public void write(byte[] subBuf) throws IOException {
- int subBufLen = subBuf.length;
- if(subBufLen + index < BUF_LENGHTH){
- System.arraycopy(subBuf, 0,buffer,index ,subBufLen) ;
- index = index + subBufLen;
- }else{
- //add one as the index is not written
- int towrite = BUF_LENGHTH - index;
- //copy till the buffer fill
- System.arraycopy(subBuf, 0,buffer,index ,towrite) ;
- //write the buffer
- writer.write(buffer);
- //write the what is left
- int lefttowrite = subBufLen - towrite;
- System.arraycopy(subBuf, towrite,buffer,0,lefttowrite) ;
- index = lefttowrite;
- }
+// int subBufLen = subBuf.length;
+// if(subBufLen + index < BUF_LENGHTH){
+// System.arraycopy(subBuf, 0,buffer,index ,subBufLen) ;
+// index = index + subBufLen;
+// }else{
+// //add one as the index is not written
+// int towrite = BUF_LENGHTH - index;
+// //copy till the buffer fill
+// System.arraycopy(subBuf, 0,buffer,index ,towrite) ;
+// //write the buffer
+// writer.write(buffer);
+// //write the what is left
+// int lefttowrite = subBufLen - towrite;
+// System.arraycopy(subBuf, towrite,buffer,0,lefttowrite) ;
+// index = lefttowrite;
+// }
+ writer.write(subBuf);
}
@@ -157,8 +162,9 @@
* @see java.io.Writer#write(int)
*/
public void write(int c) throws IOException {
- buffer[index] = (byte)c;
- index++;
+// buffer[index] = (byte)c;
+// index++;
+ writer.write((byte)c);
}
/**
@@ -175,22 +181,27 @@
*/
public void write(String str) throws IOException {
byte[] subBuf = str.getBytes();
- int subBufLen = subBuf.length;
- if(subBufLen + index < BUF_LENGHTH){
- System.arraycopy(subBuf, 0,buffer,index ,subBufLen) ;
- index = index + subBufLen;
- }else{
- //add one as the index is not written
- int towrite = BUF_LENGHTH - index;
- //copy till the buffer fill
- System.arraycopy(subBuf, 0,buffer,index ,towrite) ;
- //write the buffer
- writer.write(buffer);
- //write the what is left
- int lefttowrite = subBufLen - towrite;
- System.arraycopy(subBuf, towrite,buffer,0,lefttowrite) ;
- index = lefttowrite;
- }
+// int subBufLen = subBuf.length;
+// if(subBufLen + index < BUF_LENGHTH){
+// System.arraycopy(subBuf, 0,buffer,index ,subBufLen) ;
+// index = index + subBufLen;
+// }else{
+// //add one as the index is not written
+// int towrite = BUF_LENGHTH - index;
+// //copy till the buffer fill
+// System.out.println(index + " + " + towrite + " = "+BUF_LENGHTH);
+// System.arraycopy(subBuf, 0,buffer,index ,towrite) ;
+// //write the buffer
+// writer.write(buffer);
+// //write the what is left
+// int lefttowrite = subBufLen - towrite;
+// System.arraycopy(subBuf, towrite,buffer,0,lefttowrite) ;
+// index = lefttowrite;
+// writer.write(buffer,0,index);
+// writer.write(subBuf,0,subBufLen);
+// index = 0;
+// }
+ writer.write(subBuf);
}
}
1.2 +1 -2 ws-axis/contrib/axismora/src/org/apache/axismora/util/ByteArrayStack.java
Index: ByteArrayStack.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/util/ByteArrayStack.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ByteArrayStack.java 27 Jan 2004 05:55:46 -0000 1.1
+++ ByteArrayStack.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -22,14 +22,13 @@
stack = new byte[stack.length + initalSize][];
System.arraycopy(temp, 0,stack,0,temp.length) ;
stack[index] = bytes;
- index ++;
}
public byte[] pop(){
if(index == 0 )
throw new RuntimeException("stack is empty");
- index--;
byte[] ret = stack[index];
+ index++;
return ret;
}
1.2 +17 -17 ws-axis/contrib/axismora/src/org/apache/axismora/util/PerfLog.java
Index: PerfLog.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/util/PerfLog.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PerfLog.java 27 Jan 2004 05:55:46 -0000 1.1
+++ PerfLog.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -64,7 +64,7 @@
*/
public class PerfLog {
- public static boolean LOG_PERF = true;
+ public static boolean LOG_PERF = false;
private static int MAX = 20;
private static long[] readings = new long[MAX];
private static String[] messages = new String[MAX];
@@ -81,23 +81,23 @@
}
public static void print(){
- try {
- PrintWriter w = new PrintWriter(new FileWriter("perf.log",true));
- long full = readings[count -1] - readings[0];
- long reading;
+ try {
+ PrintWriter w = new PrintWriter(new FileWriter("perf.log",true));
+ long full = readings[count -1] - readings[0];
+ long reading;
w.write("------------ it takes "+ full + " -------------------\n");
- for(int i = 1;i<count;i++){
+ for(int i = 1;i<count;i++){
reading = readings[i] - readings[i-1];
- String line = messages[i-1] + " to " + messages[i]+ " = " + reading + "("+(reading*100/full)+"%)";
- System.out.println(line);
- w.write(line+"\n");
- }
- w.write("\n");
- w.close();
- count = 0;
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ String line = messages[i-1] + " to " + messages[i]+ " = " + reading + "("+(reading*100/full)+"%)";
+ System.out.println(line);
+ w.write(line+"\n");
+ }
+ w.write("\n");
+ w.close();
+ count = 0;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
}
1.2 +3 -5 ws-axis/contrib/axismora/src/org/apache/axismora/provider/serializer/DocLiteralSerializer.java
Index: DocLiteralSerializer.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/provider/serializer/DocLiteralSerializer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DocLiteralSerializer.java 15 Dec 2003 11:17:59 -0000 1.1
+++ DocLiteralSerializer.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -7,8 +7,6 @@
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.
@@ -27,9 +25,9 @@
/**
* this method is called by the SOAPHeaderElement when serializing
*/
- public void serialize(SerializationContext sc) throws IOException {
- if(parm != null){
- parm.serialize(sc);
+ public void serialize(org.apache.axis.encoding.SerializationContext sc) throws IOException {
+ if(parm != null){
+ parm.serialize(sc);
} else System.out.println("DEBUG - The param is null");
}
1.9 +30 -41 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- BasicMessageContext.java 27 Jan 2004 05:55:47 -0000 1.8
+++ BasicMessageContext.java 19 Feb 2004 12:39:03 -0000 1.9
@@ -55,9 +55,13 @@
package org.apache.axismora.soap;
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
@@ -187,12 +191,33 @@
/**
* this Constructor is for the sake of testing only
*/
- public BasicMessageContext(){
+ public BasicMessageContext(OutputStream outStream,SOAPNodeInfo nodeinfo,WSDDService service){
this.propertyMap = new Hashtable(PROPERTY_MAP_SIZE);
this.soapHeaderElements = UtilityPool.getVector();
this.createdSoapHeaders = UtilityPool.getVector();
+ this.nodeinfo = nodeinfo;
+ this.service = service;
+ /*
+ initializing the serialization context
+ This is comlpletly borrowed from existing Apache Axis. this drives all the serialization.
+ The implementation uses on the Envelope,Header and the Body of the org.apache.axis.message
+ serializzation of these naturally followed the existing model.
+ */
+ log.info("creating serialization context");
+ if(!org.apache.axismora.Constants.USE_MORA_SERIALIZER){
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outStream));
+ w = new PrintWriter(bw);
+ serializer = new SerializationContextImpl(w);
+ }else{
+ w = new EnhancedWriter(new BufferedOutputStream(outStream));
+ serializer = new org.apache.axismora.encoding.ser.SerializationContext((EnhancedWriter)w);
+ }
+
+
}
+ public BasicMessageContext(){}
+
public BasicMessageContext(
InputStream inStream,
OutputStream outStream,
@@ -202,36 +227,18 @@
Session currentSession,
String streamEncoding)
throws AxisFault {
- this();
+ this(outStream,nodeinfo,service);
this.servicepool = servicepool;
this.currentSession = currentSession;
-
- this.nodeinfo = nodeinfo;
- this.service = service;
- // this.outStream = outStream;
this.streamEncoding = streamEncoding;
- // this.methodName = service.getQName();
this.style = service.getStyle();
//initialize desirialization context - this drives the desiarialization
+ log.info("creating desirialization context");
this.deserializer =
new DesirializationContext(
this,
inStream,
(service != null ? this.service.getStyle() : null));
-// BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outStream));
-// w = new PrintWriter(bw);
- w = new EnhancedWriter(outStream);
- /*
- initializing the serialization context
- This is comlpletly borrowed from existing Apache Axis. this drives all the serialization.
- The implementation uses on the Envelope,Header and the Body of the org.apache.axis.message
- serializzation of these naturally followed the existing model.
- */
- if(!org.apache.axismora.Constants.USE_MORA_SERIALIZER)
- serializer = new SerializationContextImpl(w);
- else
- serializer = new org.apache.axismora.encoding.ser.SerializationContext((EnhancedWriter)w);
-
log.info("MessageContext created.......");
}
@@ -242,34 +249,16 @@
ServicePool servicepool,
ClientRequestContext requestContext)
throws AxisFault {
- this();
+ this(requestContext.getSender().getOut(),nodeinfo,service);
this.servicepool = servicepool;
this.currentSession = null;
-
- this.nodeinfo = nodeinfo;
- this.service = service;
- this.outStream = requestContext.getSender().getOut();
this.streamEncoding = requestContext.getEncoding();
-
+ log.info("creating desirialization context");
this.deserializer =
new DesirializationContext(
this,
requestContext.getSender().getIn(),
requestContext.getStyle());
-
-// BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outStream));
-// w = new PrintWriter(bw);
- w = new EnhancedWriter(outStream);
- /*
- initializing the serialization context
- This is comlpletly borrowed from existing Apache Axis. this drives all the serialization.
- The implementation uses on the Envelope,Header and the Body of the org.apache.axis.message
- serializzation of these naturally followed the existing model.
- */
- if(!org.apache.axismora.Constants.USE_MORA_SERIALIZER)
- serializer = new SerializationContextImpl(w);
- else
- serializer = new org.apache.axismora.encoding.ser.SerializationContext((EnhancedWriter)w);
this.style=requestContext.getStyle();
this.use = requestContext.getUse();
1.2 +32 -9 ws-axis/contrib/axismora/src/org/apache/axismora/server/SimpleAxisServer.java
Index: SimpleAxisServer.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/org/apache/axismora/server/SimpleAxisServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleAxisServer.java 10 Oct 2003 01:55:54 -0000 1.1
+++ SimpleAxisServer.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -61,10 +61,9 @@
import java.net.ServerSocket;
import java.net.Socket;
+import org.apache.axis.components.logger.LogFactory;
import org.apache.axismora.Constants;
import org.apache.axismora.engine.AxisEngine;
-
-import org.apache.axis.components.logger.LogFactory;
import org.apache.commons.logging.Log;
/**
* This is a standalone axis Server, this is not intended for used in havy loads. Under
@@ -82,8 +81,8 @@
private ServerSocket serverSocket;
private AxisEngine engine;
- public SimpleAxisServer(int port) throws Exception {
- this.engine = new AxisEngine(Constants.SERVER_CONFIG_FILE);
+ public SimpleAxisServer(int port,String confFile) throws Exception {
+ this.engine = new AxisEngine(confFile);
serverSocket = null;
try {
serverSocket = new ServerSocket(port);
@@ -152,7 +151,12 @@
while (((inC = in.read()) != -1) && (((char) inC) != '<')) {
if (((char) (inC)) == '\n')
buff = buff.delete(0, buff.length() - 1);
- else if (
+ else if (((char) (inC)) == ':' && "STOP".equals(buff.toString().trim())) {
+ this.out.close();
+ this.in.close();
+ clientSocket.close();
+ stopServer();
+ }else if (
((char) (inC)) == ':' && "SOAPAction".equals(buff.toString().trim())) {
buff = buff.delete(1, buff.length());
while (((inC = in.read()) != -1) && ((char) inC) != '\n') {
@@ -177,18 +181,37 @@
this.out.close();
this.in.close();
clientSocket.close();
- } catch (IOException e) {
+ } catch (IOException e) {
e.printStackTrace();
}
}
}
- protected void stop() throws IOException {
+ public void stopServer() throws IOException {
serverSocket.close();
}
public static void main(String[] args) throws Exception {
- SimpleAxisServer server = new SimpleAxisServer(4444);
- server.start();
+ // SimpleAxisServer server = new SimpleAxisServer(4444);
+ int port = 5555;
+ String confFile = Constants.SERVER_CONFIG_FILE;
+ if(args.length > 0){
+ if("STOP".equals(args[0])){
+ Socket s = new Socket("127.0.0.1",5555);
+ OutputStream out = s.getOutputStream();
+ out.write("STOP".getBytes());
+ out.close();
+ s.close();
+ System.out.println("stoped");
+ return;
+ }
+ port = Integer.parseInt(args[0]);
+ }
+ if(args.length > 1){
+ confFile = args[1];
+ }
+
+ SimpleAxisServer server = new SimpleAxisServer(port,confFile);
+ server.start();
}
}
1.2 +2 -1 ws-axis/contrib/axismora/src/AxisServlet.java
Index: AxisServlet.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/axismora/src/AxisServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AxisServlet.java 10 Oct 2003 01:55:48 -0000 1.1
+++ AxisServlet.java 19 Feb 2004 12:39:03 -0000 1.2
@@ -118,7 +118,7 @@
String soapAction = this.getServiceName(request);
- response.setContentType("text/html");
+ response.setContentType("text/xml");
/**
* Calling the SOAP engine to process the SOAP message
*/
@@ -133,6 +133,7 @@
, null //TODO set encoding from request
);
} catch (Exception e) {
+ e.printStackTrace();
e.printStackTrace(print);
print.flush();
}