Is it possible to search SharePoint metadata? - web-services

When I use the Search.asmx web service it won't allow me to search MetaData. Is there a way that I can do this?
Below is what I have come up with so far for my query, but it errors out with an InvalidPropertyException every time I run it.
<?xml version="1.0" encoding="utf-8" ?>
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000">
<Query domain="QDomain">
<SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats>
<Context>
<QueryText language="en-US" type="MSSQLFT">
<![CDATA[ SELECT Title, Rank, Size, Description, Write, Path FROM portal..scope() WHERE "Published" = 'Yes' ORDER BY "Rank" DESC ]]>
</QueryText>
</Context>
<Range><StartAt>1</StartAt><Count>20</Count></Range>
<EnableStemming>false</EnableStemming>
<TrimDuplicates>true</TrimDuplicates>
<IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery>
<ImplicitAndBehavior>true</ImplicitAndBehavior>
<IncludeRelevanceResults>true</IncludeRelevanceResults>
<IncludeSpecialTermResults>true</IncludeSpecialTermResults>
<IncludeHighConfidenceResults>true</IncludeHighConfidenceResults>
</Query></QueryPacket>

You can't just search an arbitrary column of metadata, you need to make sure it gets crawled first and is made available under a sensible name (managed property). See this blog post for an example.
Also, if Published is a boolean, I think you might want to test "Published" = 1, in stead of yes.

Related

Amazon mws - Update MerchantOrderID

I'm trying to update the Amazon Merchant Order ID through the Feed API.
It was succesfully submitted and I've checked the response from Amazon MWS Scratchpad by check with the GetFeedSubmissionResult call. it returned that the process was completed without any erro.
But when I open my order in Amazon (sellercentral.amazon.com) it says "none saved": Your Merchant Order ID: # none saved
Nothing have been changed.
Your XML feed (provided in your comment) is missing the <Item> elements. Amazon wants you to acknowledge that you have not only received the order, but also all contained items. A complete XML feed should look like this:
<?xml version="1.0"?>
<AmazonEnvelope xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>M_xxxxx_114513393</MerchantIdentifier>
</Header>
<MessageType>OrderAcknowledgement</MessageType>
<Message>
<MessageID>1</MessageID>
<OrderAcknowledgement>
<AmazonOrderID>114-8862878-1197857</AmazonOrderID>
<MerchantOrderID>abc-402637</MerchantOrderID>
<StatusCode>Success</StatusCode>
<Item> <-- you need to repeat the "Item" element for each order line
<AmazonOrderItemCode>abc</AmazonOrderItemCode>
<MerchantOrderItemID>def</MerchantOrderItemID> <-- I'm not sure this is required, but haven't tried without
</Item>
</OrderAcknowledgement>
</Message>
</AmazonEnvelope>
( the <-- ... comments are not part of the actual feed)
You may also wish to look at this related StackOverflow answer.

creating relationship feeds through Amazon MWS

One of my client wants me to upload and maintain the variations of the products on Amazon. I am stuck in creating relationship(Variations) feed. I have googled it for many hours but with no luck.
I can easily generate and upload simple product, inventory, image and price feeds successfully through MWS, but my concept regarding variation feeds is not clear.
To simplify, my client has a product say "ABC" with two different colors (Black,Red). The ABC is not yet Registered on Amazon. The client has EAN for this product to list on amazon and also show the two different variations.
Now if any body can help me out as how to make the feeds to reflect the variations.
Please explain with practical code example.
Thanks
you can use following XML to create relationship.Use "_POST_PRODUCT_RELATIONSHIP_DATA_" as type of feed
<?xml version="1.0" encoding="utf-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>xxxxxxxxxxxxxxx</MerchantIdentifier>
</Header>
<MessageType>Relationship</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<Relationship>
<ParentSKU>skt_parent1234</ParentSKU>
<Relation>
<SKU>skt_white123</SKU>
<Type>Variation</Type>
</Relation>
<Relation>
<SKU>skt_orange1234</SKU>
<Type>Variation</Type>
</Relation>
</Relationship>
</Message>
</AmazonEnvelope>

XQuery Update Replace in Sedna

