Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6239899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:28:16+00:00 2026-05-24T11:28:16+00:00

im stuck in this terrible problem, I have a SOAP based webservice implemented in

  • 0

im stuck in this terrible problem, I have a SOAP based webservice implemented in Java.The client besides other data is supposed to have “male” and “female” checkboxes so the user can either select one of them or both and the client is supposed to send it to the server to be stored in the database, where it is a multivalued entity, but it gives me Error 500, the failure on Server side, is the way i pass the array and then use it on server side correct? if not how could i pass and process it? here is the code for Client, Thanks in advance for your time:

private void salvaActionPerformed(java.awt.event.ActionEvent evt) {                                      
    // TODO add your 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 your 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 is the 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.length == 2){
        q = "INSERT INTO malattia (nome, eta, descrizione, sesso) "
            + "VALUES ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[0] + "')";}
    else{
        q = "INSERT INTO malattia (nome, eta, descrizione, sesso) "
            + "VALUES ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[0] + "')";
        w="INSERT INTO malattia (nome, eta, descrizione, sesso) "
            + "VALUES ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[1] + "')";
    }

    if (errore.equals("")) {
        try {
            Statement st = conn.createStatement();
            if(sexarra.lenght == 2){
                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 is last lines of Catalina.out it doesn’t make any sense to me.I suspect that the Array might be causing it since its determined at run-time, i couldn’t find any other way to do it, hints here will be appreciated

    Jul 20, 2011 11:35:22 PM org.apache.catalina.realm.CombinedRealm startInternal
    SEVERE: Failed to start "org.apache.catalina.realm.UserDatabaseRealm/1.0" realm
    org.apache.catalina.LifecycleException: No UserDatabase component found under key UserDatabase
        at org.apache.catalina.realm.UserDatabaseRealm.startInternal(UserDatabaseRealm.java:264)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.realm.CombinedRealm.startInternal(CombinedRealm.java:201)
        at org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:120)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
                at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1026)
                at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
        at 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 to 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 

Unfortunately even after changing the code which i thought could be throwing NPE, it still hasnt changed anything. I changed from
if(sexarra[1]==null){….}

to
if(sexarra.lenght == 2){…}

I get the following error:

      Errore causata da: (SOAP-ENV:Protocol) :Unsupported response content type "text/html; charset=utf-8", must be: "text/xml". Response was:

Apache Tomcat/7.0.14 – Error report

HTTP Status 500 –

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Error building response envelope: java.lang.NullPointerException
        org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:418)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.14 logs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:28:17+00:00Added an answer on May 24, 2026 at 11:28 am

    I’m not sure I understand why you’re building SOAP requests by hand and not use some kind of automatic WSDL-to-class generator, one that comes with the JDK, Eclipse or NetBeans. This would give you type / structure safety, but I surely see problems in your code, for example

    if(sexarra[1]== null) { ... }
    

    could possibly throw a NPE or an ArrayIndexOutOfBoundsException. Unfortunately, Tomcat’s output does not make sense to me either, at least not towards your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im stuck with this little project in C# but basically my problem is this:
I am stuck on this problem which I am studying for an exam tomorrow.
I have been stuck on this for days, and was wondering if anyone had
I've been stuck with this for weeks now and have no idea where I'm
I've been trying to solve this, and have been getting stuck, so I thought
I've come a bit stuck this afternoon with a bug in my web application
I'm kinda stuck with this one so I hoped someone could help me. I
I'm kinda stuck on this decision. My project already uses Spring and Spring Blazeds
I'm stuck with this. I'm self studying assenbler and translating some basics instructions. But
I've been stuck with this simple Sql query for last 3 hours and my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.