How to access container and asset using java

Options
foiplus
edited July 15, 2021 in TeamSite #1
I'm new to MediaBin, and I'm trying to simply connect to MediaBin and pull out various information (using Java) as a proof of concept.

I've connected ok and can successfully pull out the user and server I've connected to using:
mMediaBinServer.getMediaBinServerName();
mMediaBinServer.validateCurrentUser();

But when I try to access a container or asset, I get an exception.

When I try to access a particular asset (I got the ID from viewing the asset preview HTML souce - is this wrong?) using this code:

String id = "9599D4D2-7E90-486B-81B0-2998C0D1BD7F";
byte[] buffer = null;
buffer = mMediaBinServer.getPreview(id, -1, -1, MBPreviewType.Preview_128x128);

I get this error:

[7/29/05 8:13:48:511 EDT] 77ae77ae SystemOut O MediaBin.mediaBinTest(): RemoteException: Server was unable to process request. --> MBException: The requested container is unavailable. (0x80040500): Server was unable to process request. --> MBException: The requested container is unavailable. (0x80040500)


AND

When I try to access the root using this code:

MBContainer container = mMediaBinServer.getRootContainer();

I get this error:

[7/29/05 8:53:59:888 EDT] 26172617 SystemOut O MediaBin.mediaBinTest(): RemoteException: org.xml.sax.SAXException: Invalid element in com.mediabin.www.MBContainer - mChildContainerCount: ; nested exception is:
org.xml.sax.SAXException: Invalid element in com.mediabin.www.MBContainer - mChildContainerCount


I'm obviously missing something. I am able to pull out a list of all the retrieval tasks, so I'm pretty sure I'm connected fine. Any ideas?

Thanks in advance,
Faith

Edited by foiplus on 07/29/05 05:54 AM (server time).

Comments

  • The first error is because the id specified is not in the correct format for the webservice....add "{" and "}"...i.e.

    String id = "{9599D4D2-7E90-486B-81B0-2998C0D1BD7F}";

    The second error appears to be a mismatch between the WSDL and the Java stub classes. If you have the MediaBin WebService SDK, you can regenerate the Java stub classes using a copy of the WSDL from your installed version of the webservice. To get the WSDL, open a browser on the machine you've installed the webservice and browse to:

    http://localhost/MediaBinWebService/MediaBinServer.asmx?WSDL

    save the file into MediaBinWebService SDK\wsdl\MediaBinServer.wsdl and then use the batch file MediaBinWebService SDK\Java\lib\src\Build_MediaBinServer.bat to rebuild the MediaBinServer.jar file.

    Mark
  • That worked!! You are my hero!!

    Thanks,
    Faith
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs