axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "VF" ...@imh.cz>
Subject RE: Axis PDF transmision
Date Tue, 26 Sep 2006 14:11:21 GMT
Yes really, there is only one. I need to send always only one pdf file to
client from server.

This is client call:

Headers:

POST /axis2/services/binarytest HTTP/1.1
User-Agent: Axis/2.0
SOAPAction: urn:axws.binary/getFile
Host: localhost:8080
Transfer-Encoding: chunked
Content-Type: multipart/related;
boundary=MIMEBoundaryurn_uuid_AAF46B4D7E69C02A7311592793440941;
type="application/xop+xml";
start="<0.urn:uuid:AAF46B4D7E69C02A7311592793440942@apache.org>";
start-info="text/xml"; charset=UTF-8


Content:

--MIMEBoundaryurn_uuid_AAF46B4D7E69C02A7311592793440941
content-type:application/xop+xml; charset=UTF-8; type="text/xml";
content-transfer-encoding:binary
content-id:<0.urn:uuid:AAF46B4D7E69C02A7311592793440942@apache.org>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header
/><soapenv:Body><ns1:getFileRequest
xmlns:ns1="urn:axtypes.binary"><filein>c:\a.pdf</filein></ns1:getFileRequest
></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_AAF46B4D7E69C02A7311592793440941--


And this send SERVER:


Headers:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=8800E37DAA6E194328D07284B49C2C1C; Path=/axis2
Content-Type: multipart/related;
boundary=MIMEBoundaryurn_uuid_E3B926AB88EB5FDF6F11592793444345;
type="application/xop+xml";
start="<0.urn:uuid:E3B926AB88EB5FDF6F11592793444346@apache.org>";
start-info="text/xml";charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 26 Sep 2006 14:02:25 GMT


Content:

--MIMEBoundaryurn_uuid_E3B926AB88EB5FDF6F11592793444345
content-type:application/xop+xml; charset=UTF-8; type="text/xml";
content-transfer-encoding:binary
content-id:<0.urn:uuid:E3B926AB88EB5FDF6F11592793444346@apache.org>

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header
/><soapenv:Body><ns1:getFileResponse
xmlns:ns1="urn:axtypes.binary"><fileout>JVBERi0xLjQNJeLjz9
....encoding pdf file...
U+Pg0Kc3RhcnR4cmVmDQoxMTYNCiUlRU9GDQo=</fileout></ns1:getFileResponse></soap
env:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_E3B926AB88EB5FDF6F11592793444345--



Do You think please, that I do it wrong? Thanks a lot for helping.

        Vlada









-----Original Message-----
From: Thilina Gunarathne [mailto:csethil@gmail.com] 
Sent: Tuesday, September 26, 2006 3:42 PM
To: axis-user@ws.apache.org
Subject: Re: Axis PDF trnasmission

Hi,
Please let us know the number of MIME parts in your message..
According to your mail I get a feeling that there is only one...

Please post the full message snapshot...

~Thilina

