请教一个web service 用类做参数出现的问题!

fosil 2003-11-19 02:21:17
当用 THTTPRIO 控件调用函数
AddBook(const UserID:String;cBook:Book)时,
向服务器端传递以下内容:
<?xml version="1.0" encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<NS1:AddBook xmlns:NS1="urn:bookshop-service"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:NS2="urn:bookshop-book">
<NS1:UserID xsi:type="xsd:string">111111</NS1:UserID>
<NS2:book xsi:type="NS2:Book">
<NS2:author xsi:type="xsd:string">authorname</NS2:author>
<NS2:bookName xsi:type="xsd:string">the book name</NS2:bookName>
<NS2:publisher xsi:type="xsd:string">wwwwwww</NS2:publisher>
</NS2:book>
</NS1:AddBook>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
服务器端是用Apache SOAP,
出现以下错误:
java.lang.IllegalArgumentException: Unable to retrieve PropertyDescriptor for property 'NS2:author' of class 'class wisdom.Book'.
我想这应该将“<NS2:author xsi:type="xsd:string">authorname</NS2:author>”
中的“NS2”去掉就可以了,而且我试过如果从服务器端返回Book类的时候是“<author xsi:type="xsd:string">authorname</author>”的。
但是怎么控制THTTPRIO不添加“NS2” 呢?
...全文
133 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fosil 2003-11-21
  • 打赏
  • 举报
回复
难道没有人遇到过类似的问题么?
有哪位大侠给出解决办法还可有加分的。
fosil 2003-11-21
  • 打赏
  • 举报
回复
是用delphi 调用 java 写的web service
从“java.lang.IllegalArgumentException: Unable to retrieve PropertyDescriptor for property 'NS2:author' of class 'class wisdom.Book'.”
可以看出服务器端是把'NS2:author' 当作wisdom.Book类的一个属性来解释了,
而且从正确调用服务器端返回Book的soap体来看,属性的前面是不应该加上namespace的。
themore 2003-11-21
  • 打赏
  • 举报
回复
谁调用谁啊, Delphi -> java , or Java -> Delphi

什么叫定啊
猛禽 2003-11-21
  • 打赏
  • 举报
回复
不会,帮顶。

理论上NS2:加不加应该是一样的,NS2只是一个NAMESPACE,加上了只是作了一个限定,因为在NS2:BOOK中已经有NS2了,所以在成员里不加NS2也是可以滴,加上也不应该算错吧,JAVA那头的实现偶不熟,不知道。

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