Hi Ramindu, We have a sample client available in the ESB pack itself. You can take a look at the code available at there. Following is the path to sample client.
<ESB_HOME>/samples/axis2Client/src/samples/userguide/MTOMSwAClient.java Related ESB sample available at following. Sample #51 - http://docs.wso2.org/pages/viewpage.action?pageId=33136025 Thanks. On Mon, Feb 17, 2014 at 11:24 AM, Ramindu Deshapriya <rasad...@gmail.com>wrote: > Hi Azeez, > > > Afkham Azeez-2 wrote > > http://axis.apache.org/axis2/java/core/docs/mtom-guide.html may help > > Thanks, I used that class. However, when using the following code, the > attachment doesn't seem to be getting delivered to the ESB. I am using this > to test a cloud connector, and the connector itself returned the error it > gives when it can't find this specific attachment. Is there something I'm > missing? > > OMElement getFileMandatoryParamRequest = > AXIOMUtil.stringToOM(omString); > > ServiceClient serviceClient = new ServiceClient(); > > Options serviceOptions = new Options(); > > serviceOptions.setTo(new > EndpointReference(getProxyServiceURL(CONNECTOR_NAME + "_" > + methodName))); > serviceClient.setOptions(serviceOptions); > MessageContext messageContext = new MessageContext(); > > SOAPEnvelope soapEnvelope = > TransportUtils.createSOAPEnvelope(getFileMandatoryParamRequest); > messageContext.setDoingSwA(true); > messageContext.setEnvelope(soapEnvelope); > messageContext.addAttachment("certificate", new DataHandler(new > URL("file:" + File.separator + File.separator > + ProductConstant.SYSTEM_TEST_RESOURCE_LOCATION + > ConnectorIntegrationUtil.ESB_CONFIG_LOCATION > + File.separator + "googledrive_certificate.p12"))); > OperationClient opClient = > serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); > opClient.addMessageContext(messageContext); > > opClient.execute(true); > MessageContext responseMsgCtx = > opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); > > Thanks. > > > > -- > View this message in context: > http://wso2-oxygen-tank.10903.n7.nabble.com/Sending-SOAP-attachments-using-AxisServiceClient-object-in-Integration-Tests-tp92033p92260.html > Sent from the WSO2 Development mailing list archive at Nabble.com. > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > -- *Isuru Udana* Senior * Software Engineer* WSO2 Inc.; http://wso2.com email: isu...@wso2.com cell: +94 77 3791887 blog: http://mytecheye.blogspot.com/ twitter: http://twitter.com/isudana
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev