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 116492 - [60cat] Call Web Service Operation generates illegal code
Summary: [60cat] Call Web Service Operation generates illegal code
Status: RESOLVED WONTFIX
Alias: None
Product: webservices
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-24 11:47 UTC by jlaskowski
Modified: 2009-12-21 06:19 UTC (History)
0 users

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 jlaskowski 2007-09-24 11:47:43 UTC
[ BUILD # : 200709200000 ]
[ JDK VERSION : 1.6.2 ]

While working with the article Getting Started with JAX-WS Web Services in NetBeans IDE 6.0 [1] I decided to create an ejb that would consume the web service.

Created a stateless session bean. Added New Web Service Client within the EJB project. Once the initial skeleton of the slsb has been created, I use Web Service Client Resources > Call Web Service Operation (note there were no methods in the ejb yet). The code put in the ejb likely assumed there's a method within it, but since it was not, it ended up with something like:

package org.me.calculator.client;

import javax.ejb.Stateless;
import javax.xml.ws.WebServiceRef;

@Stateless
public class CalculatorWS_EJB_ApplicationBean implements CalculatorWS_EJB_ApplicationLocal {
    @WebServiceRef(wsdlLocation = "http://localhost:8080/CalculatorWSApplication/CalculatorWSService?wsdl")
    private CalculatorWSService service;
    
    try { // Call Web Service Operation
        org.me.calculator.client.CalculatorWS port = service.getCalculatorWSPort();
        // TODO initialize WS operation arguments here
        int i = 0;
        int j = 0;
        // TODO process result here
        int result = port.add(i, j);
        System.out.println("Result = "+result);
    } catch (Exception ex) {
        // TODO handle custom exceptions here
    }

    // Add business logic below. (Right-click in editor and choose
    // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
 
}

which is illegal - try/catch outside any method.

[1] http://www.netbeans.org/kb/60/websvc/jax-ws.html
Comment 1 jlaskowski 2007-09-24 11:51:37 UTC
I've just found that it worked this way when using the feature _outside_ a method so it doesn't really matter whether
any method's available or not.
Comment 2 Lukas Jungmann 2007-09-24 17:35:04 UTC
Reporter, do you mean that we should generate only injection/helper methods if the action is not invoked from within a
body of a method or sth else?
Comment 3 jlaskowski 2007-09-24 17:53:21 UTC
The action should verify that it's been invoked from within a method and open an error window when it has not. It'd also
be better off if the action is available only when at least one method existed.
Comment 4 Milan Kuchtiak 2007-09-27 12:26:42 UTC
Need to implement the cursor position check.
Comment 5 Lukas Jungmann 2008-04-14 17:16:19 UTC
moving opened issues where TM != dev to TM=TBD
Comment 6 Milan Kuchtiak 2008-09-22 17:29:19 UTC
I don't think this is so critical. The simple workaround is to move the code into method.
It's the similar problem as if you drag&drop some JSP/HTML component from JSP palette into JSP file - the position isn't
checked either.

The little difference is that project with incorrect HTML/JSP is buildable unlike the EJB without method. 

May be some warning message would be appropriate.
Comment 7 Quality Engineering 2009-12-21 06:19:39 UTC
This bug was reported against NetBeans IDE 6.0 or an older release, or against a non-maintained module. NetBeans team does not have enough resources to get to this issue, therefore we are closing the issue as a WONTFIX. If you are interested in providing a patch for this bug, please see our NetFIX guidelines for how to proceed. 

We apologize for any inconvenience.


Thank you.
The NetBeans Team