Hi everyone,

The "NullPointerException" occurs when there's a null String object that's part
of the composition of another class.
For instance, I have a class called "MyClass" that contains two private
members: a String object and a URL object.  If I leave the String object inside
of "MyClass" null this is when the exception takes place.  Passing a null
String object by itself works.

I apologize if I didn't fully explain this correctly in my original email.

I'm enclosing the client code & any supporting code for this test.

David





Sanjiva Weerawarana wrote:

> No, that code was not the problem code- that was just a serializer
> he wrote. THe point is that the string serializer (cleanSer in
> SOAPMappingRegistry) is not invoked directly; its invoked via
> ParameterSerializer which handles the null.
>
> I'd still like to see what Apache SOAP 2.2 client code he wrote
> that caused the null strings to break.
>
> Sanjiva.
>
> ----- Original Message -----
> From: "Brian Gilman" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, December 06, 2001 8:30 PM
> Subject: Re: NullPointerException when serializing null String objects
>
> > Hello all,
> >
> > I believe Dave already forwarded the code to this list. Please
> > take a look at this thread to find it.
> >
> > Best,
> >
> > -B
> >
> > -----------------------
> > Brian Gilman <[EMAIL PROTECTED]>
> > Sr. Software Engineer MIT/Whitehead Inst. Center for Genome Research
> > One Kendall Square, Bldg. 300 / Cambridge, MA 02139-1561 USA
> > phone +1 617  252 1069 / fax +1 617 252 1902
> >
> >
> > On Thu, 6 Dec 2001, Sanjiva Weerawarana wrote:
> >
> > > How did you serialize the string? If its a parameter to an RPC
> > > call the null value should be handled correctly.
> > >
> > > Can you post the code that shows the problem please?
> > >
> > > Sanjiva.
> > >
> > > ----- Original Message -----
> > > From: "David Turner" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, December 05, 2001 10:36 PM
> > > Subject: NullPointerException when serializing null String objects
> > >
> > >
> > > >
> > > > I ran into a problem with SOAP's current String serialization when it
> > > > encounters null String objects.   I couldn't find anything in either
> the
> > > > user or dev archives regarding this so I don't know if this is a bug
> or
> > > > not.
> > > >
> > > > I ended up writing my own String serializer which handled the null
> > > > situation.  I only used my String serializer on the client side when
> > > > sending data to the service -- the soap service just uses the default
> > > > soap String serializer/deseralizer.   I have attached the source code
> > > > for my String serializer in case it can be incorporated into SOAP.
> > > >
> > > > What I would like to know is if this is currently an issue or not?
> Is
> > > > SOAP currently able to handle null String objects during serializing?
> > > >
> > > > Much appreciated.
> > > >
> > > > David
> > > >
> > > >
> > > >
> > > >
> > > > I
> > > >
> > > >
> > > >
> > >
> > >

--
David Turner <[EMAIL PROTECTED]>
Senior Software Engineer
Whitehead Institute/MIT Center for Genome Research
One Kendall Square, Bldg. 300
Cambridge, MA 02139-1561 USA
phone 617-252-1573 / fax 617-252-1902

Attachment: URLSerializer.java
Description: application/unknown-content-type-codewarrior_java

Attachment: EchoService.java
Description: application/unknown-content-type-codewarrior_java

Attachment: EchoServiceClient.java
Description: application/unknown-content-type-codewarrior_java

Attachment: MyClass.java
Description: application/unknown-content-type-codewarrior_java

Attachment: MyClassDeserializer.java
Description: application/unknown-content-type-codewarrior_java

Attachment: MyClassSerializer.java
Description: application/unknown-content-type-codewarrior_java

Attachment: StringDeserializer.java
Description: application/unknown-content-type-codewarrior_java

Attachment: StringSerializer.java
Description: application/unknown-content-type-codewarrior_java

Attachment: URLDeserializer.java
Description: application/unknown-content-type-codewarrior_java

<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment";
             id="urn:EchoService">
  <isd:provider type="java"
                scope="Application"
                methods="echoString echoURL echoClass echoXMLString">
    <isd:java class="dt.soap.EchoService.EchoService" static="false"/>
  </isd:provider>

  <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>

  <isd:mappings>

    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
             xmlns:x="http://omnigene.org/xsd"; qname="x:URL"
	     javaType="java.net.URL"
	     java2XMLClassName="dt.soap.EchoService.URLSerializer"
             xml2JavaClassName="dt.soap.EchoService.URLDeserializer"/>

<!--
    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
             xmlns:x="http://omnigene.org/xsd"; qname="x:String"
	     javaType="java.lang.String"
             xml2JavaClassName="dt.soap.EchoService.StringDeserializer"/>

#####	     java2XMLClassName="dt.soap.EchoService.StringSerializer" 
-->

    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
             xmlns:x="http://omnigene.org/xsd"; qname="x:MyClass"
	     javaType="dt.soap.EchoService.MyClass"
	     java2XMLClassName="dt.soap.EchoService.MyClassSerializer"
             xml2JavaClassName="dt.soap.EchoService.MyClassDeserializer"/>

  </isd:mappings>


</isd:service>


Reply via email to