set contextpath for EJB3 webservice on Weblogic 11g
Asked Answered
B

1

0

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.

With JBOSS i have the annotation

@WebContext(contextRoot="/wsManCa7", urlPattern="/manCA7WS")

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 ....

I understand the problem is this tag

<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>

But which is the required Service namespace???

I don't know what put inside the tag :(

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>

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>

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);
     .
     .
     .
Binucleate answered 1/12, 2013 at 0:8 Comment(0)
B
1

I Found the Solution...

In the annotation webservice I put the same namespace of webservices.xml and worked !!

Inside webservices.xml

<wsdl-port xmlns:ws="http://someserver.com/ManCA7">ws:ManCA7Port</wsdl-port>

Inside EJB

@WebService(endpointInterface = "my.company.manCA7.sei.ManCa7SEI",targetNamespace = "http://someserver.com/ManCA7")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Stateless
public class ManCa7EndPoint implements ManCa7SEI{

The solution was targetNamespace = "http://someserver.com/ManCA7"

Binucleate answered 1/12, 2013 at 0:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.