You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benjamin Coiffe <bc...@inforsense.com> on 2008/05/23 01:42:40 UTC

dynamic client and soap attachements

Hi,

I am trying to get the dynamic client to handle attachments for the web
service whose wsdl is attached. I am starting to feel a bit lost...I am
looking for the bit of code that adds attachments to the message object
when the Java stubs are used rather than the dynamic client but I could
not find it. Any help appreciated!

The code I use is:
CXFBusFactory busFactory = new  CXFBusFactory(); 
DynamicClientFactory f =
DynamicClientFactory.newInstance(busFactory.createBus());
Client client =
f.createClient("http://10.14.0.20:8080/soserv/SOConverter?WSDL");
client.getOutInterceptors().add(new
org.apache.cxf.interceptor.LoggingOutInterceptor());
client.getInInterceptors().add(new
org.apache.cxf.interceptor.LoggingInInterceptor());
Object person =
Thread.currentThread().getContextClassLoader().loadClass("soserv.convert
er.types.ConvertMime").newInstance();
Method m = person.getClass().getMethod("setTargetType", String.class);
m.invoke(person, "PDF");
javax.xml.ws.Holder h = new javax.xml.ws.Holder();
h.value = new byte[]{1,2,3};
client.invoke("convertMime", new Object[]{person,h});

INFO: Outbound Message
---------------------------
Encoding: UTF-8
Headers: {SOAPAction=[""], Accept=[*]}
Messages: 
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><conve
rtMime
xmlns="urn:soserv:Converter/types"><targetType>PDF</targetType></convert
Mime></soap:Body></soap:Envelope>
--------------------------------------


 <<SOConverter.xml>> 

Benjamin Coiffe