在 WebSphere Application Server V7 中为 WS-Addressing 提供 JAX-WS 2.1 支持
2010-07-26 00:00:00 来源:WEB开发网生成一个 SEI
当使用清单 7 中的 WSDL 生成 SEI 后,@Action 和 @FaultAction 注释不会被自动添加。在清单 8 中的 SEI 中,我们手动添加了注释。
通过使用这个 WSDL 以及应用程序 ear 文件中的 Calculator_schema1.xsd 模式,我们可以生成一个 Service Endpoint Interface (SEI)。这可以通过使用 WebSphere Application Sever 安装的 bin 目录中的 wsimport 工具完成。生成的 SEI 如清单 8 所示。它包含 4 个方法:getTicket()、add()、getSubmissionTicket() 和 addSubmission()。 getTicket() 方法返回一个 W3CEndpointReference,而 getSubmissionTicket() 方法返回一个 SubmissionEndpointReference。add() 和 addSubmission() 方法返回一个 int,并且它们还使用 @Action 进行了注释。@Action 注释包含一个将 AddNumbersException 映射到动作 @FaultAction 注释。
清单 8. Calculator.java
package developerworks.jaxws.calculator;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.Action;
import javax.xml.ws.FaultAction;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import com.ibm.websphere.wsaddressing.jaxws21.SubmissionEndpointReference;
@WebService(name = "Calculator", targetNamespace =
"http://calculator.jaxws.developerworks")
@XmlSeeAlso({
ObjectFactory.class
})
public interface Calculator {
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "getTicket",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.GetTicket")
@ResponseWrapper(localName = "getTicketResponse",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.GetTicketResponse")
public W3CEndpointReference getTicket();
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "getSubmissionTicket",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.GetSubmissionTicket")
@ResponseWrapper(localName = "getSubmissionTicketResponse",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.GetSubmissionTicketResponse")
public SubmissionEndpointReference getSubmissionTicket();
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "add",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.Add")
@ResponseWrapper(localName = "addResponse",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.AddResponse")
@Action(input = "http://calculator.jaxws.developerworks/add",
output = "http://calculator.jaxws.developerworks/addResponse",
fault = {@FaultAction(className = AddNumbersException.class,
value = "http://calculator.jaxws.developerworks/addFault")})
public int add(
@WebParam(name = "arg0", targetNamespace = "")
int arg0,
@WebParam(name = "arg1", targetNamespace = "")
int arg1)
throws AddNumbersException_Exception;
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "addSubmission",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.AddSubmission")
@ResponseWrapper(localName = "addSubmissionResponse",
targetNamespace = "http://calculator.jaxws.developerworks",
className = "developerworks.jaxws.calculator.AddSubmissionResponse")
@Action(input = "http://calculator.jaxws.developerworks/addSubmission",
output = "http://calculator.jaxws.developerworks/addSubmissionResponse",
fault = {@FaultAction(className = AddNumbersException.class,
value = "http://calculator.jaxws.developerworks/addSubmissionFault")})
public int addSubmission(
@WebParam(name = "arg0", targetNamespace = "")
int arg0,
@WebParam(name = "arg1", targetNamespace = "")
int arg1)
throws AddNumbersException_Exception;
}
Tags:WebSphere Application Server
编辑录入:爽爽 [复制链接] [打 印]- ››WebSphere 反向投资者: 解决 WebSphere Applicati...
- ››WebSphere sMash 的创新应用,第 2 部分: 借助包装...
- ››Websphere MQ v6集群的负载均衡新功能
- ››WebSphere Process Server V6.0.2 集群,第 2 部分...
- ››WebSphere Process Server V6.0.2 集群,第 1 部分...
- ››WebSphere MQ性能调优浅谈
- ››WebSphere配置资源库管理
- ››WebSphere中的SSL/TLS:用法、配置和性能
- ››websphere ejb远程/本地调用总结
- ››WebSphere Application Server对SIP的支持
- ››WebSphere Process Server V6 体系结构概述
- ››WebSphere Business Process Management V6.1 入门...
更多精彩
赞助商链接