This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 146099 - Generated wsimport keeps reference to wsdl file in wsdllocation option
Summary: Generated wsimport keeps reference to wsdl file in wsdllocation option
Status: RESOLVED WONTFIX
Alias: None
Product: webservices
Classification: Unclassified
Component: JAX-WS (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Roderico Cruz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-03 21:24 UTC by Mei Wu
Modified: 2008-09-11 19:21 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mei Wu 2008-09-03 21:24:42 UTC
When user creates a WS client by pointing to a WSDL file in file system, the generated wsimport ant target in
nbproject/jaxws-build.xml adds wsdlLocation attribute which points to the file in the file system.
This breaks the portability of the project.
For example, when the project is imported by a different user and the physical file reference is invalid, at runtime,
the WS call no longer works.

The workaround is to manually remove the wsdllocation attribute (option) in wsimport target, however, the
nbproject/jaxws-build.xml is overwritten once the project is opened in a new NB installation.
Comment 1 Mei Wu 2008-09-03 21:27:16 UTC
More to this issue, although there is an "Edit Web Service Attributes" option on the Web service Reference node in the
project, and there is also a tab to customize wsimport, one can not turn off the wsdllocation
Comment 2 Milan Kuchtiak 2008-09-11 16:43:53 UTC
This is a well known problem and caused mostly by JAX-WS framework and its limitation:

For local WSDL file, JAX-WS:wsimport utility generates a javax.xml.ws.Service implementation that has the local file
reference in it's static block. This can be only satisfactorily overriden by @javax.xml.ws.WebServiceRef annotation, e.g.

    @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/HelloService.wsdl")
    private HelloService_Service service;

then the instance of Service class can be used in code (e.g.. in the servlet doPost() method, e.g. :
                ...
                hello.HelloService port = service.getHelloServicePort();
                java.lang.String result = port.hello();
                ...

The problem is this work only in web servers supporting @WebServiceRef injections (servers supporting JSR109
specification), and in injectable objects, e.g.

- servlets
- web services
- ejb
...
(these are object initialized at deployment time)

Generally:
 - @WebServiceRef injection works with GlassFish (target server) but not with Tomcat
 - @WebServiceRef injection works in servlets/filters but not in JSP (Web application)
 - @WebServiceRef injection doesn't work in J2SE Project (Java applications)

In cases the @WebServiceRef injection is not supported, we generate a client code like the following:

            hello.HelloService_Service service = new hello.HelloService_Service();
            hello.HelloService port = service.getHelloServicePort();
            java.lang.String result = port.hello();

which causes problems with local wsdl files and portability.

For now, I see the only workaround for these problems: don't use local wsdl files to generate clients, or use
@WebServiceRef injection wherever it's possible.

The wsimport:wsdlLocation attribute is used to generate @WebServiceRef:wsdlLocation attribute in javax.xml.ws.Service
implementation class. 

The ability to change wsimport:wsdlLocation would enable you to change the location of wsdl file, e.g. from one local
location to another location. It's basically the same as what you can do in Refresh action on client node - In the
action dialog you can also change the wsdl location:

Steps:
- copy wsdl file to your friend
- ask him to refresh client and point to new wsdl file location
Comment 3 Petr Jiricka 2008-09-11 18:38:43 UTC
Milan, sounds like you are saying that the real fix needs to be done in the JAX-WS stack itself. I think this is quite
important, because it will be a common scenario to use WS clients from non-injectable targets, such as utility
classes/POJOs. Is there a bug filed on the side of JAX-WS runtime? We should have one.
Comment 4 Roderico Cruz 2008-09-11 19:08:36 UTC
Actually I started to look at this yesterday. I am looking at the possibility of solving this using the catalog facility
as specified in the jaxws spec (jax-ws-catalog.xml).  Will let you know, meanwhile let us keep the WONTFIX resolution.
Thanks Milan.
Comment 5 Lukas Jungmann 2008-09-11 19:21:19 UTC
just a note that there's filed issue 123394 already....