You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by th...@apache.org on 2006/10/30 18:21:23 UTC
svn commit: r469199 - in
/webservices/axis2/branches/java/1_1/modules/samples:
mtom/src/sample/mtom/client/Client.java
soapwithattachments/src/sample/soapwithattachments/client/SWAClient.java
Author: thilina
Date: Mon Oct 30 09:21:20 2006
New Revision: 469199
URL: http://svn.apache.org/viewvc?view=rev&rev=469199
Log:
Adding the wrapper element for the swa client
increasing time out in MTOM client
Modified:
webservices/axis2/branches/java/1_1/modules/samples/mtom/src/sample/mtom/client/Client.java
webservices/axis2/branches/java/1_1/modules/samples/soapwithattachments/src/sample/soapwithattachments/client/SWAClient.java
Modified: webservices/axis2/branches/java/1_1/modules/samples/mtom/src/sample/mtom/client/Client.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/mtom/src/sample/mtom/client/Client.java?view=diff&rev=469199&r1=469198&r2=469199
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/mtom/src/sample/mtom/client/Client.java (original)
+++ webservices/axis2/branches/java/1_1/modules/samples/mtom/src/sample/mtom/client/Client.java Mon Oct 30 09:21:20 2006
@@ -85,6 +85,8 @@
// Enable MTOM in the client side
serviceStub._getServiceClient().getOptions().setProperty(
Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
+ //Increase the time out when sending large attachments
+ serviceStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(10000);
// Uncomment and fill the following if you want to have client side file
// caching switched ON.
Modified: webservices/axis2/branches/java/1_1/modules/samples/soapwithattachments/src/sample/soapwithattachments/client/SWAClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/soapwithattachments/src/sample/soapwithattachments/client/SWAClient.java?view=diff&rev=469199&r1=469198&r2=469199
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/samples/soapwithattachments/src/sample/soapwithattachments/client/SWAClient.java (original)
+++ webservices/axis2/branches/java/1_1/modules/samples/soapwithattachments/src/sample/soapwithattachments/client/SWAClient.java Mon Oct 30 09:21:20 2006
@@ -46,7 +46,8 @@
public class SWAClient {
- private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/swaSample");
+ private static EndpointReference targetEPR = new EndpointReference(
+ "http://localhost:8080/axis2/services/swaSample");
public static void main(String[] args) throws Exception {
CommandLineOptionParser optionsParser = new CommandLineOptionParser(
@@ -62,7 +63,8 @@
if ((invalidOptionsList.size() > 0) || (args.length != 4)) {
// printUsage();
- System.out.println("Invalid Parameters. Usage -file <file to be send> -dest <destination file>");
+ System.out
+ .println("Invalid Parameters. Usage -file <file to be send> -dest <destination file>");
return;
}
@@ -86,17 +88,17 @@
options.setTo(targetEPR);
options.setProperty(Constants.Configuration.ENABLE_SWA,
Constants.VALUE_TRUE);
- options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
- options.setTimeOutInMilliSeconds(100000);
-// options.setAction(Constants.AXIS2_NAMESPACE_URI + "/"
-// + operationName.getLocalPart());
+ // Increase the time out when sending large attachments
+ options.setTimeOutInMilliSeconds(10000);
options.setTo(targetEPR);
options.setAction("urn:uploadFile");
+ // assume the use runs this sample at
+ // <axis2home>/samples/soapwithattachments/ dir
ConfigurationContext configContext = ConfigurationContextFactory
- .createConfigurationContextFromFileSystem(
- "../../repository", null);
+ .createConfigurationContextFromFileSystem("../../repository",
+ null);
ServiceClient sender = new ServiceClient(configContext, null);
sender.setOptions(options);
@@ -110,18 +112,19 @@
// javax.activation.DataSource interface can fit here.
DataHandler dataHandler = new DataHandler(fileDataSource);
String attachmentID = mc.addAttachment(dataHandler);
-
+
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope env = fac.getDefaultEnvelope();
-
- OMNamespace omNs = fac.createOMNamespace("http://service.soapwithattachments.sample/xsd","swa");
+ OMNamespace omNs = fac.createOMNamespace(
+ "http://service.soapwithattachments.sample/xsd", "swa");
+ OMElement uploadFile = fac.createOMElement("uploadFile", omNs);
OMElement nameEle = fac.createOMElement("param0", omNs);
nameEle.setText(destinationFile);
OMElement idEle = fac.createOMElement("param1", omNs);
idEle.setText(attachmentID);
-
- env.getBody().addChild(nameEle);
- env.getBody().addChild(idEle);
+ uploadFile.addChild(nameEle);
+ uploadFile.addChild(idEle);
+ env.getBody().addChild(uploadFile);
mc.setEnvelope(env);
mepClient.addMessageContext(mc);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org