java - Passing Array to SOAP causes Error 500 -
im stuck in terrible problem, have soap based webservice implemented in java.the client besides other data supposed have "male" , "female" checkboxes user can either select 1 of them or both , client supposed send server stored in database, multivalued entity, gives me error 500, failure on server side here code client, in advance time:
private void salvaactionperformed(java.awt.event.actionevent evt) { // todo add handling code here: disease=malattia.gettext(); sexarra=new string[sexint]; if(sexint==1) sexarra[0]=sexone; else if(sexint==0) joptionpane.showmessagedialog(null, "bisogna specificare almeno un valore del campo sesso", "errore", joptionpane.error_message); else{ sexarra[0]=sexone; sexarra[1]=sextwo;} // system.out.print(sexarra[0]); // system.out.println(sexarra[1]); description=descrizione.gettext(); agestr=eta.gettext(); if(agestr.equalsignorecase("")) joptionpane.showmessagedialog(null, "il campo età non può essere vuoto", "errore", joptionpane.error_message); age=integer.parseint(agestr); if( age<=0 || age>=110){ joptionpane.showmessagedialog(null, "il valore inserito nel campo età non è giusto", "errore", joptionpane.error_message); } else{ try { url url = new url("http://localhost:8080/soap/servlet/rpcrouter"); //costruzione della chiamata call chiamata = new call(); chiamata.settargetobjecturi("urn:serverneuro"); chiamata.setmethodname("aggiungi_malattia"); chiamata.setencodingstyleuri(constants.ns_uri_soap_enc); soapmappingregistry smr = new soapmappingregistry(); stringdeserializer sd = new stringdeserializer (); smr.maptypes (constants.ns_uri_soap_enc, new qname ("", "return"), null, null, sd); chiamata.setsoapmappingregistry(smr); //creazione dei parametri vector parametri = new vector(); parametri.addelement(new parameter("malattia", string.class, disease, null)); parametri.addelement(new parameter("eta", integer.class, age, null)); parametri.addelement(new parameter("descrizione", string.class, description, null)); parametri.addelement(new parameter("sexarra",string[].class, sexarra, null)); chiamata.setparams(parametri); try { response risp = chiamata.invoke(url, ""); if (risp.generatedfault()) { fault fault = risp.getfault(); system.err.println("chimata fallita"); system.err.println("code: " + fault.getfaultcode()); system.err.println("descrizione: " + fault.getfaultstring()); } else { parameter par = risp.getreturnvalue(); msg = (string) par.getvalue(); system.out.print(msg); } } catch (soapexception e) { system.out.println("errore causata da: (" + e.getfaultcode() + ") :" + e.getmessage()); msg = "errore"; } } catch (malformedurlexception ex) { system.out.println("exception: " + ex.getmessage()); } system.out.println(msg); if (msg.equals("si")) { joptionpane.showmessagedialog(null, "la registrazione è avvenuta con successo", "registrazione", joptionpane.information_message); } else{ joptionpane.showmessagedialog(null, "attenzione il utente inserito è gia esistente nel database", "attenzione", joptionpane.error_message); } } } private void femminaactionperformed(java.awt.event.actionevent evt) { // todo add handling code here: if(femmina.isselected()){ if(sexint==0){ sexint++; sexone=femmina.gettext(); } else if(sexint==1){ sexint++; sextwo=femmina.gettext(); } else sexint--; system.out.println(sexint); } } private void maschioactionperformed(java.awt.event.actionevent evt) { if(maschio.isselected()){ if(sexint==0){ sexint++; sexone=maschio.gettext(); } else if(sexint==1){ sexint++; sextwo=maschio.gettext(); } else sexint--; system.out.println(sexint); } }
here server code:
public string aggiungi_malattia(string malattia, integer eta,string descrizione,string[] sexarra) { string ris = "no"; string q = null, w = null; string errore = connetti(); //inserimeto dei dati del utente dentro la tabella login if(sexarra[1]== null){ q = "insert malattia (nome, eta, descrizione, sesso) " + "values ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[0] + "')";} else{ q = "insert malattia (nome, eta, descrizione, sesso) " + "values ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[0] + "')"; w="insert malattia (nome, eta, descrizione, sesso) " + "values ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[1] + "')"; } if (errore.equals("")) { try { statement st = conn.createstatement(); if(sexarra[1]==null){ st.executeupdate(q); st.executeupdate(w); } else st.executeupdate(q); st.close(); conn.close(); ris = "si"; } catch (sqlexception e) { system.out.println("errore: " + e.getmessage()); return ris; } } return ris; }
this last lines of catalina.out doesn't make sense me.i suspect array might causing since determined @ run-time, couldn't find other way it, hints here appreciated
jul 20, 2011 11:35:22 pm org.apache.catalina.realm.combinedrealm startinternal severe: failed start "org.apache.catalina.realm.userdatabaserealm/1.0" realm org.apache.catalina.lifecycleexception: no userdatabase component found under key userdatabase @ org.apache.catalina.realm.userdatabaserealm.startinternal(userdatabaserealm.java:264) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:145) @ org.apache.catalina.realm.combinedrealm.startinternal(combinedrealm.java:201) @ org.apache.catalina.realm.lockoutrealm.startinternal(lockoutrealm.java:120) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:145) @ org.apache.catalina.core.containerbase.startinternal(containerbase.java:1026) @ org.apache.catalina.core.standardengine.startinternal(standardengine.java:291) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:145) @ org.apache.catalina.core.standardservice.startinternal(standardservice.java:443) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:145) @ org.apache.catalina.core.standardserver.startinternal(standardserver.java:727) @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:145) @ org.apache.catalina.startup.catalina.start(catalina.java:620) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ org.apache.catalina.startup.bootstrap.start(bootstrap.java:303) @ org.apache.catalina.startup.bootstrap.main(bootstrap.java:431) jul 20, 2011 11:35:22 pm org.apache.catalina.startup.hostconfig deploywar info: deploying web application archive soap.war jul 20, 2011 11:35:23 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory manager jul 20, 2011 11:35:23 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory examples jul 20, 2011 11:35:24 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory root jul 20, 2011 11:35:24 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory host-manager jul 20, 2011 11:35:25 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory docs jul 20, 2011 11:35:25 pm org.apache.catalina.startup.hostconfig deploydirectory info: deploying web application directory axis - unable find config file. creating new servlet engine config file: /web-inf/server-config.wsdd jul 20, 2011 11:35:26 pm org.apache.coyote.abstractprotocolhandler start info: starting protocolhandler ["http-bio-8080"] jul 20, 2011 11:35:26 pm org.apache.coyote.abstractprotocolhandler start info: starting protocolhandler ["ajp-bio-8009"] jul 20, 2011 11:35:26 pm org.apache.catalina.startup.catalina start info: server startup in 3780
the exception @ userdatabaserealm means failure setting authentication policies.
have tried accessing server through webpage (using browser)?
Comments
Post a Comment