Hi,

Unfortunately in current Axis release (Axis 1.2 RC2) this problem can
not be resolved in any configuraton way, so I just had to patch two
Axis source files: SerializationContext and RPCParam.

org.apache.axis.encoding.SerializationContext

old way:
134:    /**
135:     * Send an element with an xsi:nil="true" attribute for null
136:     * variables (if Boolean.TRUE), or nothing (if Boolean.FALSE).
137:     */
138:    private Boolean sendNull = Boolean.TRUE;

new way:
134:    /**
135:     * Send an element with an xsi:nil="true" attribute for null
136:     * variables (if Boolean.TRUE), or nothing (if Boolean.FALSE).
137:     */
138:    private Boolean sendNull = Boolean.FALSE;

org.apache.axis.message.RPCParam

old way:
177:        context.serialize(getQName(),  // element qname
178:                          null,   // no extra attrs
179:                          value,  // value
180:                          xmlType, // java/xml type
181:                          Boolean.TRUE, wantXSIType);

new way:
177:        context.serialize(getQName(),  // element qname
178:                          null,   // no extra attrs
179:                          value,  // value
180:                          xmlType, // java/xml type
181:                          Boolean.FALSE, wantXSIType);

-- 
Regards,
Andrey

AK> Hi all,

AK> I'm very new to this and probably the problem I've got is basic for
AK> you (but still I didn't find any clues in archive).

AK> Anyway, here is what I'm stuck with.

AK> I have WSDL file and need to develop a client that sends SOAP request
AK> with some required and optional elements. I use WSDL2Java tool from
AK> Axis to generate client stubs from WSDL.

AK> In WSDL optional elements are marked by attribute minOccurs in the
AK> following way: 

AK> <xsd:element name="quantityRequested" type="tns:Individuals" minOccurs="0"/>

AK> In my client I don't fill this optional element with any value. So
AK> when client generates SOAP message this empty element is described
AK> like this:

AK> ...
AK> <quantityRequested xsi:type="xsd:long" xsi:nil="true"/>
AK> ...

AK> The server processes request and when parsing this element it throws
AK> NumberFormatException because this element is empty.
AK> So I make a conclusion that the server does not expect any optional
AK> empty elements in messages, instead it prefers the message not to
AK> contain such elements at all.

AK> My question is: how should I handle this and what is the best way to
AK> make client generate SOAP messages w/out empty optional elements?
AK> Is this a WSDL2Java configuration issue?

AK> --
AK> Thanks,
AK> Andrey
AK> mailto:[EMAIL PROTECTED]

Reply via email to