Hi,
I am trying to access Asset from MediaBin thro JSP using Java APIs. After getting Preview Byte[] unable to display , should i use ImageIcon Class of Swing or is the any MediaBin API?
using MediaBin 4.5
I am getting all the properties of asset but, could not able to display image on the screen...
i know this follwing lines has some problem,
ImageIcon icon = new ImageIcon(preview);
out.print(icon.getImage());
what about the content type??
//****************************************************************************************
code as follows,
<%@ page import="java.util.*, java.lang.*,java.io.*" %>
<%@ page import="com.mediabin.www.*" %>
<%@ page import="javax.xml.rpc.holders.*" %>
<%@ page import="javax.swing.*" %>
<%@ page import="java.awt.*" %>
<%
String strURL="
http://133.176.65.49/MediaBinWebService/MediaBinServer.asmx"; String strDomain="MYUSERGROUP";
String strUsername="Administrator";
String strPassword="";
byte[] preview = null;
MediaBinServer myService = new MediaBinServerLocator();
MediaBinServerSoap myServiceStub;
if( strURL.equals("") )
{
//...using the URL specified in the WSDL
myServiceStub = myService.getMediaBinServerSoap();
}
else
{
//...or we can specify the URL of the web service
java.net.URL serviceURL = new java.net.URL( strURL );
myServiceStub = myService.getMediaBinServerSoap( serviceURL );
}
org.apache.axis.client.Stub t = (org.apache.axis.client.Stub) myServiceStub;
String strUser = "";
if( strDomain.equals("") )
strUser = strUsername;
else
strUser = strDomain + "\\" + strUsername;
((org.apache.axis.client.Stub) myServiceStub).setUsername( strUser );
((org.apache.axis.client.Stub) myServiceStub).setPassword( strPassword );
MBAsset asset = null;
try
{
asset = myServiceStub.getAsset("{6B9734FF-0CA4-4BF0-9EF9-C015B850ED49}");
}
catch(Exception e)
{
out.print("asset not found"+e);
}
out.print("<b>Name�F</b>"+asset.getMName()+ "<br>") ;
out.print("<b>ID�F</b>"+asset.getMID()+"<br>");
out.print("<b>Revision�F</b>"+asset.getRevision()+ "<br>") ;
out.print("<b>Repository Path�F</b>"+asset.getRepositoryPath()+ "<br>") ;
out.print("<b>Width�F</b>"+asset.getWidth()+ "<br>") ;
out.print("<b>Height�F</b>"+asset.getHeight()+"<br>");
try
{
preview = myServiceStub.getPreview("{6B9734FF-0CA4-4BF0-9EF9-C015B850ED49}",1,-1, MBPreviewType.Preview_128x128 );
}
catch(Exception e)
{
out.print("Check the arg"+e);
}
// out.print(preview);
ImageIcon icon = new ImageIcon(preview);
out.print(icon.getImage());
%>
///***************************************OUTPUT OF ABOVE JSP IS****************************************************//
Name�FTestAsset
ID�F{6B9734FF-0CA4-4BF0-9EF9-C015B850ED49}
Revision�F1
Repository Path�F\Media Database
Width�F582
Height�F401
sun.awt.windows.WImage@ccdcea