Call a rest service in a WADL via browser



  • I have to call a rest service declared in a WADL but i dont know how to read the file on the description.

    This is the file description for the service :

    -<resources base="http://xxxxxxxxxxxx:8000/webservices/rest/User/">
    -<resource path="change_user_name/">
    -<method name="POST" id="CHANGE_USER_NAME">
    -<request>
    <representation type="CHANGE_USER_NAME_Input" mediaType="application/xml"/>
    <representation type="CHANGE_USER_NAME_Input" mediaType="application/json"/>
    </request>
    </method>
    </resource>
    -<resource path="isuseractive__1/">
    -<method name="POST" id="ISUSERACTIVE__1">
    -<request>
    <representation type="ISUSERACTIVE__1_Input" mediaType="application/xml"/>
    <representation type="ISUSERACTIVE__1_Input" mediaType="application/json"/>
    </request>
    -<response>
    <representation type="ISUSERACTIVE__1_Output" mediaType="application/xml"/>
    <representation type="ISUSERACTIVE__1_Output" mediaType="application/json"/>
    </response>
    </method>
    </resource>
    
    

    And this is the detail description for that method

    <import schemaLocation="http://xxxxxxxxxxxxxxx:8000/webservices/rest/User/?XSD=RESTHeader.xsd" namespace="http://xmlns.oracle.com/apps/fnd/rest/header"/>
    -<element name="InputParameters">
    -<complexType>
    -<sequence>
    <element db:type="VARCHAR2" type="string" name="P_USERNAME" nillable="true" minOccurs="0" db:index="1"/>
    </sequence>
    </complexType>
    </element>
    
    

    I have tried calling the service with POSTMAN :

    http://xxxxxxxxxxxx:8000/webservices/rest/User/Isuseractive__1/ISUSERACTIVE__1
    
    

    authoritation:

    user:xxxx
    password:xxx
    
    

    body:

    {
        "root":{
            "P_USERNAME":"Perico"
        }
    }
    
    

    and it works fine.

    But when i try it with a browser call, i get a 400 error page.

    I tried

    http://xxxxxxxxxxxx:8000/webservices/rest/User/Isuseractive__1/ISUSERACTIVE__1?P_USERNAME=PERICO
    
    http://xxxxxxxxxxxx:8000/webservices/rest/User/Isuseractive__1/ISUSERACTIVE__1?P_USERNAME="PERICO"
    
    

    and more combinations, but nothing worked.


Log in to reply
 

最新帖子

