vendredi 28 février 2020

SOAP WEB SERVICE - javax.xml.ws.WebServiceException: class com.developer.jaxws.Update do not have a property of the name devdesc

I am wondering why I am getting this error in my soap web server. where could I insert the property needed to properly deploy it. I have tried creating new web service and recreate the operations but the same error persist. I also tried removing and reinstalling glassfish server. where could I find it? I am using Netbeans 8.0.2 with glassfish 4.0. Thanks

javax.xml.ws.WebServiceException: class com.developer.jaxws.Update do not have a property of the name devdesc
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:610)
at com.sun.xml.ws.server.sei.TieHandler.createArgumentsBuilder(TieHandler.java:143)
at com.sun.xml.ws.server.sei.TieHandler.<init>(TieHandler.java:115)
at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:110)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:127)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:487)
at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:283)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:158)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:639)
at org.glassfish.webservices.WSServletContextListener.registerEndpoint(WSServletContextListener.java:267)
at org.glassfish.webservices.WSServletContextListener.contextInitialized(WSServletContextListener.java:104)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:5362)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:743)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5898)

source code

        /*
         * To change this license header, choose License Headers in Project Properties.
         * To change this template file, choose Tools | Templates
         * and open the template in the editor.
         */

        package com.developer;

        import java.sql.Connection;
        import java.sql.PreparedStatement;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        import java.sql.Statement;
        import javax.jws.WebService;
        import javax.jws.WebMethod;
        import javax.jws.WebParam;

        /**
         *
         * @author PCTechRinz
         */
        @WebService(serviceName = "ProjectSoapService")
        public class ProjectSoapService {

            Connection con = DBConnect.serverConnect();
            private String uniquename;
            private String desc;
            private int id;

            public void setUniqueName(String value){ this.uniquename = value;}
            public void setDescription(String value){ this.desc = value;}
            public void setID(int value){ this.id = value;}

            public String getUniqueName(){ return this.uniquename;}
            public String getDescription() {return this.desc;}
            public int getID(){ return this.id; }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "insert")
            public String insert(@WebParam(name = "name") String name, @WebParam(name = "id") int id, @WebParam(name = "devdesc") String description) {

                String res = "";
                try {
                    String sq = "Insert into projects(uniquename,id,descrption) values ('"
                            + name + "','"
                            + id + "','"
                            + description + "');";
                    PreparedStatement st = con.prepareStatement(sq);
                    st.execute();
                    res = "Success";
                } catch (Exception e) {
                    res = e.toString();
                }

                return res;
            }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "search")
            public String search(@WebParam(name = "name") String name) {
                String res = "";
                this.id = 0;
                this.uniquename = "";
                this.desc = "";

                try {
                    String query = "SELECT * FROM projects where uniquename='" + name + "';";

                    // create the java statement
                    Statement st = con.createStatement();

                    // execute the query, and get a java resultset
                    ResultSet rs = st.executeQuery(query);

                    // iterate through the java resultset
                    while (rs.next()) {
                        this.id = Integer.valueOf(rs.getString("id"));
                        this.uniquename = rs.getString("uniquename");
                        this.desc = rs.getString("description");

                    }
                    st.close();
                    res = "Found";
                } catch (SQLException e) {
                    res = e.toString();
                }

                return res;
            }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "delete")
            public String delete(@WebParam(name = "name") String name) {
                String res = "";
                try {
                    String sq = "Delete from projects where uniquename ='" + name + "';";
                    PreparedStatement st = con.prepareStatement(sq);
                    st.execute();
                    res = "Success";
                } catch (Exception e) {
                    res = e.toString();
                }

                return res;
            }

            /**
             * Web service operation
             */
            @WebMethod(operationName = "update")
            public String update(@WebParam(name = "name") String name, @WebParam(name = "id") int id, @WebParam(name = "devdesc") String description) {
                String res = "";
                String found = this.search(uniquename);

                if (found.equals("Found")) {
                    try {
                        String query = "update projects set id = '"
                                + String.valueOf(id) + "', description = '"
                                + description + "' where uniquename = '"
                                + name + "'";
                        PreparedStatement preparedStmt = con.prepareStatement(query);
                        // execute the java preparedstatement
                        preparedStmt.executeUpdate();
                        res = "Success";
                    } catch (SQLException e) {
                        res = e.toString();
                    }
                } else {
                    res = "Not Exist";
                }
                return res;
            }





        }

changing property name does not work




Aucun commentaire:

Enregistrer un commentaire