0

I'm developing a WebService SOAP in Java 1.6 version (constraint of infrastruct of customer) and I need to develop an operation method that take as input an plain object with a String and an array of String, and return an output (after some elaboration). The input object it's made of a String codiceFiscale and the array of String is that field named classificazioni that you see in the code example:

I've this situation on WSDL:

<complexType name="VerificaClassiPFInputDTO">
            <sequence>
                <element name="codiceFiscale" nillable="true" type="xsd:string" />
                <element name="classificazioni" type="xsd:string" nillable="true"
                    minOccurs="0" maxOccurs="unbounded" />
            </sequence>
        </complexType>

and this is my INPUT DTO (java side):

public class VerificaClassiPFInputDTO implements Serializable {


private static final long serialVersionUID = -3933923831884051815L;

/**
 * Codice Fiscale della PF
 */
private String codiceFiscale = "";
/**
 * Array di classificazioni da processare sul codice fiscale passato
 */
private String[] classificazioni = null;

/**
 * Costruttore default
 */
public VerificaClassiPFInputDTO() {
    super();
}

public String getCodiceFiscale() {
    return codiceFiscale;
}

public void setCodiceFiscale(String codiceFiscale) {
    this.codiceFiscale = codiceFiscale;
}

public String[] getClassificazioni() {
    return classificazioni;
}

public void setClassificazioni(String[] classificazioni) {
    this.classificazioni = classificazioni;
}

that String[] it's my array. When I deploy the WS, in a SOAPUI client, the situation for this method is this

enter image description here

and for me is correct. I want "0 on more" String as input in that array, for that field. In this case are three String in the array, and the other string codiceFiscale.

Even in IBM RAD Web Service Explorer tool the situation is this:

enter image description here

so, for me it's ok. But, when I pass more string (in the array) only the last one been processed.

enter image description here

In the code, when I process input, I obtain always an 1 length array of String, with the last one.

enter image description here

So, what's wrong? How can I maps that type of input in WSDL, in the DTO etc? Why does this happen?

If I switct in the DTO the type

from String[] to List<String> classificazioni

don't work that operation, says mismatch type in the format when run, and I try to call method.

Please someone can help me? If I have to change the map in the WSDL, and the DTO accordingly, that's not a problem but how?

What should I put in the WSDL as complextype and consequently in the DTO, in order to have that kind of input?

Please help me....I am going crazy :(

1 Answer 1

1

I think me and my colleagues have solved it. You must write the setClassificazioni method in this way:

ADD other two methods

public String getClassificazioni(int i){
  return classificazioni[i];
}

public void setClassificazioni(int i, String classificazione){
   this.classificazioni[i] = classificazione;
}

IMPORTANT: It works for arrays of all types, also array having not java primitive type. I don't know if it works also with multidimentional array (adapting method).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.