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 su...@apache.org on 2004/03/08 06:43:46 UTC
cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info ParameterInfo.java Type.java
susantha 2004/03/07 21:43:46
Modified: c/include/axis/common AxisUserAPI.h
c/samples/client/interoptests/base InteropBaseClient.cpp
InteropTestPortType.cpp InteropTestPortType.h
c/src/wsdl/org/apache/axis/wsdl/wsdl2ws WSDL2Ws.java
c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal
BeanParamWriter.java
c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp
BeanParamWriter.java
c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal
BeanParamWriter.java
c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info
ParameterInfo.java Type.java
Log:
Applying some patches sent by Jean-Yves to WSDL2Ws tool
Revision Changes Path
1.6 +3 -0 ws-axis/c/include/axis/common/AxisUserAPI.h
Index: AxisUserAPI.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/common/AxisUserAPI.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AxisUserAPI.h 28 Jan 2004 12:10:42 -0000 1.5
+++ AxisUserAPI.h 8 Mar 2004 05:43:46 -0000 1.6
@@ -128,4 +128,7 @@
#define AXIS_OUT_PARAM
+static const int xsd_boolean_true = 1;
+static const int xsd_boolean_false = 0;
+
#endif /* !defined(AFX_AXISUSERAPI_H__6E27008D_DCA0_4F28_AC82_FEEBE1A1CBBB__INCLUDED_) */
1.4 +8 -0 ws-axis/c/samples/client/interoptests/base/InteropBaseClient.cpp
Index: InteropBaseClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/interoptests/base/InteropBaseClient.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- InteropBaseClient.cpp 3 Feb 2004 13:04:45 -0000 1.3
+++ InteropBaseClient.cpp 8 Mar 2004 05:43:46 -0000 1.4
@@ -1,5 +1,7 @@
// InteropBaseClient.cpp : Defines the entry point for the console application.
//
+#include <string>
+using namespace std;
#include "InteropTestPortType.h"
@@ -15,6 +17,12 @@
printf("invoking echoString...\n");
//testing echoString
+ string bigstring;
+ for (int ii=0;ii<200;ii++)
+ {
+ bigstring += "hello world ";
+ }
+ printf(ws.echoString(bigstring.c_str()));
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
1.5 +1 -1 ws-axis/c/samples/client/interoptests/base/InteropTestPortType.cpp
Index: InteropTestPortType.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/interoptests/base/InteropTestPortType.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- InteropTestPortType.cpp 3 Feb 2004 14:17:11 -0000 1.4
+++ InteropTestPortType.cpp 8 Mar 2004 05:43:46 -0000 1.5
@@ -32,7 +32,7 @@
/////////////////////////////////////////////////////////////////
// This method wrap the service methodechoString
//////////////////////////////////////////////////////////////////
-AxisChar* InteropTestPortType::echoString(AxisChar* Value0)
+AxisChar* InteropTestPortType::echoString(const AxisChar* Value0)
{
int nStatus;
AxisChar* Ret;
1.3 +1 -1 ws-axis/c/samples/client/interoptests/base/InteropTestPortType.h
Index: InteropTestPortType.h
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/interoptests/base/InteropTestPortType.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InteropTestPortType.h 27 Jan 2004 05:47:03 -0000 1.2
+++ InteropTestPortType.h 8 Mar 2004 05:43:46 -0000 1.3
@@ -22,7 +22,7 @@
public:
virtual ~InteropTestPortType();
public:
- AxisChar* echoString(AxisChar* Value0);
+ AxisChar* echoString(const AxisChar* Value0);
ArrayOfstring echoStringArray(ArrayOfstring Value0);
int echoInteger(int Value0);
ArrayOfint echoIntegerArray(ArrayOfint Value0);
1.17 +47 -45 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
Index: WSDL2Ws.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- WSDL2Ws.java 19 Feb 2004 10:27:53 -0000 1.16
+++ WSDL2Ws.java 8 Mar 2004 05:43:46 -0000 1.17
@@ -280,58 +280,60 @@
}*/
}
else{
- while (paramlist.hasNext()) {
+ while (paramlist.hasNext()) { //RPC style messages can have multiple parts
Part p = (Part) paramlist.next();
pinfo = createParameterInfo(p);
if (null != pinfo) minfo.addInputParameter(pinfo);
}
}
//get the return type
- Iterator returnlist = op.getOutput().getMessage().getParts().values().iterator();
- if ("document".equals(bindingEntry.getBindingStyle().getName())){
- Part part = (Part) returnlist.next();
- /*if ("parameters".equals(part.getName())){*///to have "parameters" is not a must. Ref : WS-I Basic profile 1.0
- element = symbolTable.getElement(part.getElementName());
- qname = element.getRefType().getQName();
- if (qname != null){
- minfo.setOutputMessage(element.getQName());
- type = this.typeMap.getType(qname);
- if(type == null)
- throw new WrapperFault("unregisterd type "+qname+" refered");
- /*if(type.getLanguageSpecificName().startsWith(">")){*///anyway skip the wrapping element type even if it is a named type.
- //get inner attributes and elements and add them as parameters
- ArrayList elementlist = new ArrayList();
- Iterator names = type.getElementnames();
- while (names.hasNext()){
- elementlist.add(names.next());
- }
- Type innerType;
- for (int i = 0 ; i < elementlist.size(); i++) {
- String elementname = (String)elementlist.get(i);
- innerType = type.getElementForElementName(elementname).getType();
- pinfo = new ParameterInfo(innerType,elementname);
- pinfo.setElementName(type.getElementForElementName(elementname).getName());
- minfo.addOutputParameter(pinfo);
- }
- /*}
- else{
- pinfo = new ParameterInfo(type,element.getQName().getLocalPart());
- pinfo.setElementName(element.getQName());
- minfo.addOutputParameter(pinfo);
- }*/
- pinfo = new ParameterInfo(type,part.getName());
- pinfo.setElementName(part.getElementName()); }
- /*}
+ if(op.getOutput()!=null){
+ Iterator returnlist = op.getOutput().getMessage().getParts().values().iterator();
+ if (returnlist.hasNext() && "document".equals(bindingEntry.getBindingStyle().getName())){
+ Part part = (Part) returnlist.next();
+ /*if ("parameters".equals(part.getName())){*///to have "parameters" is not a must. Ref : WS-I Basic profile 1.0
+ element = symbolTable.getElement(part.getElementName());
+ qname = element.getRefType().getQName();
+ if (qname != null){
+ minfo.setOutputMessage(element.getQName());
+ type = this.typeMap.getType(qname);
+ if(type == null)
+ throw new WrapperFault("unregisterd type "+qname+" refered");
+ /*if(type.getLanguageSpecificName().startsWith(">")){*///anyway skip the wrapping element type even if it is a named type.
+ //get inner attributes and elements and add them as parameters
+ ArrayList elementlist = new ArrayList();
+ Iterator names = type.getElementnames();
+ while (names.hasNext()){
+ elementlist.add(names.next());
+ }
+ Type innerType;
+ for (int i = 0 ; i < elementlist.size(); i++) {
+ String elementname = (String)elementlist.get(i);
+ innerType = type.getElementForElementName(elementname).getType();
+ pinfo = new ParameterInfo(innerType,elementname);
+ pinfo.setElementName(type.getElementForElementName(elementname).getName());
+ minfo.addOutputParameter(pinfo);
+ }
+ /*}
+ else{
+ pinfo = new ParameterInfo(type,element.getQName().getLocalPart());
+ pinfo.setElementName(element.getQName());
+ minfo.addOutputParameter(pinfo);
+ }*/
+ pinfo = new ParameterInfo(type,part.getName());
+ pinfo.setElementName(part.getElementName()); }
+ /*}
+ else{
+ throw new WrapperFault("A message name of document literal style WSDL is not \"parameters\"");
+ }*/
+ }
else{
- throw new WrapperFault("A message name of document literal style WSDL is not \"parameters\"");
- }*/
- }
- else{
- while (returnlist.hasNext()) {
- Part p = ((Part) returnlist.next());
- pinfo = createParameterInfo(p);
- if (null != pinfo) minfo.addOutputParameter(pinfo);
- }
+ while (returnlist.hasNext()) { //RPC style messages can have multiple parts
+ Part p = ((Part) returnlist.next());
+ pinfo = createParameterInfo(p);
+ if (null != pinfo) minfo.addOutputParameter(pinfo);
+ }
+ }
}
}
return methods;
1.11 +7 -5 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/BeanParamWriter.java
Index: BeanParamWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/BeanParamWriter.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BeanParamWriter.java 13 Feb 2004 07:00:29 -0000 1.10
+++ BeanParamWriter.java 8 Mar 2004 05:43:46 -0000 1.11
@@ -122,9 +122,11 @@
writer.write("int Axis_Serialize_"+classname+"("+classname+"* param, IWrapperSoapSerializer* pSZ, bool bArray)\n{\n");
if (attribs.length == 0) {
- //nothing to print if this is simple type we have inbuild types
- System.out.println("possible error class with no attributes....................");
- return;
+ System.out.println("possible error class with no attributes....................");
+ writer.write("\tpSZ->_functions->Serialize(SZ._object, \">\", 0);\n");
+ writer.write("\treturn AXIS_SUCCESS;\n");
+ writer.write("}\n\n");
+ return;
}
String arrayType = null;
writer.write("\t/* first serialize attributes if any*/\n");
@@ -135,10 +137,10 @@
else{
if (attribs[i].isOptional()){
writer.write("\tif (0 != param->"+attribs[i].getParamName()+")\n");
- writer.write("\tpSZ->_functions->SerializeAsAttribute(SZ._object, \""+attribs[i].getElementName().getLocalPart()+"\", 0, (void*)&(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
+ writer.write("\tpSZ->_functions->SerializeAsAttribute(SZ._object, \""+attribs[i].getParamName()+"\", 0, (void*)&(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
}
else{
- writer.write("\tpSZ->_functions->SerializeAsAttribute(SZ._object, \""+attribs[i].getElementName().getLocalPart()+"\", 0, (void*)&(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
+ writer.write("\tpSZ->_functions->SerializeAsAttribute(SZ._object, \""+attribs[i].getParamName()+"\", 0, (void*)&(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
}
}
}
1.17 +6 -6 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
Index: BeanParamWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- BeanParamWriter.java 18 Feb 2004 09:24:48 -0000 1.16
+++ BeanParamWriter.java 8 Mar 2004 05:43:46 -0000 1.17
@@ -121,9 +121,9 @@
writer.write(" */\n");
writer.write("int Axis_Serialize_"+classname+"("+classname+"* param, IWrapperSoapSerializer* pSZ, bool bArray = false)\n{\n");
if (attribs.length == 0) {
- //nothing to print if this is simple type we have inbuild types
- System.out.println("possible error class with no attributes....................");
- return;
+ System.out.println("possible error class with no attributes....................");
+ writer.write("\t}\n\n");
+ return;
}
writer.write("\tif (bArray)\n");
writer.write("\t{\n");
@@ -179,9 +179,9 @@
writer.write(" */\n");
writer.write("int Axis_DeSerialize_"+classname+"("+classname+"* param, IWrapperSoapDeSerializer *pIWSDZ)\n{\n");
if (attribs.length == 0) {
- //nothing to print if this is simple type we have inbuild types
- System.out.println("possible error class with no attributes....................");
- return;
+ System.out.println("possible error class with no attributes....................");
+ writer.write("\t}\n\n");
+ return;
}
String arrayType = null;
for(int i = 0; i< attribs.length;i++){
1.9 +27 -13 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
Index: BeanParamWriter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- BeanParamWriter.java 18 Feb 2004 09:24:48 -0000 1.8
+++ BeanParamWriter.java 8 Mar 2004 05:43:46 -0000 1.9
@@ -121,11 +121,22 @@
writer.write(" */\n");
writer.write("int Axis_Serialize_"+classname+"("+classname+"* param, IWrapperSoapSerializer* pSZ, bool bArray = false)\n{\n");
if (attribs.length == 0) {
- //nothing to print if this is simple type we have inbuild types
- System.out.println("possible error class with no attributes....................");
- return;
+ System.out.println("possible error class with no attributes....................");
+ writer.write("\tpSZ->Serialize(\">\", NULL);\n");
+ writer.write("\treturn AXIS_SUCCESS;\n");
+ writer.write("}\n\n");
+ return;
}
String arrayType;
+ /* A type does not know whether it is used as a nillable parameter
+ * So this may not be the appropriate place to do this
+ */
+ writer.write("\tif ( param == NULL ) {\n");
+ writer.write("\t /* TODO : may need to check nillable value*/\n");
+ writer.write("\t pSZ->SerializeAsAttribute(\"nil\", \"http://www.w3.org/2001/XMLSchema-instance\", (void*)&(xsd_boolean_true), XSD_BOOLEAN);\n");
+ writer.write("\t pSZ->Serialize(\">\", NULL);\n");
+ writer.write("\treturn AXIS_SUCCESS;\n");
+ writer.write("\t}\n");
writer.write("\t/* first serialize attributes if any*/\n");
for(int i = 0; i< attributeParamCount;i++){
if(attribs[i].isArray() || !(attribs[i].isSimpleType())){
@@ -134,14 +145,14 @@
else{
if (attribs[i].isOptional()){
writer.write("\tif (0 != param->"+attribs[i].getParamName()+")\n");
- writer.write("\t\tpSZ->SerializeAsAttribute(\""+attribs[i].getElementName().getLocalPart()+"\", 0, (void*)(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
+ writer.write("\t\tpSZ->SerializeAsAttribute(\""+attribs[i].getParamName()+"\", 0, (void*)(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
}
else{
- writer.write("\tpSZ->SerializeAsAttribute(\""+attribs[i].getElementName().getLocalPart()+"\", 0, (void*)&(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
+ writer.write("\tpSZ->SerializeAsAttribute(\""+attribs[i].getParamName()+"\", 0, (void*)&(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
}
}
}
- writer.write("\tpSZ->Serialize(\">\", NULL);\n");
+ writer.write("\tpSZ->Serialize(\">\", 0);\n");
writer.write("\t/* then serialize elements if any*/\n");
for(int i = attributeParamCount; i< attribs.length;i++){
if(attribs[i].isArray()){
@@ -160,14 +171,16 @@
writer.write("\tpSZ->SerializeAsElement(\""+attribs[i].getElementName().getLocalPart()+"\", (void*)&(param->"+attribs[i].getParamName()+"), "+ CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())+");\n");
}else{
//if complex type
- writer.write("\tpSZ->Serialize(\"<"+attribs[i].getParamName()+"\", 0);\n");
+ String elm = attribs[i].getParamName();
+ if ( attribs[i].isReference() )
+ elm = attribs[i].getTypeName();
+ writer.write("\tpSZ->Serialize(\"<"+elm+"\", 0);\n");
writer.write("\tAxis_Serialize_"+attribs[i].getTypeName()+"(param->"+attribs[i].getParamName()+", pSZ);\n");
- writer.write("\tpSZ->Serialize(\"<"+attribs[i].getParamName()+">\", 0);\n");
+ writer.write("\tpSZ->Serialize(\"</"+elm+">\", 0);\n");
}
}
writer.write("\treturn AXIS_SUCCESS;\n");
writer.write("}\n\n");
-
}
private void writeDeSerializeGlobalMethod()throws IOException,WrapperFault{
writer.write("/*\n");
@@ -175,9 +188,10 @@
writer.write(" */\n");
writer.write("int Axis_DeSerialize_"+classname+"("+classname+"* param, IWrapperSoapDeSerializer *pIWSDZ)\n{\n");
if (attribs.length == 0) {
- //nothing to print if this is simple type we have inbuild types
- System.out.println("possible error class with no attributes....................");
- return;
+ System.out.println("possible error class with no attributes....................");
+ writer.write("\treturn AXIS_SUCCESS;\n");
+ writer.write("}\n\n");
+ return;
}
String arrayType = null;
for(int i = 0; i< attribs.length;i++){
@@ -194,7 +208,7 @@
}
}else if(attribs[i].isSimpleType()){
//TODO handle optional attributes
- writer.write("\tparam->"+attribs[i].getParamName()+" = pIWSDZ->"+CUtils.getParameterGetValueMethodName(attribs[i].getTypeName(), attribs[i].isAttribute())+"(\""+attribs[i].getElementName().getLocalPart()+"\",0);\n");
+ writer.write("\tparam->"+attribs[i].getParamName()+" = pIWSDZ->"+CUtils.getParameterGetValueMethodName(attribs[i].getTypeName(), attribs[i].isAttribute())+"(\""+(attribs[i].isAttribute() ? attribs[i].getParamName():attribs[i].getElementName().getLocalPart())+"\",0);\n");
} else{
//if complex type
writer.write("\tparam->"+attribs[i].getParamName()+" = ("+attribs[i].getTypeName()+"*)pIWSDZ->GetCmplxObject((void*)Axis_DeSerialize_"+attribs[i].getTypeName()+
1.5 +15 -1 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java
Index: ParameterInfo.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/ParameterInfo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ParameterInfo.java 15 Jan 2004 13:45:24 -0000 1.4
+++ ParameterInfo.java 8 Mar 2004 05:43:46 -0000 1.5
@@ -67,8 +67,22 @@
protected QName elementName;
public String getParamName() {
- return attribName;
+ // TODO: design review needed
+ // - If type and name are equals add "_Ref" ie : ref="..."
+ String result;
+ if (isReference())
+ result = attribName + "_Ref";
+ else
+ result = attribName;
+ return result;
}
+
+ /**
+ * @return boolean
+ */
+ public boolean isReference() {
+ return type != null && attribName.equals(type.getLanguageSpecificName());
+ }
public void setParamName(String paramName) {
this.attribName = paramName;
1.9 +12 -3 ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java
Index: Type.java
===================================================================
RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Type.java 17 Feb 2004 12:47:44 -0000 1.8
+++ Type.java 8 Mar 2004 05:43:46 -0000 1.9
@@ -145,9 +145,18 @@
this.languageSpecificName = qname2LSN();
else{
//remove any funny Charactors
- this.languageSpecificName.replaceAll("/","_");
- this.languageSpecificName.replaceAll(":","_");
-
+ this.languageSpecificName = this.languageSpecificName.replaceAll("/","_");
+ this.languageSpecificName = this.languageSpecificName.replaceAll(":","_");
+ // JBY : add this one more clean?
+ // This arrived in case of inner type declaration. And for compilation
+ // we replace all '>' by '_' (not the first one). Quick and durty fix.
+ if ( this.languageSpecificName.length() > 1 ) {
+ char first = this.languageSpecificName.charAt(0);
+ if ( this.languageSpecificName.charAt(0) == '>' )
+ this.languageSpecificName = ">" + this.languageSpecificName.substring(1).replaceAll(">","_");
+ else
+ this.languageSpecificName = this.languageSpecificName.replaceAll(">","_");
+ }
}
this.attribOrder = new Vector();
}