Publishing a REST service with the URL query string containing XML

  • mshaiba
  • 04/02/10
  • Offline
Posted: Wed, 04/14/2010 - 17:05

Hi Folks:

When i try to publish a REST service with the url query string containing xml..i can not proceed because of the url not passing checks. I tried to escape the =...still not doing it..anybody came across a case like this? --Im able to register the provide using the same url.

http://server-url/search?xml=<query><search doc-type="item-rec"><search doc-type="item-rec"></search><display template="cherry-pick"><display template="cherry-pick"></display></query>

 

cfff4
0
Your rating: None

Hi, Are you trying to publish

  • nzblue_fish
  • 09/30/09
  • Offline
  • Wed, 04/14/2010 - 18:58

Hi,

Are you trying to publish this using the Service Explorer 'Publish REST Service" dialog? 

If you are, I'm guessing that you are entering the url above as the "Resource URL:". You'll find that the url string you specified will be parsed to determine the input parameters that need to be provided when calling this REST service, which in this case would be 'xml'.

When you invoke your REST service, you'll need to provide your xml string (e.g. <query><search doc-type="item-rec"><search doc-type="item-rec"></search><display template="cherry-pick"><display template="cherry-pick"></display></query>) as input for the 'xml' input parameter.

Hope this helps. If it doesn't, you could provide more detail and I might be able to be more specific ... or someone else from the MDC might be able to expand on a solution.

Cheers, Innes


Hi Innes: Yes, Im using the

  • mshaiba
  • 04/02/10
  • Offline
  • Wed, 04/14/2010 - 19:26

Hi Innes:

Yes, Im using the Service Explorer "Publish REST Service". Are you saying that i should:

         1- define the provider using the url like url?xml

         2- define the service source url as   url?xml

 

then provide the actual query string only when invoking the service?

 

I havent tried this yet..Would let you know..just wanted to make sure i understand,

 

Thanks


You can leave the value of

  • smitchell
  • 08/29/08
  • Offline
  • Wed, 04/14/2010 - 20:41

You can leave the value of the parameter empty when you publish a service -- as long as the service responds to that ok. One other option is to use POST (if the service allows that) and supply the XML as the sample request body.

<!--Session data-->

 

Sara, technical writer/jackbe

 


Hi:   Im able to publish the

  • mshaiba
  • 04/02/10
  • Offline
  • Thu, 04/15/2010 - 07:53

Hi:

 

Im able to publish the serviceif the leave the value empty i.e url?xml=  but then when i invoke the service and

supply the query string: <query><search doc-type="item-rec"><search doc-type="item-rec"></search>

it generates an error because of the < sign. . must be some encoding issue.


The error generated is

  • mshaiba
  • 04/02/10
  • Offline
  • Thu, 04/15/2010 - 08:01

The error generated is :

 

Error execution Mashup Script : Unable to compile script : Error parsing mashup script : The value of attribute "default" associated with an element type "variable" must not contain the '<' character.


and if i string query encode

  • mshaiba
  • 04/02/10
  • Offline
  • Thu, 04/15/2010 - 10:39

and if i string query encode the xml string..the query goes to the server but doesnt return results..on the browser the same query string works..


If you are invoking the REST

  • smitchell
  • 08/29/08
  • Offline
  • Thu, 04/15/2010 - 13:58

If you are invoking the REST service in a mashup -- which is written in EMML which is XML -- then you must escape any XML delimiter in the URL. In other words, you must escape <, >, or &.

It may be better in a mashup to use <directinvoke> to invoke this service and then escape the XML delimiters in the URL. See http://www.jackbe.com/prestodocs/v2.7.0/prestolibrary/index.html?context=prestolibrary&href=PrestoLibrary.1.213.html for documentation on escaping XML characters in URLs for EMML.

<!--Session data-->

Sara, technical writer/jackbe

 


If im using DirectInvoke and

  • mshaiba
  • 04/02/10
  • Offline
  • Mon, 04/26/2010 - 09:22

If im using DirectInvoke and bypassing Presto, How do I indicate the user/password for the URL being directly invoked?