cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "erskine.dedios" <erskine.ded...@gmail.com>
Subject sending attachments using JaxWsProxyFactoryBean and ClientProxy
Date Fri, 18 Dec 2009 05:29:38 GMT

Hi.

I'm very new to cxf, could you help me sort this out?  I am able to send a
soap message successfully, but attachments don't seem to get sent.

Below is a snippet of my code. ..

            JaxWsProxyFactoryBean proxyFactory = new
JaxWsProxyFactoryBean();
            proxyFactory.setServiceClass(SendMessage.class);
           
proxyFactory.setAddress("http://nelson:8089/mockSendMessageBinding");
            remoteSendMessageService = (SendMessage) proxyFactory.create();
            
            bindAttachmentsToSoapRequest(remoteSendMessageService,
attachments);

            remoteSendMessageService.sendMessage(destinationList, 
                                                 origin, 
                                                 subject);


//...

    void bindAttachmentsToSoapRequest(Object proxyObject, byte[]
attachments) {
        //...
        
        final Client client = ClientProxy.getClient(proxyObject);
       
client.getEndpoint().put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, 
                                 new DataHandler(new
ByteArrayDataSource(attachments, "content/type")));
    }

I use soapui to receive my soap messages.



Thanks.
Kin
-- 
View this message in context: http://old.nabble.com/sending-attachments-using-JaxWsProxyFactoryBean-and-ClientProxy-tp26839375p26839375.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message