2014-09-28 107 views
0

我的經理今天給了我一個wsdl的url,他想在我們這邊發佈一個相同的wsdl,我在遇到問題的同時將註釋請求與spring結合起來,有人可以幫忙嗎?以下:soapui的webservice註釋問題

<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; 
} 

}

提前非常感謝!

親切的問候, 詹姆斯

回答

0

我覺得要做到這一點的方式,我們wsimport工具來做到這一點,這將產生所有的實體類和WebService註釋信息,也爲這種情況下,註釋應該喜歡這個:@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)