From java-dev-return-96916-archive-asf-public=cust-asf.ponee.io@axis.apache.org Tue Jul 31 12:18:56 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id DA91F180662 for ; Tue, 31 Jul 2018 12:18:54 +0200 (CEST) Received: (qmail 97133 invoked by uid 500); 31 Jul 2018 10:18:53 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 97123 invoked by uid 99); 31 Jul 2018 10:18:53 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2018 10:18:53 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 28A12C747A for ; Tue, 31 Jul 2018 10:18:53 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.51 X-Spam-Level: ** X-Spam-Status: No, score=2.51 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, HTML_OBFUSCATE_05_10=0.001, KAM_NUMSUBJECT=0.5, SPF_PASS=-0.001, T_MIME_MALF=0.01] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ATmBMz86_lSR for ; Tue, 31 Jul 2018 10:18:50 +0000 (UTC) Received: from beo.aidoru.de (beo.aidoru.de [151.252.54.135]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 342965F485 for ; Tue, 31 Jul 2018 10:18:50 +0000 (UTC) Received: from [11.100.9.6] (unknown [118.185.159.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by beo.aidoru.de (Postfix) with ESMTPSA id B5145280476 for ; Tue, 31 Jul 2018 12:18:43 +0200 (CEST) Subject: Re: axis2 client issue with version 1.7.8 From: "viji.mv" To: java-dev@axis.apache.org References: <71bf49be-547c-7acc-e315-d8a07ba09767@beo.in> <874df359-d0a5-c351-18b5-f6be2ca2335d@beo.in> <0113b579-8d9c-b4a1-49af-f0cab9f3da87@beo.in> Message-ID: <608dd510-028d-7624-729a-4ec23373e05d@beo.in> Date: Tue, 31 Jul 2018 15:48:26 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <0113b579-8d9c-b4a1-49af-f0cab9f3da87@beo.in> Content-Type: multipart/alternative; boundary="------------83BC20D078B5AC7DB6D67957" Content-Language: en-US --------------83BC20D078B5AC7DB6D67957 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hello, I have checked the document given in this thread and tried the code changes , but no positive result while using axis2 1.7.8 in response message context , have following values response message context Properties : ContentType = multipart/related; boundary="----=_Part_70639_27660911.1533020418529" transport.http.statusCode = 500 HttpTransportHeaders : [X-Backside-Transport: FAIL FAIL , Connection: Keep-Alive , Transfer-Encoding: chunked , Date: Mon, 30 Jul 2018 13:52:31 GMT , Server: Jetty/5.1.0 (Linux/2.6.16.60-0.132.1-bigsmp i386 java/1.5.0_11 , Content-Type: multipart/related; boundary="----=_Part_70639_27660911.1533020418529" , X-Global-Transaction-ID: 521669063 ] can you find anything from this regarding , why the type ="text/xml" is missing Thank you Regards, Viji. On 07/20/2018 01:52 PM, viji.mv wrote: > > Hello, > > Actually we are getting correct response with Axis2 1.4.1 > > we are sending an xml file and receiving xml with attachment . > > And that attachment is retrieving using this code > > >             Attachments attachments = > _returnMessageContext.getAttachmentMap(); >             List contentIDList = attachments.getContentIDList(); >             String[] idList = attachments.getAllContentIDs(); >             DataHandler pdfDataHandler; > >             for (int i = 0; i < idList.length; i++) >                 { >                     String temp = idList[i]; >                     pdfDataHandler = > _returnMessageContext.getAttachment(temp); >                     File xmlFile = null; > >                     File pdfFile = null; > >                     if (i == 0) >                     { >                         fileName = fileDir + timeStamp + ".xml"; >                         xmlFile = new File(fileName); >                         FileOutputStream outputStream; >                         outputStream = new FileOutputStream(xmlFile); >                         pdfDataHandler.writeTo(outputStream); >                         outputStream.flush(); >                         outputStream.close(); > >                     } >                     else >                     { >                         String type = ""; >                         type = temp.substring(0, temp.indexOf("=")); >                         fileName = fileDir +  "_" + type + "_" + > timeStamp + ".pdf"; >                         pdfFile = new File(fileName); >                         ByteArrayOutputStream byte1 = new > ByteArrayOutputStream(); >                         pdfDataHandler.writeTo(byte1); >                         FileOutputStream outputStream; >                         outputStream = new FileOutputStream(pdfFile); >                         Base64 decoder = new Base64(); >                         byte[] decoded_data = > decoder.decode(byte1.toString()); >                         outputStream.write(decoded_data); >                         outputStream.flush(); >                         outputStream.close(); > >                     } >                 } > > > > On 07/20/2018 10:42 AM, viji.mv wrote: >> >> Hello, >> >> In client side we are just sending a request xml , not with any >> attachment, From server side when response comes, there will be >> attachments. >> >> So should we set the mime type from client side itself? >> >> Thank you very much for your help. i will check with samples at >> https://axis.apache.org/axis2/java/core/docs/mtom-guide.html >> >> >> >> >> Thanks >> >> Regards >> >> Viji >> >> >> On 07/19/2018 10:15 PM, robertlazarski wrote: >>> >>> >>> On Wed, Jul 18, 2018 at 8:02 AM, robertlazarski >>> > wrote: >>> >>> >>> >>> On Wed, Jul 18, 2018 at 8:01 AM, robertlazarski >>> > wrote: >>> >>> >>> >>> On Wed, Jul 18, 2018 at 7:54 AM, viji.mv >>> > wrote: >>> >>> >>> Hi, >>> >>> I am running axis client using axis2 version 1.7.8 and >>> getting following >>> error. >>> >>> It is found that type is null >>> >>> org.apache.axis2.AxisFault >>>     at >>> org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) >>>     at >>> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:122) >>>     at >>> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:66) >>>     at >>> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:347) >>>     at >>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414) >>>     at >>> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225) >>>     at >>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:150) >>>     at >>> edecwebservice171.EdecServiceStub.goodsDeclarations(EdecServiceStub.java:490) >>>     at edecwebservice171.Test.main(Test.java:86) >>> Caused by: java.lang.NullPointerException >>>     at >>> >>> >>> >>> Please post to the list. >>> >>> Best I can tell from the attached xml and these headers sent to my >>> gmail account, you are using SWA for an attachment however these >>> headers are missing the mime type aka media type. >>> >>> It should look like this example from the docs, type="text/xml" : >>> >>> https://axis.apache.org/axis2/java/core/docs/mtom-guide.html >>> >>> Content-Type: multipart/related; type="text/xml"; >>> start="<9D645C8EBB837CE54ABD027A3659535D>"; >>> boundary="----=_Part_0_1977511.1123163571138" >>> >>> >>> The docs from the link above show some code for creating the mime type. I suggest starting there and if you still have problems, paste your entire client code. >>> >>> >>> >>> org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:72) >>>     at >>> org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:203) >>>     at >>> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:144) >>>     at >>> org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:107) >>> >>> >>> Any help is appreciated. >>> >>> >>> >>> Thanks, >>> >>> Viji M V >>> >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: >>> java-dev-unsubscribe@axis.apache.org >>> >>> For additional commands, e-mail: >>> java-dev-help@axis.apache.org >>> >>> >>> >>> Here's the source that is failing in MIMEBuilder.java, the >>> quickest way to debug would be to compile from source and >>> see what is null here: >>> >>>  return >>> builder.processDocument(attachments.getRootPartInputStream(false), >>>                     type, msgContext); >>> >>> Best regards, >>> Robert >>> >>> >>> Ah you said type is null. >>> >>>    String type = ct.getParameter("type"); >>> >>> That is content type. Maybe the request doesn't include it? >>> >>> >> > --------------83BC20D078B5AC7DB6D67957 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hello, 

I have checked the document given in this thread and tried the code changes , but no positive result

while using axis2 1.7.8

in response message context , have following values

response message context Properties :

ContentType = multipart/related; boundary="----=_Part_70639_27660911.1533020418529"

transport.http.statusCode = 500

HttpTransportHeaders :

[X-Backside-Transport: FAIL FAIL
, Connection: Keep-Alive
, Transfer-Encoding: chunked
, Date: Mon, 30 Jul 2018 13:52:31 GMT
, Server: Jetty/5.1.0 (Linux/2.6.16.60-0.132.1-bigsmp i386 java/1.5.0_11
, Content-Type: multipart/related; boundary="----=_Part_70639_27660911.1533020418529"
, X-Global-Transaction-ID: 521669063
]

can you find anything from this regarding , why the type ="text/xml" is missing


Thank you
Regards,

Viji. 
On 07/20/2018 01:52 PM, viji.mv wrote:

Hello,

Actually we are getting correct response with Axis2 1.4.1

we are sending an xml file and receiving xml with attachment .

And that attachment is retrieving using this code


            Attachments attachments = _returnMessageContext.getAttachmentMap();
            List contentIDList = attachments.getContentIDList();
            String[] idList = attachments.getAllContentIDs();
            DataHandler pdfDataHandler;

            for (int i = 0; i < idList.length; i++)
                {
                    String temp = idList[i];
                    pdfDataHandler = _returnMessageContext.getAttachment(temp);
                    File xmlFile = null;

                    File pdfFile = null;

                    if (i == 0)
                    {
                        fileName = fileDir + timeStamp + ".xml";
                        xmlFile = new File(fileName);
                        FileOutputStream outputStream;
                        outputStream = new FileOutputStream(xmlFile);
                        pdfDataHandler.writeTo(outputStream);
                        outputStream.flush();
                        outputStream.close();
                     
                    }
                    else
                    {
                        String type = "";
                        type = temp.substring(0, temp.indexOf("="));
                        fileName = fileDir +  "_" + type + "_" + timeStamp + ".pdf";
                        pdfFile = new File(fileName);
                        ByteArrayOutputStream byte1 = new ByteArrayOutputStream();
                        pdfDataHandler.writeTo(byte1);
                        FileOutputStream outputStream;
                        outputStream = new FileOutputStream(pdfFile);
                        Base64 decoder = new Base64();
                        byte[] decoded_data = decoder.decode(byte1.toString());
                        outputStream.write(decoded_data);
                        outputStream.flush();
                        outputStream.close();
                     
                    }
                }

             

       

On 07/20/2018 10:42 AM, viji.mv wrote:

Hello,

In client side we are just sending a request xml , not with any attachment, From server side when response comes, there will be attachments.

So should we set the mime type from client side itself?

Thank you very much for your help. i will check with samples at https://axis.apache.org/axis2/java/core/docs/mtom-guide.html



Thanks

Regards

Viji


On 07/19/2018 10:15 PM, robertlazarski wrote:


On Wed, Jul 18, 2018 at 8:02 AM, robertlazarski <robertlazarski@gmail.com> wrote:


On Wed, Jul 18, 2018 at 8:01 AM, robertlazarski <robertlazarski@gmail.com> wrote:


On Wed, Jul 18, 2018 at 7:54 AM, viji.mv <viji.mv@beo.in> wrote:

Hi,

I am running axis client using axis2 version 1.7.8 and getting following
error.

It is found that type is null

org.apache.axis2.AxisFault
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:122)
    at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:66)
    at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:347)
    at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:414)
    at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
    at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
    at
edecwebservice171.EdecServiceStub.goodsDeclarations(EdecServiceStub.java:490)
    at edecwebservice171.Test.main(Test.java:86)
Caused by: java.lang.NullPointerException
    at


Please post to the list.

Best I can tell from the attached xml and these headers sent to my gmail account, you are using SWA for an attachment however these headers are missing the mime type aka media type.

It should look like this example from the docs,  type="text/xml" :

https://axis.apache.org/axis2/java/core/docs/mtom-guide.html
Content-Type: multipart/related; type="text/xml"; 
          start="<9D645C8EBB837CE54ABD027A3659535D>";
                boundary="----=_Part_0_1977511.1123163571138"


The docs from the link above show some code for creating the mime type. I suggest starting there and if you still have problems, paste your entire client code. 


 
org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:72)
    at
org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:203)
    at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:144)
    at
org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:107)


Any help is appreciated.



Thanks,

Viji M V





---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Here's the source that is failing in MIMEBuilder.java, the quickest way to debug would be to compile from source and see what is null here:

 return builder.processDocument(attachments.getRootPartInputStream(false),
                    type, msgContext);

Best regards,
Robert

Ah you said type is null.

   String type = ct.getParameter("type");

That is content type. Maybe the request doesn't include it?





--------------83BC20D078B5AC7DB6D67957--