[jboss-user] [JBoss Web Services Users] - having trouble specifying namespace

rsobchak do-not-reply at jboss.com
Fri Sep 4 18:04:21 EDT 2009


I have a web service on JBoss-4.2.3.GA using JBossWS-native-3.0.3.GA. The web service is currently not specifying a namespace. 
I am having problems specifying the namespace.

The interface is defined as follows 

  | @WebService(name = "MyWebService")
  | @SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED)
  | 
  | public interface MyWebService
  | {
  |     public void myMethod(String param1);
  | }
  | 

The implementation is defined as follows

  | @WebService(serviceName = "MyEndpointService",
  |                      portName = "MyEndpointPort",
  |                      endpointInterface = "com.myCompany.MyWebService")
  | @WebContext(contextRoot = "/myCompany", urlPattern = "/myWebService")
  | @Stateless
  | 
  | public class myEJB 
  | {
  |     public void myMethod(String param1)
  |     {
  |     }
  | }
  | 

This deploys and creates a single WSDL in the default (i.e. package) namespace.


When I attempt to specify the targetNamespace, the WSDL is broken into two with one importing the other.

The code with the namespace is as follows


  | @WebService(name = "MyWebService",
  |                      targetNamespace="http://com.myCompany")
  | @SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED)
  | 
  | public interface MyWebService
  | {
  |     public void myMethod(String param1);
  | }
  | 


  | @WebService(serviceName = "MyEndpointService",
  |                     portName = "MyEndpointPort",
  |                     targetNamespace="http://com.myCompany"
  |                     endpointInterface = "com.myCompany.MyWebService")
  | @WebContext(contextRoot = "/myCompany", urlPattern = "/myWebService")
  | @Stateless
  | 
  | public class myEJB 
  | {
  |     public void myMethod(String param1)
  |     {
  |     }
  | }
  | 


The resulting WSDL looks like this

  | <definitions name="MyEndpointService" targetNamespace="http://com.myCompany/" xmlns="http://schemas.xmlsoap.org/wsdl/" 
  |              xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:ns1="http://default.package/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
  |              xmlns:tns="http://com.myCompany/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  |   <import location="http://hostname:8080/myCompany/myWebService?wsdl&resource=MyWebService_PortType12338.wsdl" namespace="http://default.package/" /> 
  |   <service name="MyEndpointService">
  |      <port binding="ns1:MyWebServiceBinding" name="MyEndpointPort">
  |         <soap:address location="http://hostname:8080/myCompany/myWebService" /> 
  |      </port>
  |   </service>
  | </definitions>
  | 

According to the java doc on WebService annotation specifying the same targetNamespace on the interface and implemenation would result in one WSDL 
in the same namespace. Am I missing something?



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4253682#4253682

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4253682



More information about the jboss-user mailing list