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 136115 - web service client wizard fails with auth protected wsdl
Summary: web service client wizard fails with auth protected wsdl
Status: CLOSED WONTFIX
Alias: None
Product: webservices
Classification: Unclassified
Component: Client (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-30 00:04 UTC by s_d_williams
Modified: 2008-09-22 17:27 UTC (History)
1 user (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 s_d_williams 2008-05-30 00:04:02 UTC
I have been unable to use the web services client wizard successfully where the URL for the wsdl & service is protected
(basic auth-method). (Using the wizard inNetbeans 5.5, this same url will result in a login box). Similarly, a manually
captured/local wsdl file will also fail later in the operation of the wizard. In either case, the server returns HTTP
response code: 401. I also attempted this URL format without luck: https://<username>:<password>@host/... without luck
(verifed in browser first).
Comment 1 Milan Kuchtiak 2008-09-02 15:16:07 UTC
It's in wsit module. See the stack trace.
JAXWSSupport.createWsdlFolder(true) is called which means the wsdl folder is created if missing.

java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1158)
	at org.netbeans.modules.web.project.jaxws.WebProjectJAXWSSupport.getWsdlFolder(WebProjectJAXWSSupport.java:112)
	at org.netbeans.modules.websvc.jaxws.api.JAXWSSupport.getWsdlFolder(JAXWSSupport.java:186)
	at org.netbeans.modules.websvc.wsitconf.wsdlmodelext.WSITModelSupport.getModelForServiceFromJava(WSITModelSupport.java:399)
	at org.netbeans.modules.websvc.wsitconf.refactoring.WSITRefactoringPlugin$1.run(WSITRefactoringPlugin.java:179)
	at org.netbeans.modules.websvc.wsitconf.refactoring.WSITRefactoringPlugin$1.run(WSITRefactoringPlugin.java:123)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:669)
	at org.netbeans.modules.websvc.wsitconf.refactoring.WSITRefactoringPlugin.prepare(WSITRefactoringPlugin.java:117)
	at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare2(AbstractRefactoring.java:406)
	at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare(AbstractRefactoring.java:390)
	at org.netbeans.modules.refactoring.api.AbstractRefactoring.prepare(AbstractRefactoring.java:207)
	at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$Prepare.run(ParametersPanel.java:784)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
Comment 2 Martin Grebac 2008-09-02 15:25:51 UTC
I don't understand the usecase. The wsit stack trace is from refactoring, but user mentions he can't create ws client at
all. I wonder why is refactoring invoked during WS client creation? Am I missing something?
Comment 3 Milan Kuchtiak 2008-09-03 12:32:40 UTC
Sorry the comment belongs to issue 136104. 
Comment 4 Milan Kuchtiak 2008-09-22 10:51:33 UTC
< (Using the wizard in Netbeans 5.5, this same url will result in a login box)

That's correct. After you specify user name and password in auth-basic dialog the client artifacts (JAX-WS stub classes)
will be created.

Then, you need to provide couple of improvements (tricks) in generated code:

1. in the implementation of javax.xml.ws.Service (located in build/generated/wsimport/client directory)
   - replace the URL string - pointing to secure wsdl file to your local reference:

    static {
        URL url = null;
        try {
            URL baseUrl;
            baseUrl = secure.SecureService.class.getResource(".");
            url = new URL(baseUrl,
"/home/user/NetBeansProjects/JavaApplication1/xml-resources/web-service-references/A/wsdl/localhost_8084/WebApplicationT/SecureService.wsdl");
        } catch (MalformedURLException e) {
        ...
2. copy this file to Source Packages folder - you can rather copy entire package with generated sources 

3. to access the (secure)service itself - add these 2 lines to your client code, e.g:
   ...
   secure.SecureService service = new secure.SecureService();            
   secure.SecurePort port = service.getSecurePort();        
   > ((BindingProvider) port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "secure_username");
   > ((BindingProvider) port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "secure_password");

Note:
When using GlassFish server and web/ejb project - instead of 1,2 - you can use @javax.xml.ws.WebServiceRef injection to
access your local wsdl:

public class MyServlet extends HttpServlet {
    @WebServiceRef(wsdlLocation = "WEB-INF/wsdl/SecureService.wsdl")
    private SecureService service;

(Of course, prior to this, you should copy the wsdl file to WEB-INF/wsdl folder)

In Netbeans, we can hardly to do anything with this. It is not possible to detect if wsdl or/and service is secured or not. 
Comment 5 s_d_williams 2008-09-22 15:50:40 UTC
Hello - this problem with the web service client wizard has been fixed in Netbeans 6.1. At the time of this bug report,
access to a wsdl that required authentication at the http-level
(http://en.wikipedia.org/wiki/Basic_access_authentication) would fail whereas Netbeans 5.5 would show a
username/password login box and complete the wizard. A subsequent update to Netbeans 6.1 has repaired this situation.
Thanks for a great product -- I will try to make my bug reports more clear in the future.
Comment 6 Lukas Jungmann 2008-09-22 17:27:53 UTC
more details in issue 135838, also note that some other related minor fixes went to 6.5. It would be great if you could
check them and let us know if you find any issue. Thanks.