2014-09-28 111 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)