Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-18-2008, 12:28 PM
Member
 
Join Date: Feb 2008
Posts: 1
lichtbringer is on a distinguished road
Problems with a complex datatype in a webservice
Hi,
I'm trying to programm a webservice in java. For I'm new to the area of webservices I downloaded netbeans and just started. so my webservice looks that way:

Code:
@WebService() public class HuntGameWS { private DatabaseHandler m_dbHandler; public HuntGameWS() { try { m_dbHandler = new DatabaseHandler(); } catch (ClassNotFoundException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); } } /** * Web service operation */ @WebMethod(operationName = "checkUserNameExists") public boolean checkUserNameExists(@WebParam(name = "strUserName") String strUserName) { try { if( m_dbHandler == null ) m_dbHandler = new DatabaseHandler(); return m_dbHandler.checkUserNameExists(strUserName); } catch (ClassNotFoundException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); } return true; } /** * Web service operation */ @WebMethod(operationName = "checkEmailExists") public boolean checkEmailExists(@WebParam(name = "strEmail") final String strEmail) { try { if( m_dbHandler == null ) m_dbHandler = new DatabaseHandler(); return m_dbHandler.checkEmailExists(strEmail); } catch (ClassNotFoundException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); } return true; } /** * Web service operation */ @WebMethod(operationName = "createMProfile") public boolean createMProfile(@WebParam(name = "objMProfile") MProfile objMProfile) { try { if (m_dbHandler == null) { m_dbHandler = new DatabaseHandler(); } return m_dbHandler.createMProfile(objMProfile); } catch (ClassNotFoundException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); return false; } catch (SQLException ex) { Logger.getLogger(HuntGameWS.class.getName()).log(Level.SEVERE, null, ex); return false; } } }
As you see one Method is using a class as a parameter. this class looks that way:
Code:
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "mProfile", propOrder = { "email", "firstName", "gender", "lastName", "pwd", "userName" }) public class MProfile { protected String email; protected String firstName; protected String gender; protected String lastName; protected String pwd; protected String userName; /** * Gets the value of the email property. * * @return * possible object is * {@link String } * */ public String getEmail() { return email; } /** * Sets the value of the email property. * * @param value * allowed object is * {@link String } * */ public void setEmail(String value) { this.email = value; } /** * Gets the value of the firstName property. * * @return * possible object is * {@link String } * */ public String getFirstName() { return firstName; } /** * Sets the value of the firstName property. * * @param value * allowed object is * {@link String } * */ public void setFirstName(String value) { this.firstName = value; } /** * Gets the value of the gender property. * * @return * possible object is * {@link String } * */ public String getGender() { return gender; } /** * Sets the value of the gender property. * * @param value * allowed object is * {@link String } * */ public void setGender(String value) { this.gender = value; } /** * Gets the value of the lastName property. * * @return * possible object is * {@link String } * */ public String getLastName() { return lastName; } /** * Sets the value of the lastName property. * * @param value * allowed object is * {@link String } * */ public void setLastName(String value) { this.lastName = value; } /** * Gets the value of the pwd property. * * @return * possible object is * {@link String } * */ public String getPwd() { return pwd; } /** * Sets the value of the pwd property. * * @param value * allowed object is * {@link String } * */ public void setPwd(String value) { this.pwd = value; } /** * Gets the value of the userName property. * * @return * possible object is * {@link String } * */ public String getUserName() { return userName; } /** * Sets the value of the userName property. * * @param value * allowed object is * {@link String } * */ public void setUserName(String value) { this.userName = value; } }
The client application which uses the WebService is an android-Programm which are using the KSOAP2-Framework to make calls. The method calls to the methods with the primitiv datatypes are working fine. But the method call to the method with the class as parameter is making a problem. When I'm debuging the serverside the parameter is always null. I've logged the soapcall which is looking that way:
Code:
POST /HuntGameWebService/HuntGameWSService HTTP/1.1 User-Agent: kSOAP/2.0 SOAPAction: createMProfile Content-Type: text/xml Connection: close Content-Length: 805 Host: xxxxxxxxxxxx <v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"> <v:Header /> <v:Body> <n0:createMProfile id="o0" c:root="1" xmlns:n0="http://WebService.HuntGame.markus_heid.com/"> <createMProfile i:type="n0:createMProfile"> <objMProfile i:type="d:anyType"> <username i:type="d:string">user</username> <firstname i:type="d:string">user</firstname> <lastname i:type="d:string">user</lastname> <birthdate i:type="d:long">57751920000000</birthdate> <gender i:type="d:string">w</gender> <email i:type="d:string">user@user.com</email> <pwd i:type="d:string">5cc32e366c87c4cb49e4309b75f57d64</pwd> </objMProfile> </createMProfile> </n0:createMProfile> </v:Body> </v:Envelope>
I've trying a few things right now to find out what's wrong but I didn't had any success. So does anyone here knows what's wrong?

Thanks

Markus
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-20-2008, 03:12 PM
Member
 
Join Date: May 2008
Posts: 1
cbraun75 is on a distinguished road
Hi Marcus,

have the same problem as you - have you solved it? Maybe you can answer me and submit your solution.

Thanx a lot

Christian
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Axis Client accessing data on .Net webservice cfacile666 Web Frameworks 2 06-24-2008 12:09 PM
Writing webservice client javaplus Web Frameworks 0 12-19-2007 11:10 AM
Webservice ain't working? marcelman Networking 0 08-10-2007 03:48 AM
Webservice wizard error? marcelman NetBeans 0 08-10-2007 03:46 AM
Complex proximity Clauses peiceonly Lucene 1 08-07-2007 06:43 PM


All times are GMT +3. The time now is 12:44 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org