users@saaj.java.net

Re: [SAAJ-USR] SAAJ v1.2 VS SAAJ v1.3

From: Paulo Carvalho <pjinsc_at_gmail.com>
Date: Fri, 1 Feb 2008 10:04:08 +0100

Thanks for your answer.
I resolved that problem.
My webservice project had the SAAJ 1.2 jar files but had anotther JAR file
which had SAAJ class files embebed (dont know which version). I removed
these SAAJ files from that JAR file and it worked. I think that was a
conflict between SAAJ class files.
However I steal have another little problem (maybe it is a bug of SAAJ
1.2which has been resolved with SAAJ
1.3 ?).
The problem is the next one:

My client project uses and my webservice projects uses now the SAAJ
1.2files release.

The SOAP message sent to the webservice have a PDF attachment file with a
size of 73kb.
When the webservice receives the file it only stores a part of the file
(making it corrupt of course).

The code of the client to create the attachment:

...
AttachmentPart pdfAttach = message.createAttachmentPart();
FileDataSource file = new FileDataSource("d:/x.pdf");
DataHandler pdfDH = new DataHandler(file);
pdfAttach.setDataHandler(pdfDH);
message.addAttachmentPart(pdfAttach);
...

The code of the webservice to process the attachment:

...
Iterator itAttachs = message.getAttachments();
int i=1;
while(itAttachs.hasNext()) {
    String sFileName = "d:/x" + new Integer(i).toString() + ".pdf";
    AttachmentPartImpl attach = (AttachmentPartImpl) itAttachs.next();

    DataHandler dh = attach.getDataHandler();
    InputStream is = dh.getInputStream();
    FileOutputStream fos = new FileOutputStream(new File(sFileName));
    byte buffer[] = new byte[512*1024];
    int nbRead;
    while( (nbRead = is.read(buffer)) != -1 ) {
        fos.write(buffer, 0, nbRead);
    }

    fos.close();
    is.close();

    i++;
}
...


When I use SAAJ 1.3 (with the same client and webservice code), the file is
correctly transfered.

Am I doing anything wrong?

Thanks for your help.

