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 122771

Summary: WDSL-file creation with complex types fails partially
Product: webservices Reporter: lin_art <lin_art>
Component: CodeAssignee: Milan Kuchtiak <mkuchtiak>
Status: NEW ---    
Severity: blocker CC: mgrebac
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Calculator Webservice

Description lin_art 2007-11-26 14:25:51 UTC
(hope this is the right channel for this report)


Problem:

I used the Netbeans sample Calculator-Webservice and added a new class TestClass and a new webmethod sendClass() 

which return a TestClass object.
No warnings after building. Deployment + verification on a glassfish appserver worked. 
The add() webmethod worked for the int result-type. The sendClass() returns an empty object.



New Dummy-Class: TestClass.java

package org.me.calculator;
import java.io.Serializable;
import java.util.Vector;
public class TestClass implements Serializable {
    String s; int i; Vector<String> v;
    public TestClass() { s = ""; i = 0; v = new Vector<String>(); }
    public TestClass(int ii, String ss) { s = ss; i = ii; v = new Vector<String>(); v.add("TESTEST");}
}



New Web-Method: sendClass(int, String)

@WebMethod(operationName = "sendClass")
public TestClass sendClass(
       @WebParam(name = "i") int i, 
       @WebParam(name = "s") String s) {
        
  TestClass tc = new TestClass(44, "asdfa");
     
      return tc;
}



WDSL File changes after deployment: 

(..)
 <message name="sendClass">
  <part name="parameters" element="tns:sendClass" /> 
 </message>
 <message name="sendClassResponse">
  <part name="parameters" element="tns:sendClassResponse" /> 
 </message>
(..)
<operation name="sendClass">
<soap:operation soapAction="" /> 
 <input>
  <soap:body use="literal" /> 
 </input>
 <output>
  <soap:body use="literal" /> 
 </output>
</operation>
(..)


XSD File changes after deployment:

(..)
<xs:complexType name="sendClassResponse">
 <xs:sequence>
  <xs:element name="return" type="tns:testClass" minOccurs="0" /> 
 </xs:sequence>
</xs:complexType>
<xs:complexType name="testClass">
 <xs:sequence /> 
</xs:complexType>
(..)


As you see, the complex-type is empty...
Did I miss something? Some annotations? Or is this a java-sdk bug?
Comment 1 lin_art 2007-11-26 14:28:51 UTC
Created attachment 53493 [details]
Calculator Webservice
Comment 2 lin_art 2007-11-26 18:29:10 UTC
Solution:

Use the @XmlElement annotation for each class-variable, like:

@XmlElement
String s; 

@XmlElement 
int i; 


and to the @WebService annotation add @XmlSeeAlso({packet.to.ClassFile.class,...}), like

@WebService()
@XmlSeeAlso({org.me.calculator.TestClass.class})
public class CalculatorWS {..}


A complex datatype should be included to the calculator sample or as a new issue in a next NB version..


------------
nb: GREAT IDE!!! Thanks a lot for your work!
Comment 3 Lukas Jungmann 2008-03-16 16:20:23 UTC
Martin, can you evaluate this issue, please? It's about calculator sample...
Comment 4 Martin Grebac 2008-03-17 11:13:18 UTC
Thanks for reporting. Changing to enhancement.