Calling AMF Services

PDF Print E-mail
User Rating:  / 12
Rate this article: PoorBest 

Using AMF Request window you can create calls to AMF services. First set your endpoint which for the sample application is http://127.0.0.1:8400/samples/messagebroker/amf , then add the AMF call product.getProducts. This getPoducts method in ProductService.java doesn't require parameters so we can just submit the call, make sure both your blazeDS sample database and server are started.

Endpoint-GetProducts

Your response should look like this:

Products-GetProducts

Now change the AMF Call to getProduct instead, which has one method parameter: the id number of product in database. Add the parameter to the parameters-table as follows:

Get-Product-with-id

Note that the order of parameters in our table should corresponds to the order of the method parameters of the AMF Call (names of your parameters in the table are not important). When submitting this call you should see something like this :

Product-id-9-response

Now if you want to call product.create method you need to provide Product object as the method argument. So, how can you add a complex parameter of any type to the table? It is really simple with script editor; add one parameter in our parameters table named product (or whatever you want) and leave the value blank.

Create-Product

Next you use script editor to initialize new Product object and assign it to the "product" parameter.

Create-Product-Script

As you can see the script editor exposes a built in parameters variable which you can use for initialization of your parameter values (not only complex ones). There is also an amfHeader variable with same functionality for initializing complex objects in AMF Header inspector.

Now you can submit this call, and your response should look something like this

Created-Product-in-Response


Session

In soapUI you can also enable AMF session and within session reuse connection.
For this purpose you need to do following: Open your TestCase and click on the Options button.

AMF-Session

In the AMF tab you can set whether you need to use session and authorize  to an AMF service for all AMF requests in your TestCase. When choosing this you need to provide the AMF endpoint, login and password, which will be used when running the TestCase; it will login to the specified AMF service before the first TestStep and logout after last TestStep in the TestCase. The authorized AMF connection is shared among all AMF TestSteps in the Test Case.