You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Guillaume Nodet <gn...@gmail.com> on 2006/11/21 00:05:57 UTC

PortType targetnamespace

I've spotted what I think is a bug.

When building the model from a java class using jaxws,
the PortType QName must be inferred from the @WebService
annotation on the SEI.

For example

@WebService( serviceName = "SoapService",
                       targetNamespace = "urn:greeter:service"
                       endpointInterface =
"org.apache.hello_world_soap_http.Greeter" )
public class GreeterImpl {
  ...
}

@WebService( name = "Greeter", targetNamespace = "urn:greeter:port" )
public interface Greeter {
  ...
}

must lead to a service QName of "{urn:greeter:service}SoapService",
and a PortType QName of "{urn:greeter:port}Greeter".

Due to wsdl spec, the generated wsdl must be splitted in two with
an import statement, so that the PortType can have its own
targetNamespace, different from the Service one.

The PortType QName can be easily fixed in the JaxWsServiceConfiguration with
the following code:
    @Override
    public QName getInterfaceName() {
        Class<?> epi = implInfo.getEndpointClass();
        WebService ws = null;
        if (epi != null) {
            ws = epi.getAnnotation(WebService.class);
        }
        if (ws != null && ws.name() != null && ws.name().length() > 0) {
            String name = ws.name();
            String nsuri = ws.targetNamespace();
            if (nsuri == null || nsuri.length() == 0) {
                nsuri =
ServiceUtils.makeNamespaceFromClassName(epi.getName(), "http");
            }
            return new QName(nsuri, name);
        }
        return null;
    }

However, the tooling needs some refactoring to be able to output
two different wsdls, but I think there was a plan to use to service
model ...


-- 
Cheers,
Guillaume Nodet

RE: PortType targetnamespace

Posted by Jim Ma <ji...@iona.com>.
Hi Nodet,

This is a bug in tooling and runtime . I will fill a jira issue for it .  

Thanks 

Jim

> -----Original Message-----
> From: Guillaume Nodet [mailto:gnodet@gmail.com]
> Sent: Tuesday, November 21, 2006 7:06 AM
> To: cxf-dev@incubator.apache.org
> Subject: PortType targetnamespace
> 
> 
> I've spotted what I think is a bug.
> 
> When building the model from a java class using jaxws,
> the PortType QName must be inferred from the @WebService
> annotation on the SEI.
> 
> For example
> 
> @WebService( serviceName = "SoapService",
>                        targetNamespace = "urn:greeter:service"
>                        endpointInterface =
> "org.apache.hello_world_soap_http.Greeter" )
> public class GreeterImpl {
>   ...
> }
> 
> @WebService( name = "Greeter", targetNamespace = "urn:greeter:port" )
> public interface Greeter {
>   ...
> }
> 
> must lead to a service QName of "{urn:greeter:service}SoapService",
> and a PortType QName of "{urn:greeter:port}Greeter".
> 
> Due to wsdl spec, the generated wsdl must be splitted in two with
> an import statement, so that the PortType can have its own
> targetNamespace, different from the Service one.
> 
> The PortType QName can be easily fixed in the 
> JaxWsServiceConfiguration with
> the following code:
>     @Override
>     public QName getInterfaceName() {
>         Class<?> epi = implInfo.getEndpointClass();
>         WebService ws = null;
>         if (epi != null) {
>             ws = epi.getAnnotation(WebService.class);
>         }
>         if (ws != null && ws.name() != null && ws.name().length() > 0) {
>             String name = ws.name();
>             String nsuri = ws.targetNamespace();
>             if (nsuri == null || nsuri.length() == 0) {
>                 nsuri =
> ServiceUtils.makeNamespaceFromClassName(epi.getName(), "http");
>             }
>             return new QName(nsuri, name);
>         }
>         return null;
>     }
> 
> However, the tooling needs some refactoring to be able to output
> two different wsdls, but I think there was a plan to use to service
> model ...
> 
> 
> -- 
> Cheers,
> Guillaume Nodet