- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebMethod
类的一些代码示例,展示了WebMethod
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebMethod
类的具体详情如下:
包路径:org.codehaus.enunciate.contract.jaxws.WebMethod
类名称:WebMethod
[英]A method invoked on a web service.
[中]在web服务上调用的方法。
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
public Collection<WebMessagePart> getParts() {
ArrayList<WebMessagePart> parts = new ArrayList<WebMessagePart>();
for (WebParam webParam : this.webMethod.getWebParameters()) {
if ((webParam.isOutput()) && (!webParam.isHeader())) {
parts.add(webParam);
}
}
TypeMirror returnType = this.webMethod.getReturnType();
if (!(returnType instanceof VoidType)) {
parts.add(this.webMethod.getWebResult());
}
return parts;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
protected Iterator<WebFault> getLoop(TemplateModel model) throws TemplateException {
WebMethod webMethod = this.webMethod;
if (webMethod == null) {
throw new MissingParameterException("webMethod");
}
return webMethod.getWebFaults().iterator();
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* The simple name of the method.
*
* @return The simple name of the method.
*/
public String getMessageName() {
return webMethod.getDeclaringEndpointInterface().getSimpleName() + "." + webMethod.getSimpleName();
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* Determine whether this web method is doc/lit wrapped.
*
* @return Whether this web method is doc/lit wrapped.
*/
public boolean isDocLitWrapped() {
return getSoapBindingStyle() == SOAPBinding.Style.DOCUMENT &&
getSoapUse() == SOAPBinding.Use.LITERAL &&
getSoapParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* This web parameter defines an implicit schema element if it is DOCUMENT binding style and either BARE or a header.
*
* @return Whether this web parameter is an implicit schema element.
*/
public boolean isImplicitSchemaElement() {
return isHeader() || (method.getSoapBindingStyle() != SOAPBinding.Style.RPC && method.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE);
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
protected void addExplicitAnnotations(WebMethod webMethod, ClientClassnameForMethod conversion) {
String classname = conversion.convert(webMethod.getDeclaringEndpointInterface());
String methodName = webMethod.getSimpleName();
String methodKey = String.format("%s.%s", classname, methodName);
sbAnnotation.setStyle(webMethod.getSoapBindingStyle() == SOAPBinding.Style.DOCUMENT ? SOAPBindingAnnotation.STYLE_DOCUMENT : SOAPBindingAnnotation.STYLE_RPC);
sbAnnotation.setParameterStyle(webMethod.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE ? SOAPBindingAnnotation.PARAMETER_STYLE_BARE : SOAPBindingAnnotation.PARAMETER_STYLE_WRAPPED);
sbAnnotation.setUse(webMethod.getSoapUse() == SOAPBinding.Use.ENCODED ? SOAPBindingAnnotation.USE_ENCODED : SOAPBindingAnnotation.USE_LITERAL);
this.generatedAnnotations.method2SOAPBinding.put(methodKey, sbAnnotation);
wmAnnotation.setOperationName(webMethod.getOperationName());
wmAnnotation.setAction(webMethod.getAction());
this.generatedAnnotations.method2WebMethod.put(methodKey, wmAnnotation);
WebResult webResult = webMethod.getWebResult();
SerializableWebResultAnnotation wrAnnotation = new SerializableWebResultAnnotation();
wrAnnotation.setHeader(webResult.isHeader());
if (webMethod.isOneWay()) {
this.generatedAnnotations.oneWayMethods.add(methodKey);
for (WebMessage webMessage : webMethod.getMessages()) {
if (webMessage instanceof RequestWrapper) {
RequestWrapper requestWrapper = (RequestWrapper) webMessage;
for (WebParam webParam : webMethod.getWebParameters()) {
SerializableWebParamAnnotation wpAnnotation = new SerializableWebParamAnnotation();
wpAnnotation.setHeader(webParam.isHeader());
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
public ValidationResult validateWebMethod(WebMethod webMethod) {
ValidationResult result = new ValidationResult();
if (!webMethod.getModifiers().contains(Modifier.PUBLIC)) {
result.addError(webMethod.getPosition(), "A non-public method cannot be a web method.");
javax.jws.WebMethod annotation = webMethod.getAnnotation(javax.jws.WebMethod.class);
if ((annotation != null) && (annotation.exclude())) {
result.addError(webMethod.getPosition(), "A method marked as excluded cannot be a web method.");
if (webMethod.getSoapUse() == SOAPBinding.Use.ENCODED) {
result.addError(webMethod.getPosition(), "Enunciate doesn't support ENCODED-use web methods.");
boolean oneway = webMethod.isOneWay();
SOAPBinding.ParameterStyle parameterStyle = webMethod.getSoapParameterStyle();
SOAPBinding.Style soapBindingStyle = webMethod.getSoapBindingStyle();
if (oneway && (!(webMethod.getReturnType() instanceof VoidType))) {
result.addError(webMethod.getPosition(), "A one-way method must have a void return type.");
if (oneway && webMethod.getThrownTypes() != null && !webMethod.getThrownTypes().isEmpty()) {
result.addError(webMethod.getPosition(), "A one-way method can't throw any exceptions.");
result.addError(webMethod.getPosition(), "A BARE web method must have a DOCUMENT binding style.");
for (WebParam webParam : webMethod.getWebParameters()) {
if ((webParam.getMode() == javax.jws.WebParam.Mode.INOUT) && (!webParam.isHolder())) {
result.addError(webParam.getPosition(), "An INOUT parameter must have a type of javax.xml.ws.Holder");
for (WebMessage webMessage : webMethod.getMessages()) {
if (oneway && webMessage.isOutput()) {
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
this.annotation = getAnnotation(javax.jws.WebMethod.class);
this.oneWay = getAnnotation(Oneway.class) != null;
this.endpointInterface = endpointInterface;
TypeMirror returnType = getReturnType();
MapType mapType = MapTypeUtil.findMapType(returnType);
if (mapType != null) {
Collection<ParameterDeclaration> parameters = getParameters();
Collection<WebParam> webParameters = new ArrayList<WebParam>(parameters.size());
for (ParameterDeclaration parameter : parameters) {
for (ReferenceType referenceType : getThrownTypes()) {
if (!(referenceType instanceof DeclaredType)) {
throw new ValidationException(getPosition(), "Thrown type must be a declared type.");
throw new ValidationException(getPosition(), "Unknown declaration for " + referenceType);
SOAPBinding.Style bindingStyle = getSoapBindingStyle();
SOAPBinding.ParameterStyle parameterStyle = getSoapParameterStyle();
if (parameterStyle == SOAPBinding.ParameterStyle.WRAPPED) {
messages.add(new RequestWrapper(this));
if (!isOneWay()) {
messages.add(new ResponseWrapper(this));
if ((!isOneWay()) && (!(getReturnType() instanceof VoidType))) {
messages.add(webResult);
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
for (WebMessage webMessage : webMethod.getMessages()) {
if (webMessage instanceof RequestWrapper) {
javax.xml.ws.RequestWrapper annotation = webMethod.getAnnotation(javax.xml.ws.RequestWrapper.class);
if ((annotation != null) && (annotation.targetNamespace() != null) && (!"".equals(annotation.targetNamespace()))) {
if (!webMethod.getDeclaringEndpointInterface().getTargetNamespace().equals(annotation.targetNamespace())) {
result.addError(webMethod.getPosition(), "Enunciate doesn't allow declaring a target namespace for a request wrapper that is different " +
"from the target namespace of the endpoint interface. If you really must, declare the parameter style BARE and use an xml root element from " +
"another namespace for the parameter.");
javax.xml.ws.ResponseWrapper annotation = webMethod.getAnnotation(javax.xml.ws.ResponseWrapper.class);
if ((annotation != null) && (annotation.targetNamespace() != null) && (!"".equals(annotation.targetNamespace()))) {
if (!webMethod.getDeclaringEndpointInterface().getTargetNamespace().equals(annotation.targetNamespace())) {
result.addError(webMethod.getPosition(), "Enunciate doesn't allow declaring a target namespace for a response wrapper that is " +
"different from the target namespace of the endpoint interface. If you really must, declare the parameter style BARE and use an xml root " +
"element from another namespace for the return value.");
WebMethod otherMethod = implicitElementNames.put(el.getElementName(), webMethod);
if (otherMethod != null) {
result.addError(webMethod.getPosition(), "Web method defines a message part named '" + el.getElementName() +
"' that is identical to the name of a web message part defined in " + otherMethod.getPosition() + ". Please use annotations to disambiguate.");
for (WebParam webParam : webMethod.getWebParameters()) {
javax.jws.WebParam annotation = webParam.getAnnotation(javax.jws.WebParam.class);
if ((annotation != null) && (!"".equals(annotation.targetNamespace()))) {
if (!annotation.targetNamespace().equals(webParam.getWebMethod().getDeclaringEndpointInterface().getTargetNamespace())) {
result.addError(webParam.getPosition(), "Enunciate doesn't allow declaring a target namespace for a web parameter that is different from the " +
代码示例来源:origin: org.codehaus.enunciate/enunciate-csharp
if (webMethod.getSoapBindingStyle() != SOAPBinding.Style.DOCUMENT || webMethod.getSoapUse() != SOAPBinding.Use.LITERAL) {
throw new TemplateModelException("No request document qname available for a " + webMethod.getSoapBindingStyle() + "/" + webMethod.getSoapUse() + " web method.");
if (webMethod.getRequestWrapper() != null) {
return new QName(webMethod.getRequestWrapper().getElementNamespace(), webMethod.getRequestWrapper().getElementName());
else if (webMethod.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE) {
Collection<WebParam> params = webMethod.getWebParameters();
for (WebParam param : params) {
if (!param.isHeader()) {
return new QName(webMethod.getDeclaringEndpointInterface().getTargetNamespace(), param.getElementName());
代码示例来源:origin: org.codehaus.enunciate/enunciate-core
/**
* Adds any type definitions referenced by a web method.
*
* @param webMethod The web method.
*/
protected void addReferencedTypeDefinitions(WebMethod webMethod) {
REFERENCE_STACK.get().addFirst("\"see also\" annotation");
addSeeAlsoTypeDefinitions(webMethod);
REFERENCE_STACK.get().removeFirst();
WebResult result = webMethod.getWebResult();
REFERENCE_STACK.get().addFirst("return type");
addReferencedTypeDefinitions(result.isAdapted() ? result.getAdapterType() : result.getType());
REFERENCE_STACK.get().removeFirst();
for (WebParam webParam : webMethod.getWebParameters()) {
REFERENCE_STACK.get().addFirst("parameter " + webParam.getSimpleName());
addReferencedTypeDefinitions(webParam.isAdapted() ? webParam.getAdapterType() : webParam.getType());
REFERENCE_STACK.get().removeFirst();
}
for (WebFault webFault : webMethod.getWebFaults()) {
REFERENCE_STACK.get().addFirst("thrown fault " + webFault.getSimpleName());
addReferencedTypeDefinitions(webFault);
REFERENCE_STACK.get().removeFirst();
}
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-csharp
/**
* Gets the client-side package for the type, type declaration, package, or their string values.
*
* @param list The arguments.
* @return The string value of the client-side package.
*/
public Object exec(List list) throws TemplateModelException {
if (list.size() < 1) {
throw new TemplateModelException("The responseDocumentQName method method must have a web method as a parameter.");
}
TemplateModel from = (TemplateModel) list.get(0);
Object unwrapped = BeansWrapper.getDefaultInstance().unwrap(from);
if (!(unwrapped instanceof WebMethod)) {
throw new TemplateModelException("A web method must be provided.");
}
WebMethod webMethod = (WebMethod) unwrapped;
if (webMethod.getSoapBindingStyle() != SOAPBinding.Style.DOCUMENT || webMethod.getSoapUse() != SOAPBinding.Use.LITERAL) {
throw new TemplateModelException("No response document qname available for a " + webMethod.getSoapBindingStyle() + "/" + webMethod.getSoapUse() + " web method.");
}
if (webMethod.getResponseWrapper() != null) {
return new QName(webMethod.getResponseWrapper().getElementNamespace(), webMethod.getResponseWrapper().getElementName());
}
else if (webMethod.getSoapParameterStyle() == SOAPBinding.ParameterStyle.BARE) {
WebResult wr = webMethod.getWebResult();
if (!wr.isHeader()) {
return new QName(wr.getTargetNamespace(), wr.getElementName());
}
}
return null;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
TreeSet<WebFault> unvisitedFaults = new TreeSet<WebFault>(new ClassDeclarationComparator());
for (WebMethod webMethod : ei.getWebMethods()) {
for (WebMessage webMessage : webMethod.getMessages()) {
if (webMessage instanceof RequestWrapper) {
result.aggregate(validateRequestWrapper((RequestWrapper) webMessage, jaxwsBeans));
for (WebParam webParam : webMethod.getWebParameters()) {
if (webParam.getType() instanceof MapType) {
result.addError(webParam.getPosition(), "For some reason, JAXB doesn't support maps in return values or in parameters. Still need to investigate further the reason....");
if (webMethod.getWebResult().getType() instanceof MapType) {
result.addError(webMethod.getPosition(), "For some reason, JAXB doesn't support maps in return values or in parameters. Still need to investigate further the reason....");
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
if (!isSupported(webMethod.getWebResult())) {
result.addError(webMethod.getPosition(), "GWT doesn't support '" + webMethod.getWebResult() + "' as a return type.");
for (WebParam webParam : webMethod.getWebParameters()) {
if (!isSupported(webParam.getType())) {
result.addError(webParam.getPosition(), "GWT doesn't support '" + webParam.getType() + "' as a parameter type.");
allFaults.addAll(webMethod.getWebFaults());
代码示例来源:origin: org.codehaus.enunciate/enunciate-jaxws
TreeSet<WebFault> unvisitedFaults = new TreeSet<WebFault>(new TypeDeclarationComparator());
for (WebMethod webMethod : ei.getWebMethods()) {
for (WebMessage webMessage : webMethod.getMessages()) {
if (webMessage instanceof RequestWrapper) {
result.aggregate(validateRequestWrapper((RequestWrapper) webMessage, jaxwsBeans));
for (WebParam webParam : webMethod.getWebParameters()) {
if (webParam.getType() instanceof MapType) {
result.addError(webParam, "There's a bug in JAXB ruining support for maps in return values or in parameters. For more information, see " +
if (webMethod.getWebResult().getType() instanceof MapType) {
result.addError(webMethod, "There's a bug in JAXB ruining support for maps in return values or in parameters. For more information, see " +
"https://jaxb.dev.java.net/issues/show_bug.cgi?id=268 and http://forums.java.net/jive/thread.jspa?messageID=361990");
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
@Override
public ValidationResult validateEndpointInterface(EndpointInterface ei) {
ValidationResult result = super.validateEndpointInterface(ei);
if (!isAMFTransient(ei)) {
for (WebMethod webMethod : ei.getWebMethods()) {
if (!isAMFTransient(webMethod)) {
if (!isSupported(webMethod.getWebResult())) {
result.addError(webMethod.getPosition(), "AMF doesn't support '" + webMethod.getWebResult() + "' as a return type.");
}
for (WebParam webParam : webMethod.getWebParameters()) {
if (!isSupported(webParam.getType())) {
result.addError(webParam.getPosition(), "AMF doesn't support '" + webParam.getType() + "' as a parameter type.");
}
}
}
}
if (ei.getEndpointImplementations().size() > 1) {
ArrayList<String> impls = new ArrayList<String>();
for (EndpointImplementation impl : ei.getEndpointImplementations()) {
impls.add(impl.getQualifiedName());
}
result.addError(ei.getPosition(), "Sorry, AMF doesn't support two endpoint implementations for interface '" + ei.getQualifiedName() +
"'. Found " + ei.getEndpointImplementations().size() + " implementations (" + impls.toString() + ").");
}
}
return result;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-csharp
Map<String, Declaration> paramsByName = new HashMap<String, Declaration>();
for (WebMethod webMethod : ei.getWebMethods()) {
for (WebParam webParam : webMethod.getWebParameters()) {
if (webMethod.getWebResult().isHeader()) {
Declaration conflict = paramsByName.put(webMethod.getWebResult().getElementName(), webMethod);
if (conflict != null) {
result.addError(webMethod, "C# requires that all header parameters defined in the same endpoint interface have unique names. " +
if (webMethod.getWebResult().getType() instanceof MapType) {
result.addError(webMethod, "C# can't handle types that are maps.");
if (capitalize(webMethod.getClientSimpleName()).equals(ei.getClientSimpleName())) {
result.addError(webMethod, "C# can't handle methods that are of the same name as their containing class. Either rename the method, or use the @org.codehaus.enunciate.ClientName annotation to rename the method (or type) on the client-side.");
代码示例来源:origin: org.codehaus.enunciate/enunciate-amf
for (WebMethod webMethod : ei.getWebMethods()) {
if (!isAMFTransient(webMethod)) {
if (!isSupported(webMethod.getWebResult())) {
result.addError(webMethod, "AMF doesn't support '" + webMethod.getWebResult() + "' as a return type.");
for (WebParam webParam : webMethod.getWebParameters()) {
if (!isSupported(webParam.getType())) {
result.addError(webParam, "AMF doesn't support '" + webParam.getType() + "' as a parameter type.");
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
@Override
public ValidationResult validateEndpointInterface(EndpointInterface ei) {
ValidationResult result = new ValidationResult();
HashSet<String> uniqueMethodNames = new HashSet<String>();
for (WebMethod webMethod : ei.getWebMethods()) {
if (!uniqueMethodNames.add(webMethod.getSimpleName())) {
result.addError(webMethod.getPosition(), "Sorry, the xfire client module doesn't support overloaded methods yet. Unfortunately, each method has " +
"to have a unique name.");
}
for (WebParam webParam : webMethod.getWebParameters()) {
if (webParam.isOutput()) {
//todo: add support for in in/out parameters.
result.addError(webParam.getPosition(), "The xfire client module doesn't support IN/OUT or OUT parameters yet....");
}
}
}
return result;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* A set of the reference namespace for this method.
*
* @return A set of the reference namespace for this method.
*/
public Set<String> getReferencedNamespaces() {
HashSet<String> namespaces = new HashSet<String>();
Collection<WebMessage> messages = getMessages();
for (WebMessage message : messages) {
for (WebMessagePart part : message.getParts()) {
namespaces.add(part.getParticleQName().getNamespaceURI());
}
}
return namespaces;
}
我目前正在阅读以了解有关按契约(Contract)设计/代码契约(Contract)的更多信息。 据我所知,就是写契约(Invariants,Pre and Post conditions)来确保代码
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 9年前关闭。 Improve this q
我正在处理 spring cloud contract 并且有一个用例,我希望在缺少一些查询参数时响应为 BAD_REQUEST,而在所有必需查询参数都存在时响应为 OK。为了实现这一点,我有不同的契
按契约(Contract)设计的最佳实践是什么? 在大学里,我通过契约(Contract)范式学习了设计 (在OO环境中) 我们已经学习了三种解决问题的方法: 1)全面编程:涵盖其所有可能的异常(ex
从理论上讲,这似乎是避免错误的一个很好的解决方案,但为什么在实践中我们听到的很少呢? 例如,为什么我们不能在 Java 或 .net 上看到对它的更多支持? 最佳答案 我也一直在寻找这个答案。但它似乎
我读到编译器可以在编译时强制执行 dbc。它是怎么做到的? 最佳答案 据我所知,迄今为止最强大的静态DbC语言是Spec# by Microsoft Research .它使用名为 Boogie 的强
我试图让 VS2010 Ultimate with Code Contracts 生成错误而不是警告。 我有这个简单的测试程序: using System.Diagnostics.Contracts;
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
如何关闭对 Linq2Sql 代码的静态检查? 最佳答案 您可以通过使用 [ContractVerification(false)] 标记有问题的类来抑制对静态代码的检查。 如果您生成的类是部分,您可
我正在使用 WCF 制作一个应用程序的原型(prototype),我正在尝试定义一个回调与派生自另一个接口(interface)的接口(interface)签订契约(Contract)。这样做,生成的
我最近在 .Net Rocks 节目 570 ( http://devjourney.com/community/dotnet-rocks-show-570-with-kevin-hazzard/ )
我注意到微软在 .NET 4 中以一种奇怪的方式命名了他们的代码契约(Contract)相关函数。 他们在“require”和“ensure”的末尾添加“s”,所以有Contract.Requires
我对 WCF 比较陌生。但是,我需要创建一个向 Silverlight 和 AJAX 客户端应用程序公开数据的服务。为了实现这一目标,我创建了以下服务作为概念证明: [ServiceContract(
我一直在兜圈子,试图弄清楚这个问题。 我正在尝试选择已结束最近契约(Contract)但仍保留上一份有效契约(Contract)的员工。 例如,一名员工拥有多份契约(Contract)(有些可能是临时
使用合同密钥,有两个函数fetchByKey和lookupByKey,后者允许我处理否定查找。我没有看到针对合同编号执行相同操作的lookup : (Template t) => ContractId
我有一个用于特定 Assets (A、B、...)的合约的 pandas 数据框。每个契约(Contract)都有开始日期、结束日期(包括两者)和日费率(契约(Contract)不能重叠)。我想生成一
我有这个代码: using System; using System.Diagnostics.Contracts; namespace TestCodeContracts { class Pr
我在使用 Flow 时遇到问题,其中给定的已实现 type 通过要求我仅使用在 type 上声明的属性而不是来限制我的对象 API要求我声明所有 type 的属性。 我是 Flow 的新手,所以我可能
我有一个使用 WCF 与后端数据库通信的 Web 应用程序。我已经一切正常,但我想知道将我相当大的服务契约(Contract)分成几个契约(Contract)是否会更好。 就目前而言,服务契约(Con
我想编写单元测试来验证我的方法不接受无效参数。使用 Code Contract 的 Contract.Requires 调用检查参数的有效性。我为什么要测试合约?我认为我的测试是一种方法规范(实际上是
我是一名优秀的程序员,十分优秀!