ofbiz的webservice接口提供(2)-数据类型的局限性
2015-09-30 09:02
281 查看
ofbiz4 对于webservice的支持实在是不咋地,在官方的文档中,SOAP只是支持基础类型的数据的传入传出,这些基础的数据类型我们可以参照 org.ofbiz.service.ModelParam的java2wsdlType方法。大家可以看到这个方法的类只是支持简单的基础数据类型。如 下:
protected String java2wsdlType() throws WSDLException {
if (ObjectType.instanceOf(java.lang.Character.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.String.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.Byte.class, this.type)) {
return "byte";
} else if (ObjectType.instanceOf(java.lang.Boolean.class, this.type)) {
return "boolean";
} else if (ObjectType.instanceOf(java.lang.Integer.class, this.type)) {
return "int";
} else if (ObjectType.instanceOf(java.lang.Double.class, this.type)) {
return "double";
} else if (ObjectType.instanceOf(java.lang.Float.class, this.type)) {
return "float";
} else if (ObjectType.instanceOf(java.lang.Short.class, this.type)) {
return "short";
} else if (ObjectType.instanceOf(java.math.BigDecimal.class, this.type)) {
return "decimal";
} else if (ObjectType.instanceOf(java.math.BigInteger.class, this.type)) {
return "integer";
} else if (ObjectType.instanceOf(java.util.Calendar.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.util.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.lang.Long.class, this.type)) {
return "unsignedInt";
} else if (ObjectType.instanceOf(java.sql.Timestamp.class, this.type)) {
return "string";
}
// TODO add array support (maybe even convert List objects); add GenericValue/Map support
throw new WSDLException(WSDLException.OTHER_ERROR, "Service cannot be described with WSDL (" + this.name + " / " + this.type + ")");
}
这个方法就是帮助我们生成wsdl文件,或者说wsdl = dctx.getWSDL(serviceName, locationUri)调用了上边的方法,用eclipse很容易就找到了ofbiz/framework/service/src/org /ofbiz/service/ModelParam.java里面的:
protected String java2wsdlType() throws WSDLException
这个方法是来吧serivce中参数类型转换成web service的参数类型的,
如果你定义的输出的数据类型超出这些数据类型,那么当你请求wsdl链接的时候就等着报错吧。
不过如果你有兴趣针对支持的基础数据类型做修正,那么你可以修改这个地方的代码。
这里补充一个基础知识,ofbiz中实体中的字段类型,对应的java中的数据类型的定义是通过一个xml文件定义的,在framework/entity/fieldtype下,这下面有很多个文件,是不同的数据库对应的配置文件,
我们看无论是mysql或者是derby,实体中的date对应的java类型是java.sql.Date。
由上边的基础知识引发的常见问题如:当我们的数据类型是java.sql.Date,而我们ofbiz支持的基础数据类型又不支持这个基础类型,那么这个时候我们可能不得不更改这个文件来支持我们的这个数据类型了。
更改方法很简单就是加上如下的代码,并重新编辑整个项目:
} else if (ObjectType.instanceOf(java.sql.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.sql.Time.class, this.type)) {
return "string";
}
由此可见我们ofbiz的soap支持的webservice的参数类型真是不完善。更加不会支持那些序列化的复杂数据类型了。ofbiz4 对于webservice的支持实在是不咋地,在官方的文档中,SOAP只是支持基础类型的数据的传入传出,这些基础的数据类型我们可以参照 org.ofbiz.service.ModelParam的java2wsdlType方法。大家可以看到这个方法的类只是支持简单的基础数据类型。如 下:
protected String java2wsdlType() throws WSDLException {
if (ObjectType.instanceOf(java.lang.Character.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.String.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.Byte.class, this.type)) {
return "byte";
} else if (ObjectType.instanceOf(java.lang.Boolean.class, this.type)) {
return "boolean";
} else if (ObjectType.instanceOf(java.lang.Integer.class, this.type)) {
return "int";
} else if (ObjectType.instanceOf(java.lang.Double.class, this.type)) {
return "double";
} else if (ObjectType.instanceOf(java.lang.Float.class, this.type)) {
return "float";
} else if (ObjectType.instanceOf(java.lang.Short.class, this.type)) {
return "short";
} else if (ObjectType.instanceOf(java.math.BigDecimal.class, this.type)) {
return "decimal";
} else if (ObjectType.instanceOf(java.math.BigInteger.class, this.type)) {
return "integer";
} else if (ObjectType.instanceOf(java.util.Calendar.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.util.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.lang.Long.class, this.type)) {
return "unsignedInt";
} else if (ObjectType.instanceOf(java.sql.Timestamp.class, this.type)) {
return "string";
}
// TODO add array support (maybe even convert List objects); add GenericValue/Map support
throw new WSDLException(WSDLException.OTHER_ERROR, "Service cannot be described with WSDL (" + this.name + " / " + this.type + ")");
}
这个方法就是帮助我们生成wsdl文件,或者说wsdl = dctx.getWSDL(serviceName, locationUri)调用了上边的方法,用eclipse很容易就找到了ofbiz/framework/service/src/org /ofbiz/service/ModelParam.java里面的:
protected String java2wsdlType() throws WSDLException
这个方法是来吧serivce中参数类型转换成web service的参数类型的,
如果你定义的输出的数据类型超出这些数据类型,那么当你请求wsdl链接的时候就等着报错吧。
不过如果你有兴趣针对支持的基础数据类型做修正,那么你可以修改这个地方的代码。
这里补充一个基础知识,ofbiz中实体中的字段类型,对应的java中的数据类型的定义是通过一个xml文件定义的,在framework/entity/fieldtype下,这下面有很多个文件,是不同的数据库对应的配置文件,
我们看无论是mysql或者是derby,实体中的date对应的java类型是java.sql.Date。
由上边的基础知识引发的常见问题如:当我们的数据类型是java.sql.Date,而我们ofbiz支持的基础数据类型又不支持这个基础类型,那么这个时候我们可能不得不更改这个文件来支持我们的这个数据类型了。
更改方法很简单就是加上如下的代码,并重新编辑整个项目:
} else if (ObjectType.instanceOf(java.sql.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.sql.Time.class, this.type)) {
return "string";
}
由此可见我们ofbiz的soap支持的webservice的参数类型真是不完善。更加不会支持那些序列化的复杂数据类型了。
ofbiz4 对于webservice的支持实在是不咋地,在官方的文档中,SOAP只是支持基础类型的数据的传入传出,这些基础的数据类型我们可以参照 org.ofbiz.service.ModelParam的java2wsdlType方法。大家可以看到这个方法的类只是支持简单的基础数据类型。如 下:
protected String java2wsdlType() throws WSDLException {
if (ObjectType.instanceOf(java.lang.Character.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.String.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.Byte.class, this.type)) {
return "byte";
} else if (ObjectType.instanceOf(java.lang.Boolean.class, this.type)) {
return "boolean";
} else if (ObjectType.instanceOf(java.lang.Integer.class, this.type)) {
return "int";
} else if (ObjectType.instanceOf(java.lang.Double.class, this.type)) {
return "double";
} else if (ObjectType.instanceOf(java.lang.Float.class, this.type)) {
return "float";
} else if (ObjectType.instanceOf(java.lang.Short.class, this.type)) {
return "short";
} else if (ObjectType.instanceOf(java.math.BigDecimal.class, this.type)) {
return "decimal";
} else if (ObjectType.instanceOf(java.math.BigInteger.class, this.type)) {
return "integer";
} else if (ObjectType.instanceOf(java.util.Calendar.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.util.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.lang.Long.class, this.type)) {
return "unsignedInt";
} else if (ObjectType.instanceOf(java.sql.Timestamp.class, this.type)) {
return "string";
}
// TODO add array support (maybe even convert List objects); add GenericValue/Map support
throw new WSDLException(WSDLException.OTHER_ERROR, "Service cannot be described with WSDL (" + this.name + " / " + this.type + ")");
}
这个方法就是帮助我们生成wsdl文件,或者说wsdl = dctx.getWSDL(serviceName, locationUri)调用了上边的方法,用eclipse很容易就找到了ofbiz/framework/service/src/org /ofbiz/service/ModelParam.java里面的:
protected String java2wsdlType() throws WSDLException
这个方法是来吧serivce中参数类型转换成web service的参数类型的,
如果你定义的输出的数据类型超出这些数据类型,那么当你请求wsdl链接的时候就等着报错吧。
不过如果你有兴趣针对支持的基础数据类型做修正,那么你可以修改这个地方的代码。
这里补充一个基础知识,ofbiz中实体中的字段类型,对应的java中的数据类型的定义是通过一个xml文件定义的,在framework/entity/fieldtype下,这下面有很多个文件,是不同的数据库对应的配置文件,
我们看无论是mysql或者是derby,实体中的date对应的java类型是java.sql.Date。
由上边的基础知识引发的常见问题如:当我们的数据类型是java.sql.Date,而我们ofbiz支持的基础数据类型又不支持这个基础类型,那么这个时候我们可能不得不更改这个文件来支持我们的这个数据类型了。
更改方法很简单就是加上如下的代码,并重新编辑整个项目:
} else if (ObjectType.instanceOf(java.sql.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.sql.Time.class, this.type)) {
return "string";
}
由此可见我们ofbiz的soap支持的webservice的参数类型真是不完善。更加不会支持那些序列化的复杂数据类型了。
protected String java2wsdlType() throws WSDLException {
if (ObjectType.instanceOf(java.lang.Character.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.String.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.Byte.class, this.type)) {
return "byte";
} else if (ObjectType.instanceOf(java.lang.Boolean.class, this.type)) {
return "boolean";
} else if (ObjectType.instanceOf(java.lang.Integer.class, this.type)) {
return "int";
} else if (ObjectType.instanceOf(java.lang.Double.class, this.type)) {
return "double";
} else if (ObjectType.instanceOf(java.lang.Float.class, this.type)) {
return "float";
} else if (ObjectType.instanceOf(java.lang.Short.class, this.type)) {
return "short";
} else if (ObjectType.instanceOf(java.math.BigDecimal.class, this.type)) {
return "decimal";
} else if (ObjectType.instanceOf(java.math.BigInteger.class, this.type)) {
return "integer";
} else if (ObjectType.instanceOf(java.util.Calendar.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.util.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.lang.Long.class, this.type)) {
return "unsignedInt";
} else if (ObjectType.instanceOf(java.sql.Timestamp.class, this.type)) {
return "string";
}
// TODO add array support (maybe even convert List objects); add GenericValue/Map support
throw new WSDLException(WSDLException.OTHER_ERROR, "Service cannot be described with WSDL (" + this.name + " / " + this.type + ")");
}
这个方法就是帮助我们生成wsdl文件,或者说wsdl = dctx.getWSDL(serviceName, locationUri)调用了上边的方法,用eclipse很容易就找到了ofbiz/framework/service/src/org /ofbiz/service/ModelParam.java里面的:
protected String java2wsdlType() throws WSDLException
这个方法是来吧serivce中参数类型转换成web service的参数类型的,
如果你定义的输出的数据类型超出这些数据类型,那么当你请求wsdl链接的时候就等着报错吧。
不过如果你有兴趣针对支持的基础数据类型做修正,那么你可以修改这个地方的代码。
这里补充一个基础知识,ofbiz中实体中的字段类型,对应的java中的数据类型的定义是通过一个xml文件定义的,在framework/entity/fieldtype下,这下面有很多个文件,是不同的数据库对应的配置文件,
我们看无论是mysql或者是derby,实体中的date对应的java类型是java.sql.Date。
由上边的基础知识引发的常见问题如:当我们的数据类型是java.sql.Date,而我们ofbiz支持的基础数据类型又不支持这个基础类型,那么这个时候我们可能不得不更改这个文件来支持我们的这个数据类型了。
更改方法很简单就是加上如下的代码,并重新编辑整个项目:
} else if (ObjectType.instanceOf(java.sql.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.sql.Time.class, this.type)) {
return "string";
}
由此可见我们ofbiz的soap支持的webservice的参数类型真是不完善。更加不会支持那些序列化的复杂数据类型了。ofbiz4 对于webservice的支持实在是不咋地,在官方的文档中,SOAP只是支持基础类型的数据的传入传出,这些基础的数据类型我们可以参照 org.ofbiz.service.ModelParam的java2wsdlType方法。大家可以看到这个方法的类只是支持简单的基础数据类型。如 下:
protected String java2wsdlType() throws WSDLException {
if (ObjectType.instanceOf(java.lang.Character.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.String.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.Byte.class, this.type)) {
return "byte";
} else if (ObjectType.instanceOf(java.lang.Boolean.class, this.type)) {
return "boolean";
} else if (ObjectType.instanceOf(java.lang.Integer.class, this.type)) {
return "int";
} else if (ObjectType.instanceOf(java.lang.Double.class, this.type)) {
return "double";
} else if (ObjectType.instanceOf(java.lang.Float.class, this.type)) {
return "float";
} else if (ObjectType.instanceOf(java.lang.Short.class, this.type)) {
return "short";
} else if (ObjectType.instanceOf(java.math.BigDecimal.class, this.type)) {
return "decimal";
} else if (ObjectType.instanceOf(java.math.BigInteger.class, this.type)) {
return "integer";
} else if (ObjectType.instanceOf(java.util.Calendar.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.util.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.lang.Long.class, this.type)) {
return "unsignedInt";
} else if (ObjectType.instanceOf(java.sql.Timestamp.class, this.type)) {
return "string";
}
// TODO add array support (maybe even convert List objects); add GenericValue/Map support
throw new WSDLException(WSDLException.OTHER_ERROR, "Service cannot be described with WSDL (" + this.name + " / " + this.type + ")");
}
这个方法就是帮助我们生成wsdl文件,或者说wsdl = dctx.getWSDL(serviceName, locationUri)调用了上边的方法,用eclipse很容易就找到了ofbiz/framework/service/src/org /ofbiz/service/ModelParam.java里面的:
protected String java2wsdlType() throws WSDLException
这个方法是来吧serivce中参数类型转换成web service的参数类型的,
如果你定义的输出的数据类型超出这些数据类型,那么当你请求wsdl链接的时候就等着报错吧。
不过如果你有兴趣针对支持的基础数据类型做修正,那么你可以修改这个地方的代码。
这里补充一个基础知识,ofbiz中实体中的字段类型,对应的java中的数据类型的定义是通过一个xml文件定义的,在framework/entity/fieldtype下,这下面有很多个文件,是不同的数据库对应的配置文件,
我们看无论是mysql或者是derby,实体中的date对应的java类型是java.sql.Date。
由上边的基础知识引发的常见问题如:当我们的数据类型是java.sql.Date,而我们ofbiz支持的基础数据类型又不支持这个基础类型,那么这个时候我们可能不得不更改这个文件来支持我们的这个数据类型了。
更改方法很简单就是加上如下的代码,并重新编辑整个项目:
} else if (ObjectType.instanceOf(java.sql.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.sql.Time.class, this.type)) {
return "string";
}
由此可见我们ofbiz的soap支持的webservice的参数类型真是不完善。更加不会支持那些序列化的复杂数据类型了。
ofbiz4 对于webservice的支持实在是不咋地,在官方的文档中,SOAP只是支持基础类型的数据的传入传出,这些基础的数据类型我们可以参照 org.ofbiz.service.ModelParam的java2wsdlType方法。大家可以看到这个方法的类只是支持简单的基础数据类型。如 下:
protected String java2wsdlType() throws WSDLException {
if (ObjectType.instanceOf(java.lang.Character.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.String.class, this.type)) {
return "string";
} else if (ObjectType.instanceOf(java.lang.Byte.class, this.type)) {
return "byte";
} else if (ObjectType.instanceOf(java.lang.Boolean.class, this.type)) {
return "boolean";
} else if (ObjectType.instanceOf(java.lang.Integer.class, this.type)) {
return "int";
} else if (ObjectType.instanceOf(java.lang.Double.class, this.type)) {
return "double";
} else if (ObjectType.instanceOf(java.lang.Float.class, this.type)) {
return "float";
} else if (ObjectType.instanceOf(java.lang.Short.class, this.type)) {
return "short";
} else if (ObjectType.instanceOf(java.math.BigDecimal.class, this.type)) {
return "decimal";
} else if (ObjectType.instanceOf(java.math.BigInteger.class, this.type)) {
return "integer";
} else if (ObjectType.instanceOf(java.util.Calendar.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.util.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.lang.Long.class, this.type)) {
return "unsignedInt";
} else if (ObjectType.instanceOf(java.sql.Timestamp.class, this.type)) {
return "string";
}
// TODO add array support (maybe even convert List objects); add GenericValue/Map support
throw new WSDLException(WSDLException.OTHER_ERROR, "Service cannot be described with WSDL (" + this.name + " / " + this.type + ")");
}
这个方法就是帮助我们生成wsdl文件,或者说wsdl = dctx.getWSDL(serviceName, locationUri)调用了上边的方法,用eclipse很容易就找到了ofbiz/framework/service/src/org /ofbiz/service/ModelParam.java里面的:
protected String java2wsdlType() throws WSDLException
这个方法是来吧serivce中参数类型转换成web service的参数类型的,
如果你定义的输出的数据类型超出这些数据类型,那么当你请求wsdl链接的时候就等着报错吧。
不过如果你有兴趣针对支持的基础数据类型做修正,那么你可以修改这个地方的代码。
这里补充一个基础知识,ofbiz中实体中的字段类型,对应的java中的数据类型的定义是通过一个xml文件定义的,在framework/entity/fieldtype下,这下面有很多个文件,是不同的数据库对应的配置文件,
我们看无论是mysql或者是derby,实体中的date对应的java类型是java.sql.Date。
由上边的基础知识引发的常见问题如:当我们的数据类型是java.sql.Date,而我们ofbiz支持的基础数据类型又不支持这个基础类型,那么这个时候我们可能不得不更改这个文件来支持我们的这个数据类型了。
更改方法很简单就是加上如下的代码,并重新编辑整个项目:
} else if (ObjectType.instanceOf(java.sql.Date.class, this.type)) {
return "dateTime";
} else if (ObjectType.instanceOf(java.sql.Time.class, this.type)) {
return "string";
}
由此可见我们ofbiz的soap支持的webservice的参数类型真是不完善。更加不会支持那些序列化的复杂数据类型了。
相关文章推荐
- Android开发之Intent跳转到系统应用中的拨号界面、联系人界面、短信界面
- Win7下用C#开发windows服务
- MYSQL复制表
- oracle查询每个表的占用空间
- ofbiz的webservice接口提供(1)-WSDL的生成
- 某社区商业之商业街招商方案
- oracle数据库查询常用语句
- CRM-Log4j的使用
- PHP命名规则
- iOS开发之应用内检测手机锁屏,解锁状态
- JQuery为元素添加样式
- ofbiz和应用服务器结合
- UI_属性传值
- jQuery之属性过滤选择器
- shell编程中的$@和$*的区别
- MySQL数据库事务隔离级别(Transaction Isolation Level)
- java for循环的执行顺序和几种常用写法
- IllegalStateException: Can not perform this action after onSaveInstanceState
- 源码推荐(9.30):iOS 9 新特性的代码示例,Crash捕捉 崩溃捕捉
- iOS应用架构谈 动态部署方案