AXIS部署的WebService服务端,如何设置协议报文DTO字段为大写

这几天被这个东西折腾死了,原本以为只要修改DTO中的字段名称为大写即可,但是却老是不行,发布的WSDL报文还是小写开头的,蛋疼ing。

现在讲解决方案,标注下,方便以后查找:

平时的WSDL文件是这样的:

<complexType name="Request">
<sequence>
<element name="requestId" nillable="true" type="xsd:string"/>
<element name="requestTime" nillable="true" type="xsd:string"/>
<element name="destinationId" nillable="true" type="xsd:string"/>
<element name="destinationAttr" type="xsd:int"/>
<element name="destinationAttrDetail" nillable="true" type="xsd:int"/>
<element name="balanceType" type="xsd:int"/>
<element name="rechargeUnit" type="xsd:int"/>
<element name="objType" nillable="true" type="xsd:string"/>
<element name="bonus" nillable="true" type="impl:ArrayOf_tns1_Bonus"/>
<element name="rechargeAmount" type="xsd:int"/>
<element name="prolongDays" type="xsd:int"/>
<element name="requestAmount" type="xsd:int"/>
<element name="rechargeFlag" nillable="true" type="xsd:int"/>
<element name="rechargeFlowAmount" nillable="true" type="xsd:int"/>
<element name="destinationExpTime" nillable="true" type="xsd:int"/>
</sequence>
</complexType>

想要达到以下的效果,提供给对端访问:

<complexType name="Request">
<sequence>
<element name="requestId" nillable="true" type="xsd:string"/>
<element name="requestTime" nillable="true" type="xsd:string"/>
<element name="destinationId" nillable="true" type="xsd:string"/>
<element name="destinationAttr" type="xsd:int"/>
<element name="destinationAttrDetail" nillable="true" type="xsd:int"/>
<element name="balanceType" type="xsd:int"/>
<element name="rechargeUnit" type="xsd:int"/>
<element name="objType" nillable="true" type="xsd:string"/>
<element name="bonus" nillable="true" type="impl:ArrayOf_tns1_Bonus"/>
<element name="rechargeAmount" type="xsd:int"/>
<element name="prolongDays" type="xsd:int"/>
<element name="requestAmount" type="xsd:int"/>
<element name="RechargeFlag" nillable="true" type="xsd:int"/>
<element name="RechargeFlowAmount" nillable="true" type="xsd:int"/>
<element name="DestinationExpTime" nillable="true" type="xsd:int"/>
</sequence>
</complexType>

1.和对方要一个WSDL文件

方法为

public Response hello(Request requDto) ...

入参为:

<complexType name="Request">
<sequence>
<element name="requestId" nillable="true" type="xsd:string"/>
<element name="requestTime" nillable="true" type="xsd:string"/>
<element name="destinationId" nillable="true" type="xsd:string"/>
<element name="destinationAttr" type="xsd:int"/>
<element name="destinationAttrDetail" nillable="true" type="xsd:int"/>
<element name="balanceType" type="xsd:int"/>
<element name="rechargeUnit" type="xsd:int"/>
<element name="objType" nillable="true" type="xsd:string"/>
<element name="bonus" nillable="true" type="impl:ArrayOf_tns1_Bonus"/>
<element name="rechargeAmount" type="xsd:int"/>
<element name="prolongDays" type="xsd:int"/>
<element name="requestAmount" type="xsd:int"/>
<element name="RechargeFlag" nillable="true" type="xsd:int"/>
<element name="RechargeFlowAmount" nillable="true" type="xsd:int"/>
<element name="DestinationExpTime" nillable="true" type="xsd:int"/>
</sequence>
</complexType>


2.用Eclipse工具可以很方便的建服务端和客户端的JAVA类

这里我们通过WSDL生成对应的接口DTO类:

右键单击WSDL文件,并选择新建Web Service



就可以生成对应的服务类

此时只要注意自动生成的代码里,有个静态代码块里对应的名称要为大写开头即可



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值