[英]How to configure EJB WebServices in WildFly (in ear)
I have an EAR project, deployed on WildFly 10.1.0.Final This EAR consist of some jars and wars. 我有一个EAR项目,部署在WildFly 10.1.0.Final这个EAR包括一些罐子和战争。 I have a WebService in my jar file.
我的jar文件中有一个WebService。
I can't understand clearly how to configurate my project. 我无法清楚地知道如何配置我的项目。 I spend a lot of time in google and debugger... so i need help )
我花了很多时间在谷歌和调试器......所以我需要帮助)
My AIM: Set default AuthType/Security-domain for my EJB WebService in JAR on ear/server level. 我的目标:在耳/服务器级别的JAR中为我的EJB WebService设置默认的AuthType / Security-domain。
For Security-domain i found configuration in: 对于Security-domain,我在以下位置找到了配置:
Standalone.xml -> subsystem xmlns="urn:jboss:domain:ejb3:4.0 (server level, HIGHT priority) tag: subsystem xmlns="urn:jboss:domain:ejb3:4.0 scope: All EJB Standalone.xml - > subsystem xmlns =“urn:jboss:domain:ejb3:4.0(服务器级别,HIGHT优先级)标记:subsystem xmlns =”urn:jboss:domain:ejb3:4.0范围:所有EJB
Standalone.xml -> subsystem xmlns="urn:jboss:domain:undertow:3.0" (server level, Only for Undertow, HIGHT priority) attribute: default-security-domain (server level, medium priority) scope: All WebServices Standalone.xml - > subsystem xmlns =“urn:jboss:domain:undertow:3.0”(服务器级别,仅用于Undertow,HIGHT优先级)属性:default-security-domain(服务器级别,中等优先级)范围:所有Web服务
In jboss-app.xml (Medium priority!) in EAR META-INF Example: https://developer.jboss.org/thread/177666 Scope: All EJB 在EAR META-INF中的jboss-app.xml(中优先级!)示例: https : //developer.jboss.org/thread/177666范围:所有EJB
XML file jboss-ejb3.xml in EAR child jar project (low priority) http://wildscribe.github.io/Wildfly/8.1.0.Final/subsystem/ejb3/index.html Scope: All EJB EAR子jar项目中的XML文件jboss-ejb3.xml(低优先级) http://wildscribe.github.io/Wildfly/8.1.0.Final/subsystem/ejb3/index.html范围:所有EJB
Security domain annotation on WebService Class: Annotation: org.jboss.security.SecurityDomain Scope: Single WebService WebService上的安全域注释类:注释:org.jboss.security.SecurityDomain范围:单个WebService
Also, how can i understand - ejb properties more priority for ejb beans webservices than webservices properties 另外,我怎么能理解 - 对于ejb beans webservices而言,ejb属性比webservices属性更优先
But how can i set default auth metod BASIC? 但是我如何设置默认的auth metod BASIC? Without annotation on the class.
没有关于类的注释。 I cant find ( WEB-INF/web.xml and jboss-web.xml don't affect on my webservice.
我找不到(WEB-INF / web.xml和jboss-web.xml不影响我的webservice。
is using maven? 正在使用maven?
In this repository https://github.com/wildfly/quickstart you can find lot of examples of projects for deploy in wildfly. 在此存储库https://github.com/wildfly/quickstart中,您可以找到许多用于在wildfly中部署的项目示例。 Specifically for web service using ejb this example is usefull https://github.com/wildfly/quickstart/tree/10.x/jaxws-ejb .
特别是对于使用ejb的Web服务,这个例子很有用https://github.com/wildfly/quickstart/tree/10.x/jaxws-ejb 。 Note that in this project is necesary indicate the context root on jboss-web.xml:
请注意,在此项目中需要指示jboss-web.xml上的上下文根:
<jboss-web>
<context-root>/yourpath</context-root>
</jboss-web>
And the configuration for web service is performed with annotations. 并且使用注释执行Web服务的配置。
/**
* @author rsearls@redhat@com
*/
@Stateless
@Remote(EJB3RemoteInterface.class)
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class EJB3Bean01 implements EJB3RemoteInterface {
@WebMethod
public String echo(String input) {
return "EJB3Bean01 returning: " + input;
}
} }
Properties from web.xml work only for war deployments. web.xml中的属性仅适用于war部署。 I found only one way to configure ejb jar deployments with webservices (in one place for all endopoints and deployments).
我发现只有一种方法可以使用webservices配置ejb jar部署(在一个地方用于所有endopoints和部署)。
As we know, WildFly uses Undertow . 众所周知,WildFly使用Undertow 。 We can define Servlet Extension : http://undertow.io/undertow-docs/undertow-docs-1.2.0/#servlet-extensions
我们可以定义Servlet扩展 : http : //undertow.io/undertow-docs/undertow-docs-1.2.0/#servlet-extensions
Add src/main/resources/META-INF/services/io.undertow.servlet.ServletExtension. 添加src / main / resources / META-INF / services / io.undertow.servlet.ServletExtension。 Then, add in this file our UndertowDeploymentExtension (which implements ServletExtension ).
然后,在此文件中添加我们的UndertowDeploymentExtension(实现ServletExtension )。
Then, add in the handleDeployment method something like: deploymentInfo.setLoginConfig ( new LoginConfig( javax.servlet.http.HttpServletRequest.BASIC_AUTH, REALM_NAME) ); 然后,在handleDeployment方法中添加类似于: deploymentInfo.setLoginConfig (new LoginConfig(javax.servlet.http.HttpServletRequest.BASIC_AUTH,REALM_NAME));
Now, our jar deployments without LoginConfig will be initialized with our custom LoginConfig (and we can ommit @WebContext). 现在,我们使用自定义LoginConfig初始化没有LoginConfig的jar部署(我们可以省略@WebContext)。 For more information you can debug at WebMetaDataCreator.createLoginConfig (wildfly-webservices-server-integration-10.1.0.Final.jar)
有关更多信息,可以在WebMetaDataCreator.createLoginConfig上进行调试(wildfly-webservices-server-integration-10.1.0.Final.jar)
For quick preview: https://github.com/wildfly/wildfly/blob/master/webservices/server-integration/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java#L276 如需快速预览: https : //github.com/wildfly/wildfly/blob/master/webservices/server-integration/src/main/java/org/jboss/as/webservices/tomcat/WebMetaDataCreator.java#L276
Also, you can read this suggestion from: http://lists.jboss.org/pipermail/undertow-dev/2016-December/001801.html 此外,您可以从以下网址阅读此建议: http : //lists.jboss.org/pipermail/undertow-dev/2016-December/001801.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.