Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JAX WS

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks,
I am new to web service development, i have been trying to develop a sample web service, but i see a problem in returning the custom data type from the web service.

complete details below:

my SEI is as below


@WebService
@SOAPBinding(style = Style.DOCUMENT)
public interface StudentService
{
/**
* Fetches the student object based on the student ID passed as parameter
* @param id the student ID
* @return the student object.
*/
@WebMethod
Student getStudent(String id) throws StudentException;

}


my SIB is as below:


@WebService(endpointInterface = "com.jj.student.StudentService")
public class StudentServiceImpl implements StudentService
{

/**
* {@inheritDoc}
*/
public Student getStudent(String id) throws StudentException
{
// mock content for time being.
Student student = new Student("student01", new Name("first name",
"middle name", "last name"), 21, new Address());
return student;
}

}


I used wsgen to generate the WSDL, the problem i could see is the schema generated along with the wsdl doesnt seem to consider the class members of Stuent.java!

GENERATED SCHEMA


<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-b01-. --><xs:schema xmlns:tns="http://student.jj.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://student.jj.com/">

<xs:element name="StudentException" type="tns:StudentException" />

<xs:element name="getStudent" type="tns:getStudent" />

<xs:element name="getStudentResponse" type="tns:getStudentResponse" />

<xs:complexType name="getStudent">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="getStudentResponse">
<xs:sequence>
<xs:element name="return" type="tns:student" minOccurs="0" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="student">
<xs:sequence />
</xs:complexType>


<xs:complexType name="StudentException">
<xs:sequence>
<xs:element name="message" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>


if you observe, the student type has an empty sequence though i have class members for student!

I dont know where am i going wrong? why is it not generating the schema properly?

Thanks in advance
John
 
John Pradeep.v
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay, i have found the problem... its just that my custom data type which is the student class did'nt follow the bean standards (a default constructor and setter methods) but wsgen didnt flag any error about this..
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I don't know if it helps, but have you used the verbose flag with wsgen?
Perhaps there are some warnings or hints regarding your Student class not following Java bean standard given when it is turned on?
Best wishes!
 
John Pradeep.v
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ivan, will check that ..
 
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic