Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am currently developing a web service:

but when I call this method this error occurred:

"The test form is only available for methods with primitive types as parameters"


Please help me :(( :((

This is my code:
<br />
[WebMethod]<br />
        public FactureTopNet CreationFacture( ref int NUM_FACTURE, ref  int NUM_JUR_FACT,ref  int SOCIETE, ref int TYPE, ref string LOGIN_CREATION,ref  DateTime DATE_CREATION, ref string LOGIN_MODIFICATION,ref  DateTime DATE_MODIFICATION,ref  Decimal MNT_FACT,ref  decimal REMISE, ref decimal NET_PAYE,ref decimal REST_PAYE,ref  string OBSERV, ref int ID_CLIENT,ref  string REMARQUE,ref  string MONTANTTEXT, ref int TIMBRE, ref int AVOIR, ref int NUM_LISTE,ref  int ID_REV,ref  int NUM_PF, ref int NUM_PP, ref string REFERENCE, ref string CLE, ref int ID_COM,ref  decimal MONTANT_COM, ref DateTime DATE_COM,ref int RED_COM, ref  int INTER_GROUPE)<br />
        {<br />
<br />
            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();<br />
            conn.ConnectionString = @"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=topnet;Initial Catalog=TopnetBase;Data Source=SWEET-4B6F892B4\SQLEXPRESS";<br />
            conn.Open();<br />
            FactureTopNet facture = new FactureTopNet();<br />
            int r;<br />
            string req = "INSERT INTO facture (NUM_FACTURE, NUM_JUR_FACT, SOCIETE, TYPE, LOGIN_CREATION, DATE_CREATION,LOGIN_MODIFICATION,DATE_MODIFICATION,MNT_FACT, REMISE, NET_PAYE, REST_PAYE, OBSERV, ID_CLIENT, REMARQUE, MONTANTTEXT, TIMBRE, AVOIR,NUM_LISTE,ID_REV,NUM_PF,NUM_PP, REFERENCE, CLE, ID_COM,MONTANT_COM, DATE_COM, RED_COM, INTER_GROUPE)VALUES('" + NUM_FACTURE + "','" + NUM_JUR_FACT + "','" + SOCIETE + "','" + TYPE + "','" + LOGIN_CREATION + "','" +DATE_CREATION + "','" + LOGIN_MODIFICATION + "','" + DATE_MODIFICATION + "','" + MNT_FACT + "','" + REMISE + "','" + NET_PAYE + "','" + REST_PAYE + "','" + OBSERV + "','" + ID_CLIENT + "','" + REMARQUE + "','" + MONTANTTEXT + "','" + TIMBRE + "','" + AVOIR + "','" + NUM_LISTE + "','" + ID_REV + "','" + NUM_PF + "','" + NUM_PP + "','" + REFERENCE + "','" + CLE + "','" + ID_COM + "','" +MONTANT_COM + "','" + DATE_COM + "','" + RED_COM + "','" + INTER_GROUPE + "')";<br />
            System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(req, conn);<br />
            r = command.ExecuteNonQuery();<br />
            facture.NUM_FACTURE = NUM_FACTURE;<br />
            facture.NUM_JUR_FACT = NUM_JUR_FACT;<br />
           <br />
            facture.SOCIETE = SOCIETE;<br />
            facture.TYPE = TYPE;<br />
            facture.LOGIN_CREATION = LOGIN_CREATION;<br />
            facture.DATE_CREATION = DATE_CREATION;<br />
            facture.LOGIN_MODIFICATION = LOGIN_MODIFICATION;<br />
            facture.DATE_MODIFICATION = DATE_MODIFICATION;<br />
            facture.MNT_FACT = MNT_FACT;<br />
            facture.REMISE = REMISE;<br />
            facture.NET_PAYE = NET_PAYE;<br />
            facture.REST_PAYE = REST_PAYE;<br />
            facture.OBSERV = OBSERV;<br />
            facture.ID_CLIENT = ID_CLIENT;<br />
            facture.REMARQUE = REMARQUE;<br />
            facture.MONTANTTEXT = MONTANTTEXT;<br />
            facture.TIMBRE = TIMBRE;<br />
            facture.AVOIR = AVOIR;<br />
            facture.NUM_LISTE = NUM_LISTE;<br />
            facture.ID_REV = ID_CLIENT;<br />
            facture.NUM_PF = NUM_PF;<br />
            facture.NUM_PP = NUM_PP;<br />
            facture.REFERENCE = REFERENCE;<br />
            facture.CLE = CLE;<br />
            facture.ID_COM = ID_COM;<br />
            facture.MONTANT_COM = MONTANT_COM;<br />
            facture.DATE_COM = DATE_COM;<br />
            facture.RED_COM = RED_COM;<br />
            facture.INTER_GROUPE = INTER_GROUPE;<br />
            return facture;<br />
            <br />
            <br />
            <br />
<br />
        }<br />
Posted

I wrote a tip trick about it:

Pass Dynamic List of Parameters to Web Service[^]

That should get you started.
 
Share this answer
 
v2
I'm pretty sure you can't use ref as a parameter modifier. Instead of doing th parameter list from hell, create a XML string and pass just one parameter, and return a xml string with the results.

Believe me - it's much simpler and easier to maintain.
 
Share this answer
 
May be this is due to data type mismatch.You can check this page

http://forums.asp.net/t/1373290.aspx[^]
 
Share this answer
 
I already implemented my method without using the ref but it show me this message:

This XML file does not seem to have any style information associated with it.


Also please explain to me how to create a XML string and pass just one parameter, and return a xml string with the results, because I'm begginer in web service.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900