How to query a TFS build from its URI using the api? - build

How do I get the IBuildDetail object from TFS using the the builds URI?
e.g. the URI is vstfs:///Build/Build/1546

Use the GetBuild() method on the build server class. It takes a Uri as a parameter.
var buildDetail= buildServer.GetBuild(new Uri(builduri));

Related

Jasper Reports Web Service with Dynamic Endpoint as a Datasource

We want to use web service as a datasource in our Jasper Reports version 6.2. In Jaspersoft Studio version 6.2 (community) we have a Base URL defined as: https://mywebservice/location/
Content Type: GET Parameters
Name: param1, Value: $P{param1}
Our understanding is that the query generated by Jasper Reports will be: https://mywebservice/location/?param1=$P{param1}
Unfortunately the web service endpoint does not accept ?param1. Instead the URL should be: https://mywebservice/location/$P{param1}
What can be done in this case?
The standard syntax for the GET parameters is always paramName=paramValue, in your case you shouldn't use the GET parameters
In the server URI use the static part of your URL, so: https://mywebservice/location/
Then in the query use the parameter inside the Base URL area. The base URL will be appended to the static URI to form the full URL

Jaggery (WS02) endpoint reference/dynamic endpoint

I'm currently developing an application in Jaggery which I deploy on their API manager.
From the Jaggery back end I'm calling a SOAP webservice using the method documented here, which specifies:
<%
var url = 'http://jaggeryjs.org/apidocs/resources/home.jag';
var xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.setRequestHeader("user" , "madhuka");
xhr.send();
print("ReadyState : "+xhr.readyState);
print("<br>ResponseStatus : "+xhr.status);
print("<br>ResponseText : "+xhr.responseText);
%>
I have everything up and working fine, however I'd like to remove the hard-coded URL and replace it with some sort of URL lookup, based on environment.
What is the correct way of doing this? Can I specify an endpoint in API manager and refer to it? Or perhaps use an EPR file. I've had little luck with the Jaggery documentation in this sense.
I have seen many jaggery apps developed for WSO2 products. The practice followed in them is to have a config file in json format. You can have a method to read it and get necessary values by passing the attribute name.
You can either have a config file for each environment and pack the correct one with the app or have a single config file with endpoints for each environment. If you are going to maintain a single config file, you have to dynamically construct the attribute name and read its value. To do that also, you need to maintain which environment it is. Therefore I recommend to use a config file for each environment and bundle the correct file for the environment.

How to send Queryparam with JSON value using Jersey client in unit test

I am trying to write a test case for a jersey resource using InMemory container provided by Jersey.
As my service method contains many multivalued parameters as filters, I opted to send all of those values as single JSON parameter, so that it will be easy to send a list of values for each filter.
When i send the JSON string using target("path").queryParam("filters", jsonString).request().get(); the call fails die to Jersey clients internal query builder, which is parsing the url and checking for path param templates in the url. Since the url contains my JSON with "{" in it, they are interpreted as path param.
If I try to encode the JSON using URLEncode.encode(jsonStr, "UTF-8"), the path param template issue is solved but white spaces in JSON are received by server as "+" as jersey client encoding URL one more time, but server decoding it only once.
If I make the Queryparam as post param test is working, but i don't want to use POST for just to retrieve data.
I can't post original code due to company policies.
My question is, is there any way to disable path template check in jersey clieny by setting custom builder.
A simpler solution would be to replace the '+' by '%20' as suggested here and here:
URLEncode.encode(jsonStr, "UTF-8").replaceAll("\\+", "%20");

wso2 esb endpoint can not be changed

I have some external URL (restful api) to be integrated.
Those URL have different prefixed URL with different parameter at url, for example:
www.abc.com/books
www.abc.com/book/11
www.abc.com/book/11/authors
When get response from those invocation, esb needs to convert response from one json format to our standard json format.
I plan to use esb javascript mediator to perform convert operation, but I didn't find any way to attach url parameters.
Any one have any idea?
I have used mediator by java code to implement it, but it is too heavy.
I am also looking into connector for another option.
I have got a solution by use url template. By this solution, I can change url according to template defined.
With this solution, I didn't need to write mediator or connector.

Deploying a SharePoint WebPart with its Web Service Reference

I'm trying to built a SharePoint Web Part that has as part of it a service reference to Another SharePoint server that I need to call from within vb code. However when I try to call the remote web service for the first time, I get the following in the log:
Could not find default endpoint element that references contract 'ListReference.ListsSoap' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element. at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.EndpointTrait1.CreateSimplexFactory()
at System.ServiceModel.ClientBase1.CreateChannelFactoryRef(EndpointTrait1 endpointTrait)
at System.ServiceModel.ClientBase1.InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase1..ctor()
at VSeWSS.ChangeRequestWorkflow.ChangeRequest.SubmitForm(Object sender, EventArgs e)
What is the proper way to deploy a Web Part with a Service Reference, could I be doing something wrong? Thanks!
You need to add the endpoint configuration into the web.config of the SharePoint site that is consuming the webservice.
I found this question that solved my problem.
Basically, I just needed to create a BasicHttpBinding object and populate its properties with the ones the SVC generator made in my app.config.
WCF Configuration without a config file
Actually I solved my problem. My application has many projects, and the config file was in the project calling the WebService, but it seems it has to be in the starting project...
Hm, if I'm understanding what you're asking correctly, I'm doing that. I just added the webservice from one of the correct endpoints to the project in VS, then before I call it in my actual code, I get the URL I want to connect to with this call from the hierarchical object store from Codeplex, then set the Url property. So:
MyService srv = new MyService();
srv.Url = SPContext.Current.Web.Properties["serviceurl"];
Its working like that fine.
hth.