Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
MediaBin associations with web services
cmoad
Hey all,
I actually figured out how to access and authenticate to MediaBin's web service using php, and I am trying to grasp the limits of the web service API. I cannot figure out how to access association information through the API.
How can I find associated assets using the web service API?
Thanks,
Charlie
Find more posts tagged with
Comments
msrinivas
Have you looked through the API guide?
cmoad
Yup, it's sitting by me right now. As I just glance at it again I see I am able to grab the association once I have an asset. I guess my question is more about how to search associations. Is this possible with the web service api? I am able to do this with the scripting model.
Is there a place I can get sample code?
Thanks,
Charlie
msrinivas
What do you mean by "search associations"?
cmoad
In the fat client and com model you can search for assets in which an association exists or does not exist.
msrinivas
Ok got it. I do not see anything similar in the webservices API but here is my theory. You can probably do a search for the association GUID and search if that exists or not for assets.
You have some C# and Java example code on how to do a search in the webservices install directory.
HTH
msnider
Searching for associations using the web service is done just like any other search. When you create the search criteria's metadata object, you just specify the association's id as the mID parameter:
MBMetadata metadata = new MBMetadata();
metadata.mName = "Marketing Materials";
metadata.mID = "{42620E62-780F-4282-AE9A-4EB187E8569C}";
Note, you do not need to specify metadata.mValue since the only valid search operators are "exists" and "does not exist."
Mark
cmoad
Thanks for the responses. I am successful with some functionality now. However I am still getting bad results with the searches. The simplest example is calling the search function to find assets by name. Here is my code based off of the java sample. It includes some utilities I wrote, but those can be ignored.
$nameSMDD = $utils->getSearchableMetadata('Name');
$irnConstraint = $utils->cdo('MBSearchConstraint');
$irnConstraint->mMetadata = $utils->cdo('MBMetadata');
$irnConstraint->mMetadata->mName = 'Name';
$irnConstraint->mMetadata->mID = $nameSMDD->mID;
$irnConstraint->mMetadata->mValue = '13.219';
$irnConstraint->mSearchOperator = 'Contains';
$irnConstraint->mBooleanOperator = 'NotSet';
$search = $utils->cdo('Search_GetAssetIDsOnly');
$search->criteria = $utils->cdo('MBSearchCriteria');
$search->criteria->mContainerID = $utils->getRootContainer()->mID;
$search->criteria->mAssetID = null;
$search->criteria->mSearchConstraints = $utils->cdo('ArrayOfMBSearchConstraint');
$search->criteria->mSearchConstraints->MBSearchConstraint[] = $irnConstraint;
$search->criteria->mRecursive = true;
$search->criteria->mMaxHits = 100;
$resp = $client->Search_GetAssetIDsOnly($search);
I am attaching what my soap request looks like.
If I set the search operator to "Contains" I get every asset as a match. If I set the search operator to "Equality" I get no matches. I should note that I do have a placeholder called exactly, "13.219". This output tells me that my search value is probably being ignored completely.
Does anyone see something wrong with my request?
Thanks,
Charlie
msnider
It appears that your soap request isn't completely correct. Because mValue is an object you have to include a xml attribute that tells what type the value is...such as
[html]
13.219
[/html]which is distinct from
[html]
13.219
[/html]currently your soap doesn't specify the type at all:
[html]
13.219
[/html]
It looks like you are coding in Perl...are you building your soap request by hand? Most WSDL proxy generators will automatically take care of type specifications for you when dealing with object types...but I don't know if there are any WSDL to proxy tools for Perl.
cmoad
The forum seems to be striping xml, so I might be missing something from your last post.
I am using PHP and the SCA/SDO extensions. It takes care of all the soap/wsdl.
http://www.osoa.org/display/PHP/SOA+PHP+Homepage
-s:element minOccurs="0" maxOccurs="1" name="mValue"-
The wsdl does not define a type for mValue either. I am pretty sure that this means it defaults to xsd:anyType. Are you suggesting that I force the type of xsd:string to be specified on the mValue element of the request? I will give that a try.
cmoad
I gave the search a try using just the vanilla soap extension for php, and I am able to specify the type on the search value. This method actually works. I made the SDO group aware of the problem and they are looking into a solution.
Thanks,
Charlie