I'm working on a little project for school. This project asks me to show that I'm capable of using various processing techniques of XML. Now, in my project I work with the Sedna database manager in which I keep user records and I would like to update some of these user records through XQuery (I use the PHP API to send the queries to the database through the PHP Api provided by the Sedna Developers team).
Imagine I have the following database content for the user records:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user id="admin" admin="true">
<email>admin#admin.com</email>
<password>123456789</password>
<firstname>The</firstname>
<lastname>Stig</lastname>
<gender>male</gender>
<subscriptions>
</subscriptions>
</user>
<user id="prosper" admin="false">
<email>prosper#localhost.com</email>
<password>123456789</password>
<firstname>Strange</firstname>
<lastname>Figure</lastname>
<gender>male</gender>
<subscriptions>
</subscriptions>
</user>
</users>
Now, I my intention here is to update, for example, prosper's userrecord. In this record I would like to, for example, change his firstname and email, but keeping the rest unchanged.
I have tried to use the following query, but after sending the query, it changes the document order of the userrecord for some reason I don't understand (I think it inserts the attributes nodes of the user record as childnodes).
This is the query I use to update the user:
UPDATE replace $user in doc("users")//user[#id="prosper"]
with
<user>{($user/#*)}
<email>strange.figure#localhost.com</email>
{($user/node()[password])}
<firstname>Familiar</firstname>
<lastname>Figure</lastname>
<gender>male</gender>
{($user/node()[subscriptions])}</user>
Now, the problem this query gives me, is that when I try to ask the user's information after the update, I rely on the same order of child nodes have from before the update, but this query changes the order.
Is there someone skilled enough to help me with this problem?
I thank you for your time.
Jan, if you want to get password node you should change your XPath (your current expression {($user/node()[password])} is not what you think):
{$user/password}
the same true for subscriptions:
{$user/subscriptions}
It can be written as one expression with predicate:
{$user/node()[local-name(.) = ('password', 'subscriptions')]}

Getting and displaying data from database with xforms on submission

I have a database with an xml document in it, and I want to display a transformed xml on my xforms page, when the submission is sent (I'm using orbeon forms).
My solution is, that on the submission my servlet gets the xml from the database, writes it into a file, xslt transforms the xml tree (when and how should I do the transformation?), but I don't know, how to display this file on the xforms page. Maybe the replace="instance" attribute in can help, but i don't know how.
Thanks!
Now, after Alessandro's advice, Im trying to use this xpl thing, but it doesn't work.
In the model:
<xforms:insert nodeset="instance('inst2')"
origin="xxforms:call-xpl('oxf:/resources/pipeline.xpl', 'data',
instance('inst1'), 'data')"/>
in pipeline.xpl:
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<p:param type="input" name="data"/>
<p:param type="output" name="data"/>
<p:processor name="oxf:xslt">
<p:input name="data" href="#data"/>
<p:input name="config" href="transform.xsl"/>
<p:output name="data" ref="data"/>
</p:processor>
My instance, that I want to transform is "complaint-instance", the transformed instance called "trf-instance", the pipeline.xpl file is in the same directory with my xforms page. My styesheet called customerToOperator.xsl. What's wrong in my code?
I just noticed, the note: "If you are using separate deployment, the service and XSLT transformation must be present in the Orbeon WAR file, instead of within your application."
Ehm... Where should I put these files?
my app in details:
a) an xforms page, with 2 instances:
<instance id='inst1'>
<name>
<lastname/>
<firstname/>
</name>
</instance>
<instance id='inst2'>
<fname>
<fullname/>
</fname>
</instance>
I got 2 input fields, referenced on name/lastname and name/firstname.
I have an xforms:insert node, described above, and an xforms:submission node:
<xforms:submission
id="save-submission"
ref="instance('inst2')"
action="/my-servlet"
method="post"
replace="none">
I added 2 files to orbeon/WEB-INF/resources, the pipeline.xpl, (described above) and transform.xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<fname>
<fullname>
<xsl:value-of select="name/firstname"/>
<xsl:value-of select="name/lastname"/>
</fullname>
</fname>
</xsl:template>
</xsl:stylesheet>
And I have a servlet, which writes the posted instance on the console (now it writes inst2 on the console, but without the user input data, only the nodes...)
A really need to fix this...
Thanks again!
To get the XML from a database (relational or not) and apply a transformation, instead of writing my own servlet, I would use an XPL pipeline, and map this pipeline to a URL through the page flow. Now you have a service that answers to an HTTP request and returns XML. To call the service from XForms, you use an <xforms:submission replace="instance">. You end up with the XML in an instance, and you can display it with something like: <xforms:output value="saxon:serialize(instance(), 'xml')"/>.
In all cases (including separate deployment), the pipeline and XSLT file must be in the "resources". Usually, this means the WEB-INF/resources of the Orbeon's web app. But you can also do more fancy things by setting up the Orbeon resource manager to also use other directories on disk.

Django RSS Feed has domain set to example.com

I am able to get an output for the rss feed but the domain in the item link is http://example.com instead of the domain that I used in Feed.link (http://www.mydomain.com/blog). What do I need to do to get "mydomain.com" instead of "example.com"?
Below is the generated rss feed:
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>MyDomain Blog</title>
<link>http://www.mydomain.com/blog</link>
<description>insights and new developments in creating Pushstack</description>
<atom:link href="http://example.com/blog/rss/" rel="self"></atom:link>
<language>en-us</language>
<lastBuildDate>Mon, 31 Jan 2011 19:41:42 -0000</lastBuildDate>
<item>
<title>Example</title>
<link>http://example.com/blog/example</link>
<description></description>
<guid>http://example.com/blog/example</guid>
</item>
</channel>
</rss>
Also, in the title of the browser (OS X Chrome) it says, "NameError at /blog/rss/". Not sure if that is something that always shows up or if something else is wrong.
example.com is the domain that is automatically inserted into the database via the Sites framework.
You can edit the site in the admin: http://yourserver.com/admin/sites/site/
That's correct. You can also update it directly from the DDBB from "django_site" table, in case you are not using the admin.
Regards,
Martin
The atom:link value defaults to the information in the Sites framework, but you can override it by setting a feed_link property in your feed class, eg:
feed_link = "http://www.mydomain.com/blog/rss"