You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tim R J Langford <ti...@multicom.co.uk> on 2006/02/14 10:28:32 UTC
How to not send nillable="true" for null elements in a SOAP message
Hello All,
I am writing a client interface into a provider SOAP web service, and
their system fails and returns a null pointer exception when I send them
a 'nillable="true"' element in my request. I think the reason for this
is that they are using an older version of axis than we are using (1.3).
I have found a solution that recommends changing the WSDL of the
generated service :
http://marc.theaimsgroup.com/?l=axis-user&m=111793234530147&w=2
However, this is not ideal, as we do not have control over this WSDL
(belongs to the provider) so even though we can modify their file I
would prefer not to.
Are there any options in Axis that would allow us not to send anything
when we have a such null element, as opposed to sending
'nillable="true"'? If not where should I make the change? I could add a
handler to the client to strip these elements out before they are sent,
but this is probably not very efficient.
Anyhelp would be appreciated!
Thanks for you time,
Tim
Re: How to not send nillable="true" for null elements in a SOAP message
Posted by Tim R J Langford <ti...@multicom.co.uk>.
Thanks Rod,
I agree with you and will handle it this way.
Thankyou everyone for your help and advice,
Tim
Rodrigo Ruiz wrote:
> By what you describe, I think you should add minOccurs='0' and remove
> nillable='true'
>
> Regards,
> Rodrigo Ruiz
>
> Tim R J Langford wrote:
>
>> Thanks Anne,
>>
>> Thats what I thought. Unfortunatly our provider does not seem too
>> clued up on their tech, and the wsdl does not allow minOccurs="0". I
>> guess I will have to update our automated build process to fix their
>> schema before generating my soap beans and classes. The best way to
>> do this would be by adding minOccurs="0" to the faulty elements I
>> presume?
>>
>> Thanks to everybody for their time,
>>
>> Tim
>>
>>
>> Anne Thomas Manes wrote:
>>
>>> If the service cannot accept xsi:nil="true" then the service
>>> provider should adjust the schema accordingly. Does the schema allow
>>> minOccurs="0"? If not, then there's no valid way to send no element
>>> instead of xsi:nil="true".
>>>
>>> Anne
>>>
>>> On 2/14/06, *Tim R J Langford* <tim@multicom.co.uk
>>> <ma...@multicom.co.uk>> wrote:
>>>
>>>
>>> Hi Jeff,
>>>
>>> Thanks for your response.
>>>
>>> Sorry for being unclear. Yes you are correct. I am sending
>>> 'xsi:nil="true"' and I want to configure axis to send nothing
>>> instead
>>> of this string. e.g : *
>>>
>>> <XXX* xsi:type="xsd:string" xsi:nil="true"/>*
>>> <YYY* xsi:type="zzz:YYY" xsi:nil="true" xmlns:zzz="KKK"*/>
>>>
>>> *I think Axis 1.2 did it this way? Is there anyway of configuring
>>> Axis
>>> 1.3 to not send these 'xsi:nil="true"' elements?
>>>
>>> Thanks for you time,
>>>
>>> Tim
>>>
>>>
>>> PS: The service wsdl does have 'xsd:nillable="true"' elements
>>> in the
>>> message schema, but their system cannot actually handle the
>>> situation
>>> where it is null (even if they return it in a response), and
>>> they have
>>> asked us to remove the 'xsi:nil="true"' elements from our
>>> requests. We
>>> could fix the wsdl schema, but this would impede our codegen
>>> system as
>>> we are the client, so were wondering if there was a way to do it
>>> from
>>> within axis?*
>>>
>>>
>>>
>>> *
>>>
>>> Jeff Greif wrote:
>>>
>>> >Just to be sure, you're sending xsi:nil="true", not
>>> xsd:nillable="true", right?
>>> >
>>> >The latter is used only in the schema, and means that the
>>> element is
>>> >allowed to have no content. The former means that this
>>> particular use
>>> >of the element has no content.
>>> >
>>> >Jeff
>>> >
>>> >On 2/14/06, Tim R J Langford <tim@multicom.co.uk
>>> <ma...@multicom.co.uk>> wrote:
>>> >
>>> >
>>> >>Hello All,
>>> >>
>>> >>I am writing a client interface into a provider SOAP web
>>> service, and
>>> >>their system fails and returns a null pointer exception when I
>>> send them
>>> >>a 'nillable="true"' element in my request. I think the reason
>>> for this
>>> >>is that they are using an older version of axis than we are
>>> using ( 1.3).
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>>
>>>
>>
>>
>>
>
Re: How to not send nillable="true" for null elements in a SOAP message
Posted by Tim R J Langford <ti...@multicom.co.uk>.
Hello All,
I am still trying to remove 'nil="true"' elements from my messages sent
out by axis. I have modified the wsdl in elements where I want axis not
to send these strings (i.e: have a "blank" element) as follows :
<element name="sendNothingIfNull" nillable="true" type="xsd:string"/>
to :
<element name="sendNothingIfNull" nillable="false" minOccurs="0"
type="xsd:string"/>
so that instead of sending :
<someXML>
<sendNothingIfNull xsi:type="xsd:string" xsi:nil="true"/>
</someXML>
I send something like :
<someXML></someXML>
I have tried a few other methods (such as the one Rod suggested not
specifying "nillable" at all in the schema and setting minOccurs="0")
but axis keeps sending these elements as nillable. Should this work or
am I making a mistake somwhere?
It may be PEBCAK but I just cant get axis1.3 to exhibit the behavior
the server expects. Is there any other lower level method in axis to
deal with this? (I traced the code calls down to the HTTP sender class
but even at this level there is no easy access to the string as it is
being passed by chunk encoded HTTP - and of course in some cases the
server we are trying to attach too actually wants us to send these
nillable="true" elements so this approach is not suitable).
I know I must have exhausted all you guys by now! Sorry, and thanks.
Tim
PS: I am generating the axis code form the wsdl using the following ant
task configuration :
<axis-wsdl2java
output="${src.dir}"
deployScope="Application"
verbose="true"
serverSide="true"
wrapArrays="true"
url="eurostar_hack2.wsdl">
</axis-wsdl2java>
Rodrigo Ruiz wrote:
> By what you describe, I think you should add minOccurs='0' and remove
> nillable='true'
>
> Regards,
> Rodrigo Ruiz
>
> Tim R J Langford wrote:
>
>> Thanks Anne,
>>
>> Thats what I thought. Unfortunatly our provider does not seem too
>> clued up on their tech, and the wsdl does not allow minOccurs="0". I
>> guess I will have to update our automated build process to fix their
>> schema before generating my soap beans and classes. The best way to
>> do this would be by adding minOccurs="0" to the faulty elements I
>> presume?
>>
>> Thanks to everybody for their time,
>>
>> Tim
>>
>>
>> Anne Thomas Manes wrote:
>>
>>> If the service cannot accept xsi:nil="true" then the service
>>> provider should adjust the schema accordingly. Does the schema allow
>>> minOccurs="0"? If not, then there's no valid way to send no element
>>> instead of xsi:nil="true".
>>>
>>> Anne
>>>
>>> On 2/14/06, *Tim R J Langford* <tim@multicom.co.uk
>>> <ma...@multicom.co.uk>> wrote:
>>>
>>>
>>> Hi Jeff,
>>>
>>> Thanks for your response.
>>>
>>> Sorry for being unclear. Yes you are correct. I am sending
>>> 'xsi:nil="true"' and I want to configure axis to send nothing
>>> instead
>>> of this string. e.g : *
>>>
>>> <XXX* xsi:type="xsd:string" xsi:nil="true"/>*
>>> <YYY* xsi:type="zzz:YYY" xsi:nil="true" xmlns:zzz="KKK"*/>
>>>
>>> *I think Axis 1.2 did it this way? Is there anyway of configuring
>>> Axis
>>> 1.3 to not send these 'xsi:nil="true"' elements?
>>>
>>> Thanks for you time,
>>>
>>> Tim
>>>
>>>
>>> PS: The service wsdl does have 'xsd:nillable="true"' elements
>>> in the
>>> message schema, but their system cannot actually handle the
>>> situation
>>> where it is null (even if they return it in a response), and
>>> they have
>>> asked us to remove the 'xsi:nil="true"' elements from our
>>> requests. We
>>> could fix the wsdl schema, but this would impede our codegen
>>> system as
>>> we are the client, so were wondering if there was a way to do it
>>> from
>>> within axis?*
>>>
>>>
>>>
>>> *
>>>
>>> Jeff Greif wrote:
>>>
>>> >Just to be sure, you're sending xsi:nil="true", not
>>> xsd:nillable="true", right?
>>> >
>>> >The latter is used only in the schema, and means that the
>>> element is
>>> >allowed to have no content. The former means that this
>>> particular use
>>> >of the element has no content.
>>> >
>>> >Jeff
>>> >
>>> >On 2/14/06, Tim R J Langford <tim@multicom.co.uk
>>> <ma...@multicom.co.uk>> wrote:
>>> >
>>> >
>>> >>Hello All,
>>> >>
>>> >>I am writing a client interface into a provider SOAP web
>>> service, and
>>> >>their system fails and returns a null pointer exception when I
>>> send them
>>> >>a 'nillable="true"' element in my request. I think the reason
>>> for this
>>> >>is that they are using an older version of axis than we are
>>> using ( 1.3).
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>>
>>>
>>
>>
>>
>
Re: How to not send nillable="true" for null elements in a SOAP message
Posted by Rodrigo Ruiz <rr...@gridsystems.com>.
By what you describe, I think you should add minOccurs='0' and remove
nillable='true'
Regards,
Rodrigo Ruiz
Tim R J Langford wrote:
> Thanks Anne,
>
> Thats what I thought. Unfortunatly our provider does not seem too
> clued up on their tech, and the wsdl does not allow minOccurs="0". I
> guess I will have to update our automated build process to fix their
> schema before generating my soap beans and classes. The best way to do
> this would be by adding minOccurs="0" to the faulty elements I presume?
>
> Thanks to everybody for their time,
>
> Tim
>
>
> Anne Thomas Manes wrote:
>
>> If the service cannot accept xsi:nil="true" then the service provider
>> should adjust the schema accordingly. Does the schema allow
>> minOccurs="0"? If not, then there's no valid way to send no element
>> instead of xsi:nil="true".
>>
>> Anne
>>
>> On 2/14/06, *Tim R J Langford* <tim@multicom.co.uk
>> <ma...@multicom.co.uk>> wrote:
>>
>>
>> Hi Jeff,
>>
>> Thanks for your response.
>>
>> Sorry for being unclear. Yes you are correct. I am sending
>> 'xsi:nil="true"' and I want to configure axis to send nothing
>> instead
>> of this string. e.g : *
>>
>> <XXX* xsi:type="xsd:string" xsi:nil="true"/>*
>> <YYY* xsi:type="zzz:YYY" xsi:nil="true" xmlns:zzz="KKK"*/>
>>
>> *I think Axis 1.2 did it this way? Is there anyway of configuring
>> Axis
>> 1.3 to not send these 'xsi:nil="true"' elements?
>>
>> Thanks for you time,
>>
>> Tim
>>
>>
>> PS: The service wsdl does have 'xsd:nillable="true"' elements in
>> the
>> message schema, but their system cannot actually handle the
>> situation
>> where it is null (even if they return it in a response), and they
>> have
>> asked us to remove the 'xsi:nil="true"' elements from our
>> requests. We
>> could fix the wsdl schema, but this would impede our codegen
>> system as
>> we are the client, so were wondering if there was a way to do it
>> from
>> within axis?*
>>
>>
>>
>> *
>>
>> Jeff Greif wrote:
>>
>> >Just to be sure, you're sending xsi:nil="true", not
>> xsd:nillable="true", right?
>> >
>> >The latter is used only in the schema, and means that the
>> element is
>> >allowed to have no content. The former means that this
>> particular use
>> >of the element has no content.
>> >
>> >Jeff
>> >
>> >On 2/14/06, Tim R J Langford <tim@multicom.co.uk
>> <ma...@multicom.co.uk>> wrote:
>> >
>> >
>> >>Hello All,
>> >>
>> >>I am writing a client interface into a provider SOAP web
>> service, and
>> >>their system fails and returns a null pointer exception when I
>> send them
>> >>a 'nillable="true"' element in my request. I think the reason
>> for this
>> >>is that they are using an older version of axis than we are
>> using ( 1.3).
>> >>
>> >>
>> >
>> >
>> >
>>
>>
>
>
>
Re: How to not send nillable="true" for null elements in a SOAP message
Posted by Tim R J Langford <ti...@multicom.co.uk>.
Thanks Anne,
Thats what I thought. Unfortunatly our provider does not seem too clued
up on their tech, and the wsdl does not allow minOccurs="0". I guess I
will have to update our automated build process to fix their schema
before generating my soap beans and classes. The best way to do this
would be by adding minOccurs="0" to the faulty elements I presume?
Thanks to everybody for their time,
Tim
Anne Thomas Manes wrote:
> If the service cannot accept xsi:nil="true" then the service provider
> should adjust the schema accordingly. Does the schema allow
> minOccurs="0"? If not, then there's no valid way to send no element
> instead of xsi:nil="true".
>
> Anne
>
> On 2/14/06, *Tim R J Langford* <tim@multicom.co.uk
> <ma...@multicom.co.uk>> wrote:
>
>
> Hi Jeff,
>
> Thanks for your response.
>
> Sorry for being unclear. Yes you are correct. I am sending
> 'xsi:nil="true"' and I want to configure axis to send nothing instead
> of this string. e.g : *
>
> <XXX* xsi:type="xsd:string" xsi:nil="true"/>*
> <YYY* xsi:type="zzz:YYY" xsi:nil="true" xmlns:zzz="KKK"*/>
>
> *I think Axis 1.2 did it this way? Is there anyway of configuring
> Axis
> 1.3 to not send these 'xsi:nil="true"' elements?
>
> Thanks for you time,
>
> Tim
>
>
> PS: The service wsdl does have 'xsd:nillable="true"' elements in the
> message schema, but their system cannot actually handle the situation
> where it is null (even if they return it in a response), and they have
> asked us to remove the 'xsi:nil="true"' elements from our requests. We
> could fix the wsdl schema, but this would impede our codegen
> system as
> we are the client, so were wondering if there was a way to do it from
> within axis?*
>
>
>
> *
>
> Jeff Greif wrote:
>
> >Just to be sure, you're sending xsi:nil="true", not
> xsd:nillable="true", right?
> >
> >The latter is used only in the schema, and means that the element is
> >allowed to have no content. The former means that this
> particular use
> >of the element has no content.
> >
> >Jeff
> >
> >On 2/14/06, Tim R J Langford <tim@multicom.co.uk
> <ma...@multicom.co.uk>> wrote:
> >
> >
> >>Hello All,
> >>
> >>I am writing a client interface into a provider SOAP web
> service, and
> >>their system fails and returns a null pointer exception when I
> send them
> >>a 'nillable="true"' element in my request. I think the reason
> for this
> >>is that they are using an older version of axis than we are
> using ( 1.3).
> >>
> >>
> >
> >
> >
>
>
Re: How to not send nillable="true" for null elements in a SOAP message
Posted by Anne Thomas Manes <at...@gmail.com>.
If the service cannot accept xsi:nil="true" then the service provider should
adjust the schema accordingly. Does the schema allow minOccurs="0"? If not,
then there's no valid way to send no element instead of xsi:nil="true".
Anne
On 2/14/06, Tim R J Langford <ti...@multicom.co.uk> wrote:
>
>
> Hi Jeff,
>
> Thanks for your response.
>
> Sorry for being unclear. Yes you are correct. I am sending
> 'xsi:nil="true"' and I want to configure axis to send nothing instead
> of this string. e.g : *
>
> <XXX* xsi:type="xsd:string" xsi:nil="true"/>*
> <YYY* xsi:type="zzz:YYY" xsi:nil="true" xmlns:zzz="KKK"*/>
>
> *I think Axis 1.2 did it this way? Is there anyway of configuring Axis
> 1.3 to not send these 'xsi:nil="true"' elements?
>
> Thanks for you time,
>
> Tim
>
>
> PS: The service wsdl does have 'xsd:nillable="true"' elements in the
> message schema, but their system cannot actually handle the situation
> where it is null (even if they return it in a response), and they have
> asked us to remove the 'xsi:nil="true"' elements from our requests. We
> could fix the wsdl schema, but this would impede our codegen system as
> we are the client, so were wondering if there was a way to do it from
> within axis?*
>
>
>
> *
>
> Jeff Greif wrote:
>
> >Just to be sure, you're sending xsi:nil="true", not xsd:nillable="true",
> right?
> >
> >The latter is used only in the schema, and means that the element is
> >allowed to have no content. The former means that this particular use
> >of the element has no content.
> >
> >Jeff
> >
> >On 2/14/06, Tim R J Langford <ti...@multicom.co.uk> wrote:
> >
> >
> >>Hello All,
> >>
> >>I am writing a client interface into a provider SOAP web service, and
> >>their system fails and returns a null pointer exception when I send them
> >>a 'nillable="true"' element in my request. I think the reason for this
> >>is that they are using an older version of axis than we are using (1.3).
> >>
> >>
> >
> >
> >
>
>
Re: How to not send nillable="true" for null elements in a SOAP message
Posted by Tim R J Langford <ti...@multicom.co.uk>.
Hi Jeff,
Thanks for your response.
Sorry for being unclear. Yes you are correct. I am sending
'xsi:nil="true"' and I want to configure axis to send nothing instead
of this string. e.g : *
<XXX* xsi:type="xsd:string" xsi:nil="true"/>*
<YYY* xsi:type="zzz:YYY" xsi:nil="true" xmlns:zzz="KKK"*/>
*I think Axis 1.2 did it this way? Is there anyway of configuring Axis
1.3 to not send these 'xsi:nil="true"' elements?
Thanks for you time,
Tim
PS: The service wsdl does have 'xsd:nillable="true"' elements in the
message schema, but their system cannot actually handle the situation
where it is null (even if they return it in a response), and they have
asked us to remove the 'xsi:nil="true"' elements from our requests. We
could fix the wsdl schema, but this would impede our codegen system as
we are the client, so were wondering if there was a way to do it from
within axis?*
*
Jeff Greif wrote:
>Just to be sure, you're sending xsi:nil="true", not xsd:nillable="true", right?
>
>The latter is used only in the schema, and means that the element is
>allowed to have no content. The former means that this particular use
>of the element has no content.
>
>Jeff
>
>On 2/14/06, Tim R J Langford <ti...@multicom.co.uk> wrote:
>
>
>>Hello All,
>>
>>I am writing a client interface into a provider SOAP web service, and
>>their system fails and returns a null pointer exception when I send them
>>a 'nillable="true"' element in my request. I think the reason for this
>>is that they are using an older version of axis than we are using (1.3).
>>
>>
>
>
>
Re: How to not send nillable="true" for null elements in a SOAP message
Posted by Jeff Greif <je...@gmail.com>.
Just to be sure, you're sending xsi:nil="true", not xsd:nillable="true", right?
The latter is used only in the schema, and means that the element is
allowed to have no content. The former means that this particular use
of the element has no content.
Jeff
On 2/14/06, Tim R J Langford <ti...@multicom.co.uk> wrote:
> Hello All,
>
> I am writing a client interface into a provider SOAP web service, and
> their system fails and returns a null pointer exception when I send them
> a 'nillable="true"' element in my request. I think the reason for this
> is that they are using an older version of axis than we are using (1.3).