Advertisement

09.08.2008 at 02:53PM PDT, ID: 23713695 | Points: 500
[x]
Attachment Details

Generating a SOAPFault using NetBeans generated Web service w/ JAX-WS

Asked by bcrosby333 in Web Services, Web Services Description Language, SOAP

Tags: , ,

I have generated a few web services using NetBeans w/ JAX-WS. I am having trouble generating a valid SOAP Fault on the return SOAP Envelope. Sample Web Service attached. Any Help?Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 
package org;
 
import com.sun.xml.ws.wsdl.writer.document.soap.SOAPFault;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.sql.*;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.ws.BindingType;
import org.apache.jasper.tagplugins.jstl.core.Catch;
/**
 *
 * @author Administrator
 */
@WebService()
@BindingType(value = "http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/")
public class getWorkPackageStatusesWS {
    private Connection _myCon = null;
    /**
     * Web service operation
     */
    @WebMethod(operationName = "returnStatuses")
    public String returnStatuses() throws SQLException {
       Statement stmt = null;
       ResultSet rs = null;
       String returnString = "<results>";
 
        
        try {
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        
        String connectionUrl = "jdbc:sqlserver://XX.X.X.XXX:1433;" +
            "databaseName=SampleDB;user=user;password=pass;";
        
        _myCon = DriverManager.getConnection(connectionUrl);
            
            // Create and execute an SQL statement that returns some data.
         String SQL = "{call dbo.spr_GetWorkPackageStatuses}";
         stmt = _myCon.createStatement();
         rs = stmt.executeQuery(SQL);
 
         // Iterate through the data in the result set and display it.
         while (rs.next()) {
            //System.out.println(rs.getString("ID") + ": " + rs.getString("Name"));
            returnString += "<param>" + "<id>" + rs.getString("ID") + "</id>" + "<name>" + rs.getString("Name") + "</name>" + "</param>";
         }
         
        //con.close();
        
          _myCon.close();
         
        returnString += "</results>";
        
        return returnString;
       
        } 
        catch (SQLException e) {
            //System.out.println("SQL Exception: "+ e.toString());
          return e.toString();
                   } 
        catch (ClassNotFoundException cE) {
            //System.out.println("Class Not Found Exception: "+ cE.toString());
            return cE.toString();
        }
        
        //return null;
    }
 
}
[+][-]09.09.2008 at 08:09AM PDT, ID: 22428205

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.11.2008 at 03:45PM PDT, ID: 22455794

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 08:55AM PDT, ID: 22479949

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]09.18.2008 at 01:01AM PDT, ID: 22508659

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628