Bonjour,
Je veux transférer des fichier pdf via web service. Je les ai transformé en byte[] puis en string base 64 mais ce string est encore tellement enorme que la requête http ne marche pas...
avez vous une solution?
Merci
Bonjour,
Je veux transférer des fichier pdf via web service. Je les ai transformé en byte[] puis en string base 64 mais ce string est encore tellement enorme que la requête http ne marche pas...
avez vous une solution?
Merci
Soit activer MTOM ou bien passer par SWA.
Avec axis2: http://ws.apache.org/axis2/1_5_1/mtom-guide.html#23
ca m'a l'air pas mal MTOM mais comment faire en JAVA?
Et bien le lien plus haut donne des exemples de code java.
Après la manière dépend de comment tu veux faire. As-tu généré du code avec wsdl2Java? quel databinding?
Les exemples de code me paraissent assez clairs pourtant...
un exemple peut-être plus complet: http://www.sayedhashimi.com/CommentV...4e3f5021f.aspx
oups désoléj'avais pas vu. j'ai suivi le tuto avec ce dernier lien que tu m'as donné mais à l'éxécution finale j'ai une erreur que je ne comprend pas :
voici aussi ce que dit TCPMON :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 Exception in thread "main" org.apache.axis2.AxisFault: Unknow type can not serialize at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83) at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84) at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499) at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at service.TransfertServiceStub.receiveMTOM(TransfertServiceStub.java:187) at service.TestClient.testMTOM(TestClient.java:104) at service.TestClient.main(TestClient.java:47) Caused by: javax.xml.stream.XMLStreamException: Unknow type can not serialize at org.apache.axis2.databinding.utils.ConverterUtil.serializeAnyType(ConverterUtil.java:1456) at service.TransfertServiceStub$ReceiveMTOM.serialize(TransfertServiceStub.java:1050) at service.TransfertServiceStub$ReceiveMTOM.serialize(TransfertServiceStub.java:972) at service.TransfertServiceStub$ReceiveMTOM$1.serialize(TransfertServiceStub.java:960) at org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:93) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:738) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:966) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:995) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:254) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:242) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:995) at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:486) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79) ... 20 more
et
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 POST /axis2/services/TransfertService HTTP/1.1 Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_3EC49A4C93B03928CD1264670264141; type="application/xop+xml"; start="<0.urn:uuid:3EC49A4C93B03928CD1264670264142@apache.org>"; start-info="text/xml" SOAPAction: "urn:receiveMTOM" User-Agent: Axis2 Host: 127.0.0.1:9080 Transfer-Encoding: chunked
C'est quoi invalid chunk?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 HTTP/1.1 500 Erreur Interne de Servlet Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=UTF-8 Transfer-Encoding: chunked Date: Thu, 28 Jan 2010 09:17:44 GMT Connection: close 1c5 <?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action></soapenv:Header><soapenv:Body><soapenv:Fault><faultcode></faultcode><faultstring>Stream Errorjava.io.IOException: Invalid chunk</faultstring><detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Merci beaucoup!
Alors il me semble (mais je ne peux rien affirmer) que le chunking est le fait de morceler les grosses trames.
Du coup c'est peut-être ton serveur qui n'est pas compatible avec ce mécanisme, car l'erreur semble venir du serveur.
Sinon tu peux peut-être essayer ça dans ton client:
Code : Sélectionner tout - Visualiser dans une fenêtre à part options.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
Partager