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 125346 - WS-client wizard: wrong parameters in generated stubs
Summary: WS-client wizard: wrong parameters in generated stubs
Status: CLOSED WONTFIX
Alias: None
Product: webservices
Classification: Unclassified
Component: Client (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 blocker (vote)
Assignee: Milan Kuchtiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-16 07:40 UTC by kawazu428
Modified: 2008-02-13 00:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
EJB module (13.58 KB, application/x-gzip)
2008-01-16 07:41 UTC, kawazu428
Details
client module (18.53 KB, application/x-gzip)
2008-01-16 07:41 UTC, kawazu428
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kawazu428 2008-01-16 07:40:35 UTC
In order to reproduce this issue:

- Create an empty EJB project (NetBeans 6.0, glassfish v2u1).
- Add two Entity classes, "Document" and "Keyword" (persistence "TopLink" using jdbc/__default)
- Edit "Document" to contain a @OneToMany Collection<Keyword>.
- Create two "Session Beans for Entity Classes" for both "Document" and "Keyword".
- Create two web services and choose "Create Web Service from existing sesion bean" for both "DocumentFacade"
("DocumentSOAP") and "KeywordFacade" ("KeywordSOAP").
- Deploy the project to glassfish, move to the glassfish admin console, "Web Services" and copy the WSDL URL for
"DocumentSOAP".
- Create an empty java project.
- Create a new "web service client", choose "WSDL URL" and paste the URL copied from glassfish admin.
- Make the IDE create the web service.
- Move to the "DocumentSOAPPort" in "Web Service References" and drag the "create" method to the "Main" class of the
java project.

This code reproducibly (two different machines, two different installments of netbeans) will be inserted:

[01]        try { // Call Web Service Operation
[02]            demo.documents.client.DocumentSOAPService service = new demo.documents.client.DocumentSOAPService();
[03]            demo.documents.client.DocumentSOAP port = service.getDocumentSOAPPort();
[04]            // TODO initialize WS operation arguments here
[05]
[06]            demo.documents.client.Keyword arg0 = null;
[07]
[08]            port.create(arg0);
[09]
[10]        } catch (Exception ex) {
[11]            // TODO handle custom exceptions here
[12]        }

Line 6 .. 8: The service is supposed to create(Document arg0) rather than create(Keyword arg0). The client generated
does obviously not represent the DocumentFacade exposed by the web service...

@Local
public interface DocumentFacadeLocal {

    void create(Document document);


... or the web service definition according to the IDE:

@WebService()
@Stateless()
public class DocumentSOAP {
    @EJB
    private DocumentFacadeLocal ejbRef;
    // Add business logic below. (Right-click in editor and choose
    // "Web Service > Add Operation"

    @WebMethod(operationName = "create")
    @Oneway
    public void create(Document document) {
        ejbRef.create(document);
    }



Demo-Projects "demo.documents" (EJB) and "demo.documents.client" (Java) attached.

- Create a Web Service Client
Comment 1 kawazu428 2008-01-16 07:41:09 UTC
Created attachment 55117 [details]
EJB module
Comment 2 kawazu428 2008-01-16 07:41:40 UTC
Created attachment 55118 [details]
client module
Comment 3 Milan Kuchtiak 2008-01-23 16:05:27 UTC
Interesting.

The original problem is that wsdl generated from demo.documents.DocumentSOAP service is incorrect.
That's likely because jax-ws doesn't like "Document" as parameter type/class name.
If you change the class name to something else(e.g. Document1) it will work correctly.

I reported an issue to JAX-WS team. See:
https://jax-ws.dev.java.net/issues/show_bug.cgi?id=504

We cannot do much for that as we rely on what JAX-WS2.1 generates on the server.
Thank You for this example.
Comment 4 kawazu428 2008-01-23 19:34:37 UTC
Milan,

thanks then for dealing with this and directing it to the right place. Subscribed myself to the jax-ws issue, marking
this as closed then.

Best regards,
Kristian
Comment 5 ramapulavarthi 2008-02-13 00:18:33 UTC
I see that both Web Services are in the same package and are ending up in the same targetnamespace. 
Both Web Services have the same method name "create" and the wrappers are generate into same package name ("jaxws"
subpackage of sei or endpoint). Netbeans runs wsgen on both the services one after the other and overwrites the wrapper
"create" generated by the other.

Try giving different package names to the WebServices or use @RequestWrapper,@ResponseWrapper annotations on create
method to customize it to use different wrapper name.