[英]webservice annotation issues with soapui
我的經理今天給我提供了一個wsdl網址,他想在我們這邊發布相同的wsdl,在將注解請求與spring結合使用時遇到了一個問題,有人可以幫忙嗎?自定義請求如下:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:door="http://www.derbysoft.com/doorway">
<soapenv:Header/>
<soapenv:Body>
<door:PingRequest Token="?" UserName="?" Password="?" Echo="?"/>
</soapenv:Body>
</soapenv:Envelope>
我可以生成如下內容:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:door="http://www.test.com/doorway">
<soapenv:Header/>
<soapenv:Body>
<door:PingRequest>
<PingRequest Echo="?" Token="?" UserName="?" Password="?"/>
</door:PingRequest>
</soapenv:Body>
</soapenv:Envelope>
它總是包含更多帶有方法名稱的元素,我該如何刪除它?我在此處附加了源代碼。
@WebService(name="Example", targetNamespace="http://www.test.com/doorway", serviceName="Example")
@SOAPBinding(style=SOAPBinding.Style.RPC)
@XmlAccessorType(XmlAccessType.NONE)
public class Example {
@WebMethod(operationName="toSayHello",action="sayHello",exclude=false)
public String sayHello(@WebParam(name="userName")String userName) {
return "Hello:" + userName;
}
@WebMethod()
public void PingRequest(@WebParam(name="PingRequest")PingRequest pingRequest) {
}
}
實體:
@XmlAccessorType(XmlAccessType.NONE)
public class PingRequest
{
@XmlAttribute(name="Echo")
private String echo;
@XmlAttribute(name="Token")
private String token;
@XmlAttribute(name="UserName")
private String userName;
@XmlAttribute(name="Password")
private String password;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEcho() {
return echo;
}
public void setEcho(String echo) {
this.echo = echo;
}
}
提前謝謝了 !!
親切的問候,詹姆斯
我找到了執行此操作的方法,使用wsimport工具執行此操作,這將生成所有實體類和Web服務注釋信息,這種情況下的注釋也應像這樣:@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.