我使用ejb3和maven(EAR文件)构建了一个Web服务,代码为First,JAXWS,没有WSDL,没有WAR,只有ejb ,使用Eclipse,该服务在JBOSS中工作,但现在我需要将服务放在 Weblogic 11g 。
中使用JBOSS我有注释
@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逻辑抛出了这个错误
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>
但是哪个是必需的服务命名空间???
我不知道标签里面放了什么:(
我的webservices.xml是
<?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是
<?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用这个
公开服务 @WebService(endpointInterface = "my.company.manCA7.sei.ManCa7SEI")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Stateless
public class ManCa7EndPoint implements ManCa7SEI{
private final Logger logger = LoggerFactory.getLogger(ManCa7EndPoint.class);
.
.
.
答案 0 :(得分:1)
我找到了解决方案......
在注释webservice中,我放了相同的webservices.xml命名空间并且工作!!
内部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”