home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
wsgatsam.zip
/
CheckOut.java
< prev
next >
Wrap
Text File
|
2003-02-24
|
3KB
|
79 lines
/**
* %wsgw_sample_start%
* Licensed Materials - Property of IBM
*
* (c) Copyright IBM Corp. 2001, 2002 All Rights Reserved.
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with
* IBM Corp.
* %wsgw_sample_end%
*/
package services.lftfileservice;
import org.apache.wsif.util.*;
import org.apache.wsif.*;
import com.ibm.wsdl.extensions.lft.*;
import com.ibm.wsif.providers.lft.*;
import com.fileService.www.*;
import com.ibm.httpr.lft.LargeFileUtils;
public class CheckOut {
private static void doCheckOut (FileServicePort fs) throws Exception {
String fileReference = fs.checkOut ("fileId001");
System.out.println("CheckOut : fileReference : " + fileReference);
System.out.println("CheckOut : fileReferenceURL : "
+ LargeFileUtils.getURLFromFileReference(fileReference));
}
public static void main (String[] args) throws Exception {
String portTypeName = "fileServicePort";
String portName=null;
String wsdlLocation=null;
String installDir = args[1].trim();
System.out.println("Starting CheckOut...");
installDir = CheckIn.makeValidPathName(installDir);
if((args[0]==null)||(args[0].equals("wsif"))) {
portName = "HTTPRPort"; // Direct WSDL
wsdlLocation =
"file:"+installDir+"/samples/services/lftfileservice/LFTSample.wsdl";
} else if (args[0].equals("wsgw")) {
portName = "fileServicePortApacheAxisBindingPort"; // Axis GW
// TBD: It shouldn't be localhost here, but the actual hostname.
wsdlLocation = "http://localhost/wsgw/ServiceDefinition?name=fileService";
} else if (args[0].equals("java")) {
portName = "fileServicePortJavaBindingPort";
wsdlLocation =
"file:"+installDir+"/samples/services/lftfileservice/LFTSampleJava.wsdl";
} else {
System.out.println("This option ("+args[0]+") is not supported");
CheckIn.usage();
}
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
WSIFService service = factory.getService(
wsdlLocation,
null, // serviceNS
null, // serviceName
"http://www.fileService.com/largeFile", // portTypeNS
portTypeName); // portTypeName
FileServicePort fsStub = null;
if(portName != null) {
System.err.println ("\n\nUsing '" + portName + "' port:");
fsStub =(FileServicePort)service.getStub(portName, FileServicePort.class);
doCheckOut (fsStub);
}
}
}