On 1/31/08, V B Kumar Jayanti <Vbkumar.Jayanti_at_sun.com> wrote:
>
> Paulo Carvalho wrote:
>
> Hi mr. Jayanti,
>
> You are right, I am sorry. I didn't a wrong manipulation with the used
> libraries so nevermind the last message I send.
>
> The problem is in fact like I said but the error is the following:
>
> compile-single:
> 31-Jan-2008 15:56:14 com.sun.xml.messaging.saaj.soap.MessageImplidentifyContentType
> SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message instead
> of a SOAP message
> 31-Jan-2008 15:56:14 com.sun.xml.messaging.saaj.soap.MessageImpl <init>
> SEVERE: SAAJ0535: Unable to internalize message
> com.sun.xml.messaging.saaj.SOAPExceptionImpl:
> java.security.PrivilegedActionException:
> com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to internalize
> message
> at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(
> HttpSOAPConnection.java:127)
> at TstSAAJ.main(TstSAAJ.java:96)
>
>
> This error hapens when the client and the webservices projects have the
> SAAJ 1.2.2 library release (from JWSDP1.6).
> If both projects use SAAJ 1.3 library release or if the client project use
> SAAJ 1.2.2 and webservice project use SAAJ 1.3 release, everything works
> fine.
>
> Did I explain weel the problem?
>
> We do not release SAAJ 1.2 updates anymore, it is in maintenance mode and
> only customer escalations are handled. But maybe you can send me the SOAP
> Message and i can take a look to see what is going wrong.
>
> Thanks.
>
> Thanks
>
>
> On 1/31/08, V B Kumar Jayanti <Vbkumar.Jayanti_at_sun.com> wrote:
> >
> > Hi Paulo,
> >
> > Paulo Carvalho wrote:
> >
> > Hi,
> >
> > I dowloaded JWSDP 1.5 and JWSDP1.6.
> > JWSDP 1.5 comes with the SAAJ 1.2.1_01 release.
> > JWSDP 1.6 comes with the SAAJ 1.2.2 release.
> >
> > 1 - When I have the SAAJ 1.3 libraries on client and webservice projects
> > everything works fine.
> >
> > 2 - When I have the SAAJ 1.2.2 release on client project and SAAJ 1.3release on webservice project, eveything works fine
> >
> > 3 - Finally, when I have the SAAJ 1.2.2 libraries on both projets, I
> > steal have an error, but not the same one. In that way, le client reachs the
> > webservice. The error is the next one and hapens when the web service tries
> > to get the body of the SOAP message:
> >
> > The error happens when the webservice calls the getSOAPBody():
> >
> > public SOAPMessage onMessage(SOAPMessage message) {
> > ...
> > if(message != null) {
> > ...
> > SOAPBody inBodyMsg = message.getSOAPBody();
> > ...
> >
> > Error description:
> >
> > INFO: Server startup in 6718 ms
> > java.lang.NullPointerException
> > at org.apache.axis2.saaj.SOAPMessageImpl.getSOAPBody(
> > SOAPMessageImpl.java:371)
> > at crpgl.InfoWSSAAJ.onMessage(InfoWSSAAJ.java:68)
> >
> >
> > I am very confused now, the class org.apache.axis2.saaj.SOAPMessageImpldoes not belong to Sun's SAAJ impl at all. It is an Apache SAAJ Impl class.
> >
> > regards.
> >
> > Any idea/suggestion of the cause/solution for this error?
> >
> > Thanks
> >
> >
> > On 1/31/08, Paulo Carvalho <pjinsc_at_gmail.com> wrote:
> > >
> > > Hello
> > >
> > > Thank you for your reply.
> > > No errors appends while deploying my webservice and I can access to is
> > > WSDL with no problem using IE.
> > > Since I am using the SAAJ jar files which were delivered with the
> > > jwsdp-1.3, I'm gonna try to get the JWSDP 1.5 or 1.6 version to see if
> > > the version is the SAAJ 1.2 and if the error persists.
> > >
> > > Thanks
> > >
> > > Best regards
> > >
> > >
> > > On 1/31/08, V B Kumar Jayanti <Vbkumar.Jayanti_at_sun.com> wrote:
> > > >
> > > > Paulo Carvalho wrote:
> > > >
> > > > > Hello
> > > > >
> > > > > I am having a stange problem using SAAJ 1.2 (which I had
> > > > installing
> > > > > jwsdp-1.3 because I can't find anywhere any release of SAAJ 1.2).
> > > > >
> > > > > Here is the problem. I have a client which sends a SOAP message
> > > > with
> > > > > an attachment to a WebService.
> > > > >
> > > > > 1 - When my client project and my webservice project have the
> > > > > saaj-api.jar and saaj-impl.jar files of SAAJ 1.3 release,
> > > > everything
> > > > > works fine.
> > > > >
> > > > > 2 - When my client project have the saaj-api.jar and
> > > > saaj-impl.jar
> > > > > files of SAAJ 1.2 release and my webservice project have the
> > > > > saaj-api.jar and saaj-impl.jar files of SAAJ 1.3 release,
> > > > everything
> > > > > works fine
> > > > >
> > > > > 3 - When my client project and my webservice project have the
> > > > > saaj-api.jar and saaj-impl.jar files of SAAJ 1.2 release, the
> > > > > following error occurs:
> > > > >
> > > > >
> > > > > 31-Jan-2008 10:41:56
> > > > > com.sun.xml.messaging.saaj.soap.MessageImpl identifyContentType
> > > > > SEVERE: SAAJ0537: Invalid Content-Type. Could be an error message
> > > > > instead of a SOAP message
> > > > > com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid
> > > > > Content-Type:text/html. Is this an error message instead of a SOAP
> > > > > response?
> > > > > at
> > > > > com.sun.xml.messaging.saaj.soap.MessageImpl.identifyContentType(
> > > > MessageImpl.java:258)
> > > > > at
> > > > > com.sun.xml.messaging.saaj.soap.MessageImpl.<init>(
> > > > MessageImpl.java:127)
> > > > > at
> > > > > com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl
> > > > .<init>(Message1_1Impl.java:43)
> > > > > ...
> > > > >
> > > >
> > > > This kind of an error generally means there was a problem in
> > > > deploying
> > > > your webService or that your WebService was not initialized properly
> > > > can
> > > > you check your server logs. Are you able to access the WSDL of the
> > > > service using a Browser.
> > > >
> > > > A lot of bugs which were in SAAJ 1.2 have been fixed in SAAJ 1.3 so
> > > > it
> > > > may be that you are hitting some bug when using SAAJ 1.2.
> > > >
> > > > The latest SAAJ 1.2 will be in JWSDP 1.5 or 1.6 i believe.
> > > >
> > > > regards,
> > > > kumar
> > > >
> > > > >
> > > > > 3.1 - To be more specific (I found that trying to figure
> > > > out
> > > > > what was the problem), when my client project have the
> > > > saaj-api.jar
> > > > > and saaj-impl.jar files of SAAJ 1.2 and my webservice project have
> > > > the
> > > > > saaj-api.jar of SAAJ 1.3 release and have the saaj-impl.jar file
> > > > from
> > > > > SAAJ 1.2 release, everything works fine!
> > > > >
> > > > >
> > > > > Any help about this strange problem is very welcome!
> > > > >
> > > > > Regards
> > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe_at_saaj.dev.java.net
> > > > For additional commands, e-mail: users-help_at_saaj.dev.java.net
> > > >
> > > >
> > >
> >
> >
>
>