问题
My manager gave me a wsdl url to me today,and he want to publish a same wsdl on our side,i met an issue while combine the annotation request with spring,can someone help ?The custom request following:
<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>
what i can generated like following:
<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>
It always contain more element with method name,how i can remove that ?I attached my source here.
@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) {
}
}
Entity:
@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;
}
}
Many thanks in advance !!
Kind Regards, James
回答1:
I have find the way to do this,us wsimport tool to do this,this will generate all the entity class and webservice annotation info,also the annotation for this case should like this:@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
来源:https://stackoverflow.com/questions/26080760/webservice-annotation-issues-with-soapui