最新内容

  • S

    The error indicates that the accept() call is unable to accept the socket connection. Per the documentation of the underlying system call there are two potential causes for this exception: either you have too many open files in your process or there are too many open files system-wide.

    It's possible that there are too many open connections. You could use netstat -anp | grep TOMCAT_PROCESS_ID to look at how many connections involve the Tomcat server. This will include inbound connections from client, as well as outbound connections from your web-app to external services; inbound connections will show the Tomcat port as the destination. If you have a lot of inbound connections, then it's a problem of too many clients or clients that aren't closing the connection (which your example appears to do).

    More likely is that you're not properly closing files in your web-application (that you've deployed to the Tomcat server). To diagnose that I'd run ls -l /proc/TOMCAT_PROCESS_ID/fd, which will give you a list of all the files and sockets that are open by that process. You will see the application WAR in this list, along with some JARs that are used by Tomcat. If you see a lot of files from your filesystem, look at where they're opened.

    read more
  • S

    Web Service - Tomcat deployed in LINUX Below is my code that sends HTTP request i read that TOO MANY OPEN FILES causes because of client does not close the stream and leave it open then I tried close my stream in below codes And increased ulimit -n number to 4096, still got this error

    if ("GET".equals(methodType)) { //req System.setProperty("http.keepAlive", "false"); logger.info("<--------CALLING TAX-CLIENT REQUEST------------>"); URL url = new URL(api_url + "?" + queryParams); // URLEncoder.encode(queryParams, "UTF-8" logger.debug("API_URL TO SEND REQUEST : " + url); logger.debug("Received TOKEN IS : " + encoding_token); conn = (HttpsURLConnection) url.openConnection(); conn.setRequestProperty("Authorization", "Bearer " + encoding_token); conn.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); conn.setRequestProperty("Accept-Charset", "charset=UTF-8"); conn.setRequestMethod("GET"); conn.setDoInput(true); InputStream _is; /* error from server */ if (conn.getResponseCode() == HttpsURLConnection.HTTP_INTERNAL_ERROR) { _is = conn.getErrorStream(); logger.error("ERROR : " + _is.toString()); throw new BillingException("501", _is.toString(), new BillingExceptionBean()); } else { _is = conn.getInputStream(); } try (BufferedReader in = new BufferedReader( new InputStreamReader(_is, Charset.forName("UTF-8")), BUFFER_SIZE)) { inputLine = in.readLine(); logger.info("Response from tax : " + inputLine); if (inputLine.contains("default message")) { JSONObject jsonObject = new JSONObject(inputLine); String error = jsonObject.getString("code") + ":" + jsonObject.getString("message") + "\n"; this.setErrorMessage(error); } else if (inputLine.contains("error") & inputLine.contains("default")) { String str = inputLine; String[] parts = str.split("default message"); String str1 = parts[2]; String[] parts2 = str1.split("\""); this.setErrorMessage(parts2[0].toString()); } logger.info("Buffered Reader is closed"); in.close(); } logger.info("Input stream is closing connection"); // _is.close(); // conn.disconnect();

    This is ERROR i GOT :

    Feb 21, 2019 9:04:56 AM org.apache.tomcat.util.net.JIoEndpoint$Acceptor run SEVERE: Socket accept failed java.net.SocketException: Too many open files at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:404) at java.net.ServerSocket.implAccept(ServerSocket.java:545) at java.net.ServerSocket.accept(ServerSocket.java:513) at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60) at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:220) at java.lang.Thread.run(Thread.java:745)

    read more
  • S

    Out of the box, Sails uses express-session for session middleware, allowing apps to support all the same functionality available within the express-session package.

    To facilitate sharing the same session across multiple subdomains (foo.example.com, bar.example.com), two options need to be configured in the config/session.js file of your Sails app.

    session: { cookie: { domain : '.example.com', sameSite : false } } cookie.domain : This specifies the value for the Domain Set-Cookie attribute. By default, no domain is set, and most clients will consider the cookie to apply to only the current domain. cookie.sameSite : Specifies the boolean or string to be the value for the SameSite Set-Cookie attribute. true will set the SameSite attribute to Strict for strict same site enforcement. false will not set the SameSite attribute.

    It is worth noting that cookie.sameSite is an attribute that has not yet been fully standardized, and may change in the future. This also means many clients may ignore this attribute until they understand it.

    It is most likely for this reason it is not included in the Sails documentation here. A more complete list of available options for express-session can be found here.

    Another way to manage sessions across multiple subdomains can be found in this stackoverflow question.

    read more
  • S

    I have a Sails application and the authentication using passport works just fine when it is a single domain app (steps as in Passport Doc). I am now trying to convert the app to using subdomains (foo.example.com, bar.example.com), all of which points to the same sails server. The session works only for the same sub-domain, for example, if the user is logging in from foo.example.com, then the user is able to access pages under the same sub domain...but not under bar.example.com. req.isAuthenticated() is returning false when redirecting to a subdomain different from the one that was authenticated.

    How can I ensure the authentication is across the sub-domains? Any help is much appreciated.

    I am using Sails@1.1.0/passport@0.4.0.

    read more
  • S

    If you want to use the value of your helper directly, you can call your helper via () instead of {} like this:

    {{# link-to "someUrl" class="txt-dark-1" (myHelper data) }} Some text {{/link-to}}

    If you want to concat another string value to your class attribute, you can use it via concat helper like this:

    {{# link-to "someUrl" class=(concat "txt-dark-1 " (myHelper data)) }} Some text {{/link-to}}

    read more

推荐阅读