Parameter transfer to URI in SOAP UI for a Rest Service - automated-tests

I have two REST Services: GET and PATCH.
The GET Service has a JSON Response and from which I need to trasnfer a property named tripId.
Add that property value to the URL of the PATCH Request as a resouce, i.e.,
https://patchRequest.com/api/trips/{tripId}/
Can any one tell me how to do it in SOAP UI/ READY API.
I'm not able to do it.
Thanks

Create a customer property in the test case section ( or even in the project section )
Add a Property Transfer test step and export the value to the holder that you created
Finally, Call the value in your URI

Related

Use value from previous test

I'm using Soap UI Free for testing my ASP.NET web API. I've made a CREATE request to the API and then a test for it and it works - the API saves my data and returns response 200 with some JSON object which also contains the ID value for the newly saved object. How can I use that ID value in the next test which will delete the object?
I found this article on the Soap UI website but it says the technique only applies to Soap UI Pro (which I don't have):
https://www.soapui.org/docs/functional-testing/properties/transferring-properties/
Apparently the method from the article also applies to the free version of SoapUI. It just doesn't say that and even though it mentions how to perform it, it doesn't really explain, how exactly.
You just have to right-click on a test case and then choose Add Step -> Property Transfer.
In the property transfer set-up window:
you have to provide a JsonPath to the value to retrieve (eg. $.data.id),
and then the parameter in the next API call to which you want the value to be copied.
So, if you call a CREATE and receive a response with a Json object:
{ "data":
{ "id": "fhiugreuuieryiuweyr893ry9yr43"
}
}
you can then set up the Property Transfer step by typing $.data.id in the Source section's text field and typing "id" in the Property field in the Target section (which could be your eg. READ, UPDATE or DELETE call).
And your tests tree will look eg. like this:

Custom Header with token in PASOE Business Class Entity with Web Service?

I have a PASOE Business Class Entity setup as a Web Service. I'm trying to determine how to create a custom header that will allow me to pass in a hashed token. Is this something that I need to upgrade to 11.7.4 for DOH(OpenEdge.Web.DataObject.DataObjectHandler)? Or is this something that I simply add into a method that's defined in the class? Apologies, for the lack of code to illustrate my situation, but I'm not sure where to begin.
If you're using a Business Entity with the web transport then you're using the DOH, and the below applies. If you're using the rest transport then you are not using the DOH, and are more limited in your choices.
There is doc available on the DOH at https://documentation.progress.com/output/oe117sp/index.html#page/gssp4/openedge-data-object-handler.html - it's for 11.7.4 but largely applies to all versions (that is, from 11.6.3+). This describes the JSON mapping file, which you'll need to create an override to the default, generated one.
If you want to use the header's value for all operations, then you may want to use one of the DOH's events. There's an example of event handlers at https://github.com/PeterJudge-PSC/http_samples/blob/master/web_handler/data_object_handler/DOHEventHandler.cls ; you will need to start that handler in a session startup procedure using new DOHEventHandler() (the way that code is written is that it makes itself a singleton).
You can now add handling code for the Invoking event which fires before the business logic is run.
If you want to pass the header value into the business logic you will need to
Copy the generated mapping file <service>.gen to a <service.map> , in the same folder. "gen" files are generated and will be overwritten by the tooling
In the .map file, add a new arg entry. This must be in the same order as the parameters to the BE's method.
The JSON should look something like the below. this will read the value of the header and pass it as an input parameter into the method.
{ "ablName": "<parameter_name>",
"ablType": "CHARACTER",
"ioMode": "INPUT",
"msgElem": {"type": "HEADER", "name": "<http-header-name>"}
}

How to create Class based dynamic quota?

Please let me know how to create class based dynamic quota. In http://apigee.com/docs/api-services/content/rate-limit-api-traffic-using-quota url, I see a sentence like "(To make this work, you would need to add a custom attribute called developer_segment to your access token profiles.)"
Please let me know the steps to create "developer_segment" in access token profiles ? Is it to be created "OAuth" api proxies or the API proxy which is to be consumed.
Also share if you have any other way to create class based dynamic quota.
Thanks,
Damodaran
"developer_segment" is the custom attribute set in the access-token, custom attribute has been set by configuring the attribute in the 'GenerateAccessTokenPolicy'. In the following link, http://apigee.com/docs/api-services/api/oauth-flow-variables, sample policy '' sets the attribute '1' as 'value1' and attribute '2' as value 2.
During verification of access tokens these attribute-values can be accessed as flow variables (accesstoken.).
Note:
In ref="accesstoken.developer_segment",ref can point to any variable it need not be an attribute in accesstoken.

Custom SOAP response of ASMX service

I'm trying to implement a custom SOAP response of the legacy web service.
At the moment it has the following format:
<ServiceResponse>
<ServiceResult>some return value</ServiceResult>
</ServiceResponse>
I need to add string value like this:
<ServiceResponse>NEW VALUE
<ServiceResult>some return value</ServiceResult>
</ServiceResponse>
I'm not sure if it is a good idea at all? Is this SOAP xml valid? If yes, how it can be accomplished?
Any suggestion or idea would be appreciated
That xml isn't valid, in a node you can't have both text and a child node like you have there.
If you're writing your webservice in .NET I would advise you construct a Serializable class that represents the data structure that you want to return, when you create your webservice it will automatically get converted into a valid soap data structure. You will also be able to see the definition of your response when you browse the WSDL at Service.asmx?wsdl.
If you'd like some more info on SOAP checkout the specification at w3.org
Edit: Removed false claim as pointed out by marc_s

i want to pass the array of request to web service at once...it it possible?

I am working with some web services and I want to pass the array of request to the web service at once and the output should be returned once for the whole array of request.
For example, let's say I am requesting the city details by city name. I want to build the array of city names and pass it to the web service and get all the details in one response.
I am using ASP.NET
<AirAvailability_6_2>
<AirAvailMods>
<GenAvail>
<NumSeats>1</NumSeats>
<Class><![CDATA[ ]]></Class>
<StartDt>20091214</StartDt>
<StartPt>LON</StartPt>
<EndPt>AAH</EndPt>
<StartTm>1200</StartTm>
<TmWndInd>D</TmWndInd>
<StartTmWnd>0800</StartTmWnd>
<EndTmWnd>1400</EndTmWnd>
<FltTypeInd></FltTypeInd>
<StartPtInd></StartPtInd>
<EndPtInd></EndPtInd>
<IgnoreTSPref></IgnoreTSPref>
</GenAvail>
</AirAvailMods></AirAvailability_6_2>
<AirAvailability_6_2>
<AirAvailMods>
<GenAvail>
<NumSeats>1</NumSeats>
<Class><![CDATA[ ]]></Class>
<StartDt>20091214</StartDt>
<StartPt>LON</StartPt>
<EndPt>AAH</EndPt>
<StartTm>1200</StartTm>
<TmWndInd>D</TmWndInd>
<StartTmWnd>0800</StartTmWnd>
<EndTmWnd>1400</EndTmWnd>
<FltTypeInd></FltTypeInd>
<StartPtInd></StartPtInd>
<EndPtInd></EndPtInd>
<IgnoreTSPref></IgnoreTSPref>
</GenAvail>
</AirAvailMods></AirAvailability_6_2>
declare the web method to accept an array. Declare the web method to return an array.
[WebMethod]
public CityDetails[] GetCityDetails(string[] names)
{
/// blah blah
}
If you are talking about an existing web service with an API you have no control over - you will have to stick with what this service offers. In other words if the existing API does not provide for batching requests you will have to feed the service one request at a time.
If, on the other hand, you are building the service yourself - noting prevents you from spelling out the API so that it can take an array of requests.
If you have control over both sides of the connection and they're both managed code, then you could create the custom object (serializable) and setup the web method to take in that object as its parameter.
I did this recently using JSON (giving me access from the client side of a web page). You set up the web service to accept a string parameter, and use a JSON Deserializer (DataContractJsonSerializer is one choice) to convert the request to your custom object.
This gives you the ability to pass in the specifics on multiple requests, and pass the results back out the same way (a custom collection object).
Let me know how this works out for you.'
Gabriel

Resources