我是
Java Web Services的新手,所以我可能做错了.
我正在尝试使用DataHandler传输文件 – 这就是我所拥有的:
网络服务:
import java.net.MalformedURLException;
import java.net.URL;
import javax.activation.DataHandler;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlMimeType;
/**
*
* @author pc1
*/
@WebService()
public class WSFileSender {
@WebMethod( operationName = "getfile" )
public @XmlMimeType( "application/octet-stream" ) DataHandler getfile( @WebParam( name = "path" ) String path ) {
DataHandler datahandler = null;
try {
datahandler = new DataHandler( new URL( path ) );
}
catch ( MalformedURLException e ) {