dannyr's Blog
ColdFusion Delphi Flex Java .Net —— 一个都不能少!
博客园
社区
首页
新随笔
联系
管理
订阅
随笔- 93 文章- 3 评论- 316
2004年12月9日
Flex的WebSerivce对比Axis 1.2RC2(求助)
诚然Flex中自带的WebService.jar包是对Axis进行了封装,应该有所改变(没看到过MM上文档说明到底改了点啥),近来打算用新的Axis 1.2RC2来替换Flex内置的web服务,然而问题就由此发生了。
原来的server-config.wsdd配置文件如下:
<
service
name
="FashionService"
provider
="java:RPC"
>
<
parameter
name
="methodName"
value
="getCategoryList, getItemListByCategoryId"
/>
<
parameter
name
="className"
value
="fashion.items.FashionService"
/>
<
beanMapping
languageSpecificType
="java:fashion.items.Item"
qname
="ns4:Item"
xmlns:ns4
="http://localhost:8080/fashionservice"
/>
<
beanMapping
languageSpecificType
="java:fashion.items.Category"
qname
="ns4:Category"
xmlns:ns4
="http://localhost:8080/fashionservice"
/>
</
service
>
其中getCategoryList和getItemListByCategoryId返回的是Category和Item两个对象的ArrayList。
用Flex自带的WebService.jar解释后,得到的wsdl中,对这个两个方法返回值的描述是(简单描述一下,省略大部分)
<
wsdl:message
name
="getCategoryListResponse"
>
<
wsdl:part
name
="getCategoryListReturn"
type
="soapenc:Array"
/>
</
wsdl:message
>
<
wsdl:operation
name
="getCategoryList"
>
<
wsdl:input
message
="impl:getCategoryListRequest"
name
="getCategoryListRequest"
/>
<
wsdl:output
message
="impl:getCategoryListResponse"
name
="getCategoryListResponse"
/>
</
wsdl:operation
>
<
wsdl:output
name
="getCategoryListResponse"
>
<
wsdlsoap:body
encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"
namespace
="http://localhost:8080/fashionservice/services/FashionService"
use
="encoded"
/>
</
wsdl:output
>
并且有Category和Item两个对象从JAVA Mapping到XML的说明 (即wsdl:types的schema,这里只列了Category一个结构)
<
complexType
name
="Category"
>
<
sequence
>
<
element
name
="data"
nillable
="true"
type
="xsd:string"
/>
<
element
name
="id"
nillable
="true"
type
="xsd:string"
/>
<
element
name
="label"
nillable
="true"
type
="xsd:string"
/>
<
element
name
="status"
nillable
="true"
type
="xsd:string"
/>
</
sequence
>
</
complexType
>
以上一切都很正常,Flex调用这两个web服务也ok,能正确从XML文件映射为Flex的对象。比如Category的id,data,label等字段能从flex中直接名字引用。
然而把Flex自带的WebService.jar替换为Axis 1.2RC2的axis.jar等相关jar包后,问题就出现了。
首先可以保证Axis工作是正常的,server-config.wsdd配置文件也保持不变
同样获得wsdl
而wsdl:types 的schema却变为Array了,没有了server-config.wsdd中的BeanMapping中的两个POJO
<
wsdl:types
>
<
schema
targetNamespace
="http://localhost:8080/fashionservice/services/FashionService"
xmlns
="http://www.w3.org/2001/XMLSchema"
>
<
import
namespace
="http://schemas.xmlsoap.org/soap/encoding/"
/>
<
complexType
name
="ArrayOf_xsd_anyType"
>
<
complexContent
>
<
restriction
base
="soapenc:Array"
>
<
attribute
ref
="soapenc:arrayType"
wsdl:arrayType
="xsd:anyType[]"
/>
</
restriction
>
</
complexContent
>
</
complexType
>
</
schema
>
</
wsdl:types
>
相关的方法定义也变为
<
wsdl:message
name
="getCategoryListResponse"
>
<
wsdl:part
name
="getCategoryListReturn"
type
="impl:ArrayOf_xsd_anyType"
/>
</
wsdl:message
>
<
wsdl:operation
name
="getCategoryList"
>
<
wsdl:input
message
="impl:getCategoryListRequest"
name
="getCategoryListRequest"
/>
<
wsdl:output
message
="impl:getCategoryListResponse"
name
="getCategoryListResponse"
/>
</
wsdl:operation
>
<
wsdl:operation
name
="getCategoryList"
>
<
wsdlsoap:operation
soapAction
=""
/>
<
wsdl:input
name
="getCategoryListRequest"
>
<
wsdlsoap:body
encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"
namespace
="http://items.fashion"
use
="encoded"
/>
</
wsdl:input
>
<
wsdl:output
name
="getCategoryListResponse"
>
<
wsdlsoap:body
encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/"
namespace
="http://localhost:8080/fashionservice/services/FashionService"
use
="encoded"
/>
</
wsdl:output
>
</
wsdl:operation
>
以上一切也都可以正常工作,Flex调用这两个web服务也ok,但不能正确从XML文件映射为Flex的对象,获得的对象为一个Array,只是里面的值还是正确的。 问题就是wsdl中缺少了schema,Flex不能把xml文件映射为对象了,只能按Array来解释。
现在我又不得不使用Flex自带的web服务实现包,不知道那位熟悉Axis的同志能指点一二!
posted @
2004-12-09 15:54
dannyr|一个都不能少! 阅读(1317) |
评论 (0)
|
编辑
公告
我的联系方式:
MSN dannyr@163.com
QQ 563178
20060606新计数器
Detail
<
2004年12月
>
日
一
二
三
四
五
六
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
与我联系
发短消息
搜索
常用链接
我的随笔
我的空间
我的短信
我的评论
更多链接
我的参与
我的新闻
最新评论
我的标签
留言簿
给我留言
查看留言
随笔分类
.Net技术(22)
(rss)
C++(9)
(rss)
ColdFusion(5)
(rss)
Delphi(2)
(rss)
DevExpress(1)
(rss)
Flex技术(29)
(rss)
Java(4)
(rss)
Laszlo(9)
(rss)
Spry(9)
(rss)
生活随笔(10)
(rss)
杂项(13)
(rss)
随笔档案
2008年6月 (1)
2008年5月 (2)
2007年9月 (2)
2007年8月 (1)
2007年7月 (3)
2007年1月 (1)
2006年12月 (2)
2006年11月 (1)
2006年10月 (6)
2006年9月 (1)
2006年8月 (4)
2006年7月 (1)
2006年6月 (4)
2006年5月 (4)
2006年4月 (2)
2006年1月 (1)
2005年12月 (1)
2005年11月 (1)
2005年10月 (2)
2005年8月 (1)
2005年7月 (1)
2005年6月 (1)
2005年5月 (1)
2005年4月 (1)
2005年3月 (2)
2005年2月 (1)
2005年1月 (3)
2004年12月 (9)
2004年11月 (9)
2004年10月 (9)
2004年9月 (3)
2004年8月 (2)
2004年7月 (6)
2004年6月 (4)
文章分类
ColdFusion
(rss)
Flex技术(3)
(rss)
文章档案
2004年6月 (3)
我的链接
Trademan
(rss)
www.k-zone.cn
(rss)
呼呼堂
(rss)
牛皮糖
(rss)
最新评论
阅读排行榜
1. 任意对象数组ArrayList的排序法(可自定义排序字段、排序方向)(8842)
2. ASP.NET动态加载用户控件的页面生成过程(8732)
3. 征集比较完善的权限管理方案!(最好有C#方案)(6406)
4. 关于上个Flex-Jsp-DB例子中Flex和Jsp传递中文参数问题的解决方法!(Tomcat服务器)(5913)
5. Flex2.0文件上传功能(Flex2.0正式版)(5579)
6. Flex RemoteObject 简单应用Demo(5561)
7. 贴个Flex-Jsp-Mysql简单结合例子(5546)
8. DeKlarit:一个不错的top-down CG工具(4665)
9. Rich Client Fashion(转载)+乱弹(4474)
10. Flex2.0实现文件上传功能(服务器为ASP.NET)(4074)
评论排行榜
1. DeKlarit:一个不错的top-down CG工具(24)
2. 关于上个Flex-Jsp-DB例子中Flex和Jsp传递中文参数问题的解决方法!(Tomcat服务器)(17)
3. Flex2.0实现文件上传功能(服务器为ASP.NET)(17)
4. 如何关闭子线程?征集析构函数与多线程的讨论!(16)
5. 神影无踪-廖添丁FlashGame(15)
6. 征集比较完善的权限管理方案!(最好有C#方案)(13)
7. 贴个Flex-Jsp-Mysql简单结合例子(11)
8. ASP.NET动态加载用户控件的页面生成过程(11)
9. 体验 Delphi2005's ECO II 空间技术(10)
10. Flex2.0文件上传功能(Flex2.0正式版)(10)