> --MIMEBoundaryurn_uuid_E3B926AB88EB5FDF6F11592687872843
> content-type:application/xop+xml; charset=UTF-8; type="text/xml";
> content-transfer-encoding:binary
> content-id:<0.urn:uuid:E3B926AB88EB5FDF6F11592687872844@apache.org>
> ....
> --MIMEBoundaryurn_uuid_E3B926AB88EB5FDF6F11592687872843--
>
>
> On client I have this part:
>
> *********************
> public void testgetFile() throws java.lang.Exception {
>         binary.axws.BinarytestStub stub = new
binary.axws.BinarytestStub();
> //the default implementation should point to the right endpoint
>
>
>         Options options =stub._getServiceClient().getOptions();
>
>         options.setProperty(Constants.Configuration.ENABLE_MTOM,
> Constants.VALUE_TRUE);
>         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>
>         binary.axtypes.GetFileRequest param18 =
> (binary.axtypes.GetFileRequest)
> getTestObject(binary.axtypes.GetFileRequest.class);
>
>         param18.setFilein("c:\\a.pdf");
>
>         //BinarytestSkeleton bts = new BinarytestSkeleton();
>
>         //assertNotNull(bts.getFile(param18));
>         binary.axtypes.GetFileResponse resp = stub.getFile(param18);
>         //assertNotNull(stub.getFile(param18));
>         FileOutputStream fos = new FileOutputStream("c:\\a22.pdf");
>         resp.getFileout().writeTo(fos);
>     }
> *********************
>
> MTOM is enabled on server and also in client. Has anyone some idea? Thank
> you very much for all ideas.
>
>            Vlada
>
>
>
>
> -----Original Message-----
> From: Thilina Gunarathne [mailto:csethil@gmail.com]
> Sent: Wednesday, September 20, 2006 3:29 PM
> To: axis-user@ws.apache.org
> Subject: Re: Axis PDF trnasmission
>
> hmmm... FileDataSource should automatically pick up the MIME type...
>
> Please check whether the message gets delivered using MTOM (using a
> MIME package) or with in line base64 string...
>
> Check by enabling MTOM as follows, If MTOM is not enabled.
>
>  Options options =stub._getServiceClient().getOptions();
>  options.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
>    Boolean.TRUE);
>
> HTH,
>
> ~Thilina
>
> On 9/20/06, VF <vf@imh.cz> wrote:
> > Hi,please I have this question. Is ti possible to transfer PDF file with
> > SOAP,MTOM and ADB?
> >
> > I have this fragment in WSDL:
> >
> >                         <xs:element name="getFileRequest">
> >                                 <xs:complexType>
> >                                         <xs:sequence>
> >                                                 <xs:element
name="filein"
> >
> > type="xs:base64Binary" />
> >                                         </xs:sequence>
> >                                 </xs:complexType>
> >                         </xs:element>
> >
> >
> > Axis generated this ADB binding:
> >
> > -------------------------------------------------
> >
> >     /** field for Filein */
> >     protected javax.activation.DataHandler localFilein;
> >
> >     /**
> >      * Auto generated getter method
> >      *
> >      * @return javax.activation.DataHandler
> >      */
> >     public javax.activation.DataHandler getFilein() {
> >         return localFilein;
> >     }
> >
> >     /**
> >      * Auto generated setter method
> >      *
> >      * @param param Filein
> >      */
> >     public void setFilein(javax.activation.DataHandler param) {
> >         this.localFilein = param;
> >     }
> >
> > ----------------------------------------------------
> >
> >
> >
> > I call it in client:
> >
> >     * Auto generated test method
> >      */
> >     public void testgetFile() throws java.lang.Exception {
> >         binary.axws.BinarytestStub stub = new
> binary.axws.BinarytestStub();
> > //the default implementation should point to the right endpoint
> >
> >         binary.axtypes.GetFileRequest param18 =
> > (binary.axtypes.GetFileRequest)
> > getTestObject(binary.axtypes.GetFileRequest.class);
> >
> >         // todo Fill in the param18 here
> >         DataHandler dh = new DataHandler(new
FileDataSource("c:\\a.pdf"));
> >
> >         param18.setFilein(dh);
> >         BinarytestSkeleton bts = new BinarytestSkeleton();
> >
> >         assertNotNull(bts.getFile(param18));
> >         //assertNotNull(stub.getFile(param18));
> >         param18.setFilein(dh);
> >     }
> >
> >
> > -------------------------------------------------------
> >
> > on server is this code:
> >
> >  public binary.axtypes.GetFileResponse getFile(
> >         binary.axtypes.GetFileRequest param2) {
> >         DataHandler dh = param2.getFilein();
> >         binary.axtypes.GetFileResponse resp = new
> > binary.axtypes.GetFileResponse();
> >
> >         try {
> >                         dh.writeTo(new FileOutputStream("c:\\a2.pdf"));
> >                         resp.setFileout(dh);
> >                         return resp;
> >         } catch (FileNotFoundException e) {
> >                         // TODO Auto-generated catch block
> >                         e.printStackTrace();
> >                 } catch (IOException e) {
> >                         // TODO Auto-generated catch block
> >                         e.printStackTrace();
> >                 }
> >                 return resp;
> >         //Todo fill this with the necessary business logic
> >         //throw new java.lang.UnsupportedOperationException();
> >     }
> >
> >
> > -----------------------------------------------------------
> >
> >
> > Result:
> >  When I call it directly through service skeleton and save it on server
it
> > is ok and I can open new file, but if I use stub and send it over Axis2,
> > then it s not possible to open this file. It says,that it is possible
that
> > it was sent as a mail attachement and it has bad encoding. How can i
send
> it
> > with pdf mime type?
> >
> > Thanks a lot.
> >
> >
> > Vlada
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >
>
>
> --
> http://webservices.apache.org/~thilina/
> http://thilinag.blogspot.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/

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


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


Mime
View raw message