Problem solved :

In Axis2.xml  I've set the wrong Builder :

        <messageBuilder contentType="multipart/related"
            class="org.apache.axis2.builder.MultipartFormDataBuilder" />

instead of :

        <messageBuilder contentType="multipart/related"
            class="org.apache.axis2.builder.MIMEBuilder" />

Chris.




Chris Nofneur wrote:
> 
> Hi all,
> 
> I am having troubles with Axis2.
> 
> I have created  a service based on AXIOM.
> When I send simple message to this service (without attachment) it's
> working perfectly.
> 
> I have problems when I want to send messages with attachments.
> 
> I have tried first to send SOAP With attachment messages :
> * I can see the message with tcpmon, it is a MIME message, contains the
> SOAPEnvelope and the Attachments (image/jpeg). 
> * But on the server side, my service receive a null OMElement, and there
> is no way to get the attachments :
> 
> MessageContext msgCtx = MessageContext.getCurrentMessageContext();
> Attachments attachment = msgCtx.getAttachmentMap();
> 
> The map is null.
> 
> I have tried to do this using MTOM :
> * Same thing
> 
> In both cases I have activated SwA (or MTOM) on both client and server
> side.
> 
> Any clue on this ?
> 
> Regards,
> Chris.
> 
> -------------------------------------------------
> -------------------------------------------------
> -------------------------------------------------
> 
> My services.xml :
> 
> <serviceGroup>
>     <service name="MyService"
> targetNamespace="http://foo.bar.com/myservice/";>
>         <description>My service</description>
>         <schema schemaNamespace="http://foo.bar.com/myservice/xsd/"; />
>         <parameter name="ServiceObjectSupplier" locked="false">
>         
> org.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier
>         </parameter>
>         <parameter name="SpringBeanName" locked="false">
>               serviceSOAP
>         </parameter>
> <!--        <parameter name="enableSwA">true</parameter> -->
>         <parameter name="enableMTOM">true</parameter>
>         <operation name="myOperation">
>             <messageReceiver
>                
> class="org.apache.axis.receivers.RawXMLINOutMessageReceiver" />
>         </operation>
>     </service>
> </serviceGroup>
> 
> -------------------------------------------------
> -------------------------------------------------
> -------------------------------------------------
> 
> MyClient.java
> 
>                Options options = new Options();
>               options.setTo(targetEPR);
>       
> options.setProperty(Constants.Configuration.ENABLE_MTOM,Constants.VALUE_TRUE);
>               options.setSoapVersionU
>               // Increase the time out to receive large attachments
>               options.setTimeOutInMilliSeconds(180000);
>               ServiceClient sender = new ServiceClient();
>               sender.setOptions(options);
>               OperationClient mepClient =
> sender.createClient(ServiceClient.ANON_OUT_IN_OP);
>               mc = new MessageContext();
>               MyObject myObject = createMyObject();
>               SOAPEnvelope encodedObject = getEncodedObject(myObject);
>               mc.setEnvelope(encodedObject);
>               mepClient.addMessageContext(mc);
>               mepClient.execute(true);
> 
> -------------------------------------------------
> -------------------------------------------------
> -------------------------------------------------
> 
> MyService.java
> 
> public OMElement myOperation(final OMElement myObject) { <<< myObject is
> null
> 
>               MessageContext msgCtx = 
> MessageContext.getCurrentMessageContext();
>               Attachments attachment = msgCtx.getAttachmentMap(); << 
> Attachment map is
> empty !
> 
> -------------------------------------------------
> -------------------------------------------------
> -------------------------------------------------
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can%27t-receive-MTOM-or-SwA-message-tp22244138p22283823.html
Sent from the Axis - User mailing list archive at Nabble.com.

Reply via email to