Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

parasoft jump start project query

RajeshU
RajeshU Posts: 19

Im creating test scripts using the java code through the parasoft jum start project and i was able to create a rest client with Input Mode as literal and pass the payload directly as a string but i need to pass the input payload from a File for which i dont see the option in the availble code.

i have the following code to set the input mode

payload.setInputMode(InputMode.Literal);
payload.setContentType("text/xml");
literal.setText("payload"); // able to pass the payload as string, need the code which would
accept the payload from external file.

Comments

  • jakubiak
    jakubiak Posts: 813 admin

    You can use Java code to read the contents from the File and pass it as a string to the payload. Here is a link that shows some ways to do this in Java: https://techblogstation.com/java/read-text-file-in-java/

  • RajeshU
    RajeshU Posts: 19
    edited September 2020

    Thanks jakubiak , I'm also not able to see the code to setup the client side SSL in Security class for both http10 and http11.

    1. The security class only has the "setHttpAuthentication" method and there is
      not option to set the ClientSideSSL through the parasoft code.

    2. Also is there a package in the project that would add the global property ->
      Global Key store through the code ?

  • jakubiak
    jakubiak Posts: 813 admin

    The REST API does not have the ability to set Client Side SSL options. An option for this would be to manually create a client in the SOAtest UI that has the Client Side SSL options configured, and upload that to your SOAtest server. Then when you want to create a new client from the REST API, instead of creating a new one from scratch, you create a copy of the pre-configured client and then use the REST API to set the other fields.

    Regarding global key store, you will need to configure those settings manually in the SOAtest server. The SOAtest REST API does not have an API for setting Global key store.

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭

    As an aside, the "jump start" java project was incomplete and later removed at least a couple releases ago. A newer java client is available. See
    Connecting to the API Using the Java Client

  • RajeshU
    RajeshU Posts: 19

    @benken_parasoft Where can i find the java documentation on the classes and functions to be called for creation tst files and rest clients through java. In the API documentation i find only resources related to Rest API calls , i need the details of java functions.

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭
    edited January 2021

    The java classes map 1-to-1 with the resources in the REST API. The methods in each class map 1-to-1 with the operations for that resource in the REST API. The same descriptions you see the API docs are the same descriptions you see in the javadocs for each class and method in the java API. The javadocs are published with the main jar (look here).

  • RajeshU
    RajeshU Posts: 19

    I keep getting authentication error when trying to run the Rest API from the tool (HTTP/1.1 407 Proxy Authentication Required) .

    When i run the same request from the try it out section of the REST API docs the response is successful.

  • jakubiak
    jakubiak Posts: 813 admin

    Is your browser configured to go through a proxy before it reaches your SOAtest server? If so, it sounds like you need to configure Java proxy settings before you use the Java API to connect to the server.