在Weblogic 11g上为EJB3 Web服务设置contextpath [英] set contextpath for EJB3 webservice on Weblogic 11g
问题描述
我用ejb3和maven(EAR文件)构建了一个Web服务,代码为First,JAXWS,没有WSDL,并且没有WAR,只有ejb ,在Eclipse中,该服务在JBOSS中有效,但是现在我需要将服务放入 Weblogic 11g .
I build a web service with ejb3 and maven (EAR File),code First, JAXWS, Without WSDL and without WAR, only ejb, with Eclipse, the service works in JBOSS but now i need put the service in Weblogic 11g.
对于JBOSS,我具有注释
With JBOSS i have the annotation
@WebContext(contextRoot="/wsManCa7", urlPattern="/manCA7WS")
但是在Weblogic上却没有,我找到了此链接 http://erikwramner.wordpress.com/2012/03/26/ejb3-web-service-context-path-in-weblogic-11g/来创建weblogic-webservices.xml和webservices.xml我将文件放在jar的META-INF中(而EAR中放入了JAr),但是Web逻辑抛出此错误
But on Weblogic not, I found this link http://erikwramner.wordpress.com/2012/03/26/ejb3-web-service-context-path-in-weblogic-11g/ to create weblogic-webservices.xml and webservices.xml I put the files inside the META-INF of the jar (And JAr inside EAR) but web logic throws this error
Servlet: "WSEE_SERVLET" failed to preload on startup in Web application:
"/ManCA7". com.sun.xml.ws.server.ServerRtException: Port namespace
http://someserver.com/ManCA7 doesnt match Service namespace {1} at
com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:160) at
com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:496) at
com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:539) at
weblogic.wsee.jaxws.JAXWSDeployedServlet.getEndpoint(JAXWSDeployedServlet.java:183) at
weblogic.wsee.jaxws.JAXWSServlet.registerEndpoint(JAXWSServlet.java:138) at
weblogic.wsee.jaxws.JAXWSServlet.init(JAXWSServlet.java:67) at ....
我了解问题是此标签
<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>
但这是必需的服务名称空间吗?
我不知道在标签内放什么:(
I don't know what put inside the tag :(
我的webservices.xml是
my webservices.xml is
<?xml version="1.0" encoding="UTF-8"?>
<webservices xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2">
<webservice-description>
<webservice-description-name>ManCA7</webservice-description-name>
<port-component>
<port-component-name>ManCA7Port</port-component-name>
<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>
<service-endpoint-interface>my.company.manCA7.sei.ManCa7SEI</service-endpoint-interface>
<service-impl-bean>
<ejb-link>ManCa7EndPoint</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
我的weblogic-webservices.xml是
And my weblogic-webservices.xml is
<?xml version = '1.0' encoding = 'UTF-8'?>
<weblogic-webservices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-webservices
http://www.bea.com/ns/weblogic/weblogic-webservices/1.0/weblogic-webservices.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-webservices">
<webservice-description>
<webservice-description-name>ManCA7</webservice-description-name>
<webservice-type>JAXWS</webservice-type>
<port-component>
<port-component-name>ManCA7Port</port-component-name>
<service-endpoint-address>
<webservice-contextpath>/ManCA7</webservice-contextpath>
<webservice-serviceuri>/Mant</webservice-serviceuri>
</service-endpoint-address>
<wsdl>
<exposed>true</exposed>
</wsdl>
</port-component>
</webservice-description>
</weblogic-webservices>
我的EJB通过此公开服务
And my EJB expose the service with this
@WebService(endpointInterface = "my.company.manCA7.sei.ManCa7SEI")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Stateless
public class ManCa7EndPoint implements ManCa7SEI{
private final Logger logger = LoggerFactory.getLogger(ManCa7EndPoint.class);
.
.
.
推荐答案
我找到了解决方法...
I Found the Solution...
在注释Web服务中,我放置了相同的webservices.xml命名空间,并且可以正常工作!
In the annotation webservice I put the same namespace of webservices.xml and worked !!
webservices.xml内部
Inside webservices.xml
<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>
内部EJB
@WebService(endpointInterface = "my.company.manCA7.sei.ManCa7SEI",targetNamespace = "http://someserver.com/ManCA7")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Stateless
public class ManCa7EndPoint implements ManCa7SEI{
解决方案是 targetNamespace =" http://someserver.com/ManCA7 "
The solution was targetNamespace = "http://someserver.com/ManCA7"
这篇关于在Weblogic 11g上为EJB3 Web服务设置contextpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!