用Axis2 传递复杂对象

用axis2 传递复杂对象
 
Web serivces 有个方法 :
 
Person searchPerson(Person person);
 
其中的Person定义为
class Person
{
    int age;
    String name;
    String address;
    Person father;
}
 
wsdl 定义为:
 
<types>
        <schema targetNamespace=" http://userguide.axis2.apache.org/xsd"
            xmlns=" http://www.w3.org/2001/XMLSchema"
            xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/"
            elementFormDefault="qualified">
 
<complexType name="Person">
    <all>
     <element name="age" type="xsd:int"/>
     <element name="name" type="xsd:string"/>
     <element name="address" type="xsd:string"/>
     <element name ="father" type="xsd1:Person"/>
    </all>
   </complexType>
 
 </schema>
<types>
 
------------------------------ -----------------------
<element name="searchPersonParam" type="xsd1:Person"/> <script type="text/javascript"> </script>
 
<element name="searchPersonReturn" type="xsd1:Person"/> 
------------------------------ -----------------------
<message name="searchPerson">
  <part element="xsd1:searchPersonParam " name="a"/>
 </message>
 <message name="searchPersonResponse">
  <part element="xsd1:searchPersonRetur n" name="result"/>
 </message> 
 
------------------------------ -----------------------
<portType name="Axis2SampleDocLitPortType ">
    <operation name="searchPerson">
   <input message="tns:searchPerson" name="searchPerson"/>
   <output message="tns:searchPersonRespon se" name="searchPersonResponse"/>
  </operation>
</portType>
------------------------------ -----------------------
 
<binding name="Axis2SampleDocLitPortBind ing"
        type="tns:Axis2SampleDocLitPort Type">
        <soap:binding style="document" transport=" http://schemas.xmlsoap.org/soap/http"/>
 
        <operation name="searchPerson">
   <soap:operation soapAction="searchPerson" style="document"/>
   <input name="searchPerson">
    <soap:body namespace=" http://userguide.axis2.apache.org/Axis2SampleDocLit"
                    use="literal"/>
   </input>
   <output name="searchPersonResponse"> <script type="text/javascript"> </script>
    <soap:body namespace=" http://userguide.axis2.apache.org/Axis2SampleDocLit"
                    use="literal"/>
   </output>
  </operation>
</binding>
 
 <service name="Axis2SampleDocLitService ">
        <port binding="tns:Axis2SampleDocLitP ortBinding"
            name="Axis2SampleDocLitPort">
            <soap:address
                location=" http://userguide.axis2.apache.org/stkv3/wsdl/Axis2SampleDocLit.wsdl"/>
        </port>
    </service>
 
 
将此wsdl 保存为 Axis2SampleDocLit.wsdl 
运行
> WSDL2Java -uri ./Axis2Sample DocLit.wsdl -ss -sd -g -d xmlbeans -o ./Axis2SampleDocLit -p org.apache.axis2.userguide
 
然后修改服务代码,发布服务,编写客户端测试程序。 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值