gpt4 book ai didi

JAVA SOAP修改帮助请求更改参数名称

转载 作者:行者123 更新时间:2023-12-01 11:06:54 25 4
gpt4 key购买 nike

我创建了一个 Web 服务并运行一个简单的计算器程序,如下所示:

public void sumAndMultiply(int a, int b,
@WebParam(name = "joda", mode = WebParam.Mode.OUT) Holder<Integer> sum,
@WebParam(name = "ghatak", mode = WebParam.Mode.OUT) Holder<Integer> multiply) {
sum.value = a + b;
multiply.value = a * b;
}

}

为此,我发送 <arg0><arg1>对于值 a 和 b 为:

<arg0> 4 </arg0>
<arg1> 5 </arg1>

我应该在代码中修改什么来更改参数名称,以便我需要发送如下请求:

<firstnumber>4</firstnumber>
<secondnumber>5</secondnumber>

最佳答案

在每个输入变量前面使用@WebParam(name="")

@WebMethod  
public void sumAndMultiply(@WebParam(name = "firstnumber") int a,
@WebParam(name = "secondnumber") int b) {
// some stuff here

}
<小时/>
public void sumAndMultiplyAndReference
(@WebParam(name = "firstnumber")int a,
@WebParam(name = "firstnumber")int b,
@WebParam(name = "referencenumber")int c
@WebParam(name = "sum", mode = WebParam.Mode.OUT) Holder<Integer> sum,
@WebParam(name = "multiply", mode = WebParam.Mode.OUT) Holder<Integer> multiply,
@WebParam(name = "reference", mode = WebParam.Mode.OUT) Holder<Integer> reference){
sum.value = a + b;
multiply.value = a * b;
reference.value = c;
}
<小时/>
public void sumAndMultiplyAndReference
(@WebParam(name = "firstnumber", mode = WebParam.Mode.IN)int a,
@WebParam(name = "firstnumber", mode = WebParam.Mode.IN)int b,
@WebParam(name = "referencenumber", mode = WebParam.Mode.IN)int c
@WebParam(name = "sum", mode = WebParam.Mode.OUT) Holder<Integer> sum,
@WebParam(name = "multiply", mode = WebParam.Mode.OUT) Holder<Integer> multiply,
@WebParam(name = "referencenumber", mode = WebParam.Mode.OUT) Holder<Integer> referencenumber){
sum.value = a + b;
multiply.value = a * b;
referencenumber.value = c;
}

关于JAVA SOAP修改帮助请求更改参数名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32857538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com