Question

My provider must have an array of object as input parameter, according to the WSDL:

<element name="classifica" type="Q4:Titolario" maxOccurs="unbounded" minOccurs="0"/>

This is the generated method:

public void protoModificaProtocollo(...,...,...,Titolario[] classifica,....) {

How to get the input values of this array (always returns null).

EDIT

This is the xsd schema of the method to provide:

<import schemaLocation="TipoVerso.xsd" namespace="http://regione.toscana.it/rfc205/interpro.TipoVerso"/>            
<import schemaLocation="Anagrafica.xsd" namespace="http://regione.toscana.it/rfc205/interpro.Anagrafica"/>
<import schemaLocation="Titolario.xsd" namespace="http://regione.toscana.it/rfc205/interpro.Titolario"/>
    <element name="protoModificaProtocolloElement" type="tns:protoModificaProtocollo"/>

    <complexType name="protoModificaProtocollo">
      <sequence>
            <element name="numero" type="int" maxOccurs="1" minOccurs="1"/>
            <element name="anno" type="int" maxOccurs="1" minOccurs="1"/>
            <element name="verso" type="Q1:TipoVerso" maxOccurs="1" minOccurs="1"/>
            <element name="oggetto" type="string" maxOccurs="1" minOccurs="0"/>
            <element name="classifica" type="Q4:Titolario" maxOccurs="unbounded" minOccurs="0"/>
            <element name="ufficio" type="Q2:Anagrafica" maxOccurs="unbounded" minOccurs="0"/>
     </sequence>
    </complexType>

and this is the xsd schema of Titolario

<?xml version="1.0" encoding="UTF-8"?>
  <schema targetNamespace="http://regione.toscana.it/rfc205/interpro.Titolario"    
      elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"  
      xmlns:tns="http://regione.toscana.it/rfc205/interpro.Titolario">
   <complexType name="Titolario">
    <sequence>
        <element name="codice" type="string" maxOccurs="1" minOccurs="1"></element>
        <element name="descrizione" type="string" maxOccurs="1" minOccurs="0">           
            </element>
    </sequence>
   </complexType>
  </schema>

Here the SOAP message sent:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
   xmlns:int="http://regione.toscana.it/rfc205/interpro" 
   xmlns:int1="http://regione.toscana.it/rfc205/interpro.protoModificaProtocollo"  
   xmlns:int2="http://regione.toscana.it/rfc205/interpro.Titolario" 
   xmlns:int3="http://regione.toscana.it/rfc205/interpro.Anagrafica">
    <soapenv:Header/>
    <soapenv:Body>
     <int:protoModificaProtocollo>
       <int1:numero>140</int1:numero>
       <int1:anno>2014</int1:anno>
       <int1:verso>P</int1:verso>
       <!--Optional:-->
       <int1:oggetto>test</int1:oggetto>
       <!--Zero or more repetitions:-->
       <int1:classifica>
         <int2:codice>34</int2:codice>
         <!--Optional:-->
         <int2:descrizione>test description</int2:descrizione>
       </int1:classifica>
     </int:protoModificaProtocollo>
    </soapenv:Body>
</soapenv:Envelope>

In the provider, this is the method:

public void protoModificaProtocollo(int numero, int anno, TipoVerso verso, 
  String oggetto, Titolario[] classificazione, Anagrafica[] ufficio, 
  ResponseProtocolloHolder protocollo_resp, ResponseErrorHolder response_msg_err) {

  ... some stuff here ...

  System.out.println("getCodice():" + classificazione[0].getCodice()); <-- THIS LINE ALWAYS RETURNS NULL

Notice that, in input parameters, if I change

Titolario[] classificazione

with

Titolario classificazione

my debug line prints:

34

UPDATE 2

TIA Simon, here pastebin you can find the full WSDL. And here Titolario.java the class for Titolario. I've noticed that when consumer call provider, Titolario constructor i call N times, depending of number of Titolario occurrences in SOAP request. As you can see, the constructor is an empty constructor.

In this moment, my protocol is RPC/encoded, just becouse i've must understand the problem reported here Literal vs Encoded (if you please can take a look also at this...:-))

I've found some references about the problem, for example this article, maybe related to mine.

Anyway, i would like to know if there is a Java workaround to manage this. Thanks again!

Was it helpful?

Solution

Found the problem!

The fact was that i've used the same given WSDL both to generate the provider and to create the SoapUI project.

Basically the trick was:

  1. generate the provider in Domino using the given WSDL
  2. set RPC/Literal, according to the <soap:body use="literal"/> directive
  3. export the Domino WSDL of the provider
  4. create the SoapUI project with it
  5. use it to call services provided

That's it! ... a very stupid mistake! :-(

OTHER TIPS

Without a full WSDL I can't say with 100% this is the issue.

Based on what you have so far.

1. There are known issues where the "xsd:string" is wrapped with custom string handler. I have see references before where "string" would just sit on top of "xsd:string". So I would start with changing that back to "xsd:string" and see if it helps.

2. As your web service provider has the following:

Titolario[] classifica

Normally your WSDL should create an xxxArray Object which your consumer sends, and not the array object itself. (Tested on Doc/Literal + RPC/Literal, as "minoccurs" only shows up on Literal).

For example:

public String TestProtoModificaProtocollo (Titolario x[]) { ...

Converts to:

<complexType name="Titolario">
  <sequence>
    <element name="codice" nillable="true" type="xsd:string"/>
    <element maxOccurs="unbounded" minOccurs="0" name="descrizione" nillable="true" type="xsd:string"/>
  </sequence>
</complexType>
<complexType name="TitolarioArray">
  <sequence>
    <element maxOccurs="unbounded" minOccurs="0" name="item" type="impl:Titolario"/>
  </sequence>
</complexType>
<element name="x" type="impl:TitolarioArray"/>
<element name="TestProtoModificaProtocolloReturn" type="xsd:string"/>

So your consumer would translate to:

public java.lang.String testProtoModificaProtocollo(TitolarioArray x) throws java.rmi.RemoteException;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top