将Wcf服务应用到Java表单应用程序

时间:2018-02-12 02:23:18

标签: java web-services wcf

我正在将wcf服务用于java windows窗体应用程序。我试图根据帐号显示单个记录到表中,但是当我运行应用程序时,我得到了以下错误..

2018年2月12日上午2:14:45 [com.sun.xml.ws.policy.EffectiveAlternativeSelector] selectAlternatives 警告:WSP0075:策略断言" {http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1} BinaryEncoding"被评估为" UNKNOWN"。 2018年2月12日上午2:14:45 [com.sun.xml.ws.policy.EffectiveAlternativeSelector] selectAlternatives

这是wcf方法。

 public List<AccountBalance> getDetails(string Account_Number)
    {
        List<AccountBalance> lstPinCode = new List<AccountBalance>();
        DataTable dsData = new DataTable();
        dsData = getPincode(Account_Number);

        if (dsData != null)
        {
            foreach (DataRow row in dsData.Rows)
            {
                AccountBalance objPincode = new AccountBalance();
                objPincode.Account_Number = Convert.ToString(row["Account_Number"]);
                objPincode.Account_Creation_Date = Convert.ToString(row["Account_Creation_Date"]);
                objPincode.Account_Type = Convert.ToString(row["Account_Type"]);
                objPincode.Branch_Sort_Code = Convert.ToString(row["Branch_Sort_Code"]);
                objPincode.Account_Fee = Convert.ToString(row["Account_Fess"]);
                objPincode.Account_Balance = Convert.ToString(row["Account_Balance"]);
                objPincode.Over_Draft_Limit = Convert.ToString(row["Over_Draft_Limit"]);
                objPincode.Account_Holder_Id = Convert.ToString(row["Account_Holder_Id"]);

                lstPinCode.Add(objPincode);
            }
        }

        return lstPinCode.ToList();

}


 private DataTable getPincode(string Account_Number)
    {
        DataSet dsData = new DataSet();
        SqlConnection sqlCon = null;
        SqlDataAdapter sqlCmd = null;

        try
        {
            using (sqlCon = new SqlConnection(ConnectionString))
            {
                sqlCmd = new SqlDataAdapter("USP_PINCODECRUD", sqlCon);
                sqlCmd.SelectCommand.CommandType = CommandType.StoredProcedure;
                sqlCmd.SelectCommand.Parameters.AddWithValue("@Account_Number", Account_Number);

                sqlCon.Open();
                sqlCmd.Fill(dsData);

                sqlCon.Close();
            }
        }
        catch
        {
            throw;
        }
        return dsData.Tables[0];
    }

以下是net beans中的代码..

public class RetrieveingData extends javax.swing.JFrame {


    public RetrieveingData() {
        initComponents();
    }
  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        String accountNumber;
         accountNumber = jTextField1.getText();

         getDetails(accountNumber);

         List<ArrayOfAccountBalance> a = (List<ArrayOfAccountBalance>) jTable3.getColumnModel();


//         jTable3.setModel();
    }                                        


    public static void main(String args[]) {


        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new RetrieveingData().setVisible(true);


            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable jTable3;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration                   

    private static ArrayOfAccountBalance getDetails(java.lang.String accountNumber) {
        org.tempuri.CompanyService service = new org.tempuri.CompanyService();
        org.tempuri.IMyCompanyPublicService port = service.getBasicHttpBindingIMyCompanyPublicService();
        return port.getDetails(accountNumber);
    }
}

这是屏幕截图.. enter image description here

0 个答案:

没有答案