How to return http status?

My application gets a request from an external server and it has to send a http 200 status back if the request was received successfully. If the requesting server does not get a response then it will try to send the request again. Now how do I send a status code 200 to the requesting server from a jsp ?
Thanks.

This should work:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    response.setStatus(HttpServletResponse.SC_OK);
%>or
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    response.setStatus(200);
%>But if a browser is making the request, it automatically returns HTTP 200 . I think even when another application is making a request, it automatically sends a 200 status in the header but I'm not sure about this.

Similar Messages

  • SXI_CACHE returns HTTP status code401 Unauthorized

    Hi All ,
      while going through post installation steps as given in the installation manual i;e creating a Service Test in integration directory , I face this issue
    Transaction SXI_CACHE in integration server returns HTTP status code401 Unauthorized .
    The CPACache History says delta cache refresh is successful , But while activating the change list in XI repository it returns
    Unable to refresh Cache content and in detail it gives out
    HTTP status code401 Unauthorized .
    Went through the soltions people outlines in SDN Forum but None works fine , else commiting some mistkes when where don't know .
    Please note that rfc destination connection type  INTEGRATION_DIRECTORY_HMI  in sm59 prompts me for user id and pasword to enter . I feel it does not take the user id XIISUSER and its password correctly ..
    Any clue ? I am on SP9 .
    Really in big mess...
    Any help???

    Hi,
    1) Can you Check whether SLD is active, Try to re start the SLD ,
    This might help you
    /people/sugree.phatanapherom/blog/2005/08/14/configuring-sld-in-sneak-preview-sap-netweaver-04-sneak
    2) Check is it time out error, ( Data unable to fetch due to time out error )
    3) Go tCode- ST22 and check for the DUMP for more information.
    4)User XIISUSER/PIISUSER uses a wrong password.
    5)Restart the J2EE Engine to activate changes in the
      exchange profile.
    Regards
    Agasthuri Doss

  • Lync 2013 Clients in Child Domain Log "The server returned HTTP status code '403 (0x193)' with text 'Forbidden'."

    Hey All, I am really stumped on this one. 
    Environment - Is using split DNS
    Forest Root Domain - Contains new Lync 2013 Server Standard, ADDS, DNS, Enterprise CA, Workstations
    Clients in this domain connect and work beautifully. No errors. 
    Child Domain - ADDS, DNS, Workstation, Lync 2013 client
    Client autodiscovers, and then asks for a password. Enter the password and this comes up...
    Can't sign in to Lync, You didnt get signed in, It might be your sign-in address or logon credentials..  blah blah blah" 
    Client log shows 
    Error:
    There was an error communicating with the endpoint at 'https://domainlync13srv.Domain.net/WebTicket/WebTicketService.svc'.
    The server returned HTTP status code '403 (0x193)' with text 'Forbidden'.
    The server understood the request, but cannot fulfill it.
    As far as i can tell certificates are correctly configured with all the SAN's possible in my forest. The user is correctly set up in Lync control panel. Autodiscovery seems to be working as it should. EWS is working correctly. 
    Repaired client, removed cached creds, has all lync 2013 updates no dice
    Thank you all! 

    I am an IDIOT. 
    I did not prepare the child domain with the LYNC setup tool. Logged on to a file server in the child domain with domain admin rights and sure enough the setup said the domain was "partial". Ran the setup and bam it all started working. 

  • Autodiscover and Outlook Anywhere return http status 401

    Hi, I'm having issues with Autodiscovery (externally) and Outlook Anywhere for some users on our Exchange 2010 (SP3, RU2) setup. Just for information, we have Exchange servers at two AD sites (same forest / domain) with each site having 2 combined client
    access / hub transport servers and 3 mailbox servers (with 2 stretched DAG's across both sites). Site A is internet facing, but site B isn't.
    Autodiscovery
    Internally, it's working fine (using the Test E-mail AutoConfiguration option within Outlook 2010). But externally (using the Microsoft TestConnectivity site), autodiscovery fails, returning the following:
    Attempting to send an Autodiscover POST request to potential Autodiscover URLs.
    Autodiscover settings weren't obtained when the Autodiscover POST request was sent.
    +Additional Details
       Elapsed Time: 1783 ms.
       + Test Steps
     The Microsoft Connectivity Analyzer is attempting to retrieve an XML Autodiscover response from URL   https://autodiscover.company.com/AutoDiscover/AutoDiscover.xml
    for user [email protected].
     The Microsoft Connectivity Analyzer failed to obtain an Autodiscover XML response.
      +Additional Details
      An HTTP 401 Unauthorized response was received from the remote Unknown server. This is usually the result of an incorrect username or password. If you    are attempting to log onto an Office 365 service, ensure you are using your
    full User Principal Name (UPN).
      Headers received:
      Content-Type: text/html
      Server: Microsoft-IIS/7.5
      WWW-Authenticate: Negotiate,NTLM,Basic realm="autodiscover.company.com"
    The odd thing is, if I browse to the autodiscover file location (externally), then I'm prompted for credentials. When I enter the same credentials that I input into the Microsoft connectivity analyser, I do actually get the correct https status 600 response.
    Also, within EMS, when I run "Test-OutlookWebServices" on Client Access servers in site B, I see the following results...
    RunspaceId : 5c80ec49-f6f8-4f7a-ae63-4ed61a3c966e
    Id         : 1104
    Type       : Error
    Message    : The certificate for the URL https://ExchServer.domain.local/autodiscover/autodiscover.xml is incorrect. For SSL to work, the certificate
    needs
                  to have a subject of ExchServer.domain.local, but the subject that was found is webmail.Company.com. Consider correcting service discovery,
                 or installing a correct SSL certificate.
    RunspaceId : 5c80ec49-f6f8-4f7a-ae63-4ed61a3c966e
    Id         : 1113
    Type       : Error
    Message    : When contacting https://ExchServer.domain.local:443/autodiscover/autodiscover.xml received the error The remote server returned
    an error:
     (500) Internal Server Error.
    RunspaceId : 5c80ec49-f6f8-4f7a-ae63-4ed61a3c966e
    Id         : 1123
    Type       : Error
    Message    : The Autodiscover service couldn't be contacted.
    However - I can't see where Exchange has pulled the "...domain.local" address from for Autodiscovery. Both Get-AutodiscoveryVirtualDirectory and Get-ClientAccessServer both report the correct URLs/URIs with the FQDN of Company.Com (which are on
    the GoDaddy certificate we use both internally and externally).
    Outlook Anywhere
    Whether my issues with Outlook Anywhere are related to Autodiscover, I'm not sure. Users who's mailbox is located at Site A (internet facing) are fine, and Outlook Anywhere works great. But users who's mailbox is at Site B, can't use Outlook Anywhere (Starting
    Outlook in RPCDiag mode shows that it tries to connect, and sometimes establishes a connection for a couple of seconds, then disconnects completely).
    Running "Test-OutlookConnectivity -Protocol:http" on a Client Access server at Site B, passes all but the last scenario (Mailbox::Logon), which throws up the following error:
    RunspaceId                  : 5c80ec49-f6f8-4f7a-ae63-4ed61a3c966e
    ServiceEndpoint             : ExchServer.domain.local
    Id                          : MailboxLogon
    ClientAccessServer          : ExchServer.domain.local.ad.local
    Scenario                    : Mailbox::Logon.
    ScenarioDescription         :
    PerformanceCounterName      : Mailbox: Logon latency
    Result                      : Failure
    Error                       :
    UserName                    : ad.local\extest_a91a4b4076f24
    StartTime                   : 14/01/2014 16:33:27
    Latency                     : -00:00:00.0010000
    EventType                   : Error
    LatencyInMillisecondsString : -1.00
    Identity                    :
    IsValid                     : True
    Testing Outlook Anywhere using Microsoft RCA throws up the error:
    RPC Proxy can't be pinged.
    An HTTP 401 error was received...
    Any help is greatly appreciated. Let me know if I've missed any info!
    Thanks
    Tony

    Hi Guys,
    My first chance today to respond!
    Firstly - thanks for all the information. I really appreciate it.
    Well, the good news is that Outlook Anywhere is now working at Site B. It looks like a combination of disabling Outlook Anywhere at Site B (thanks
    Jon), and then being patient and allowing replication to do its stuff (thanks Rhoderck).
    However RCA is still showing ‘Failed’ with the following error. If it helps to have the full output, please let me know. Just for info, I chose
    the option to test using autodiscovery (rather than manually enter it), which passed fine.
    Attempting to ping RPC proxy webmail.company.com.
    RPC Proxy can't be pinged.
    Additional Details
    An HTTP 401 Unauthorized response was received from the remote Unknown server. This is usually the result of an incorrect username or password.
    If you are attempting to log onto an Office 365 service, ensure you are using your full User Principal Name (UPN). Headers received: Content-Type: text/html Server: Microsoft-IIS/7.5 WWW-Authenticate: Negotiate,NTLM X-Powered-By: ASP.NET Date: Tue, 21 Jan
    2014 09:55:41 GMT Content-Length: 58
    Elapsed Time: 1063 ms.
    RPCProxy - ValidPorts
    Thanks for the 'SoundTrackOfMyLife' link... that looks to be almost identical to my scenario (with the exception of the Kemp LoadMasters). Following
    through the troubleshooting, my CAS servers at Site A (Internet Facing) are showing the registry key 'ValidPorts' as...
    SiteB-ExchCasSvr01:593;SiteB-ExchCasSvr01:49152-65535
    So - should this be...
    SiteB-ExchMbxSvr01:6001-6002;SiteB-ExchMbxSvr01:6004;SiteB-ExchMbxSvr01.domain.local:6001-6002;SiteB-ExchMbxSvr01.domain.local:6004;
    i.e. I only add ports 6001,6002 and 6004 for mailbox servers only? If so, which sites mailbox servers should I put in here?
    SSL Off Loading
    We've only really implemented SSL Offloading on the advice from Kemp (it's built in to their Exchange 2010 template). Apparently, the advantage
    is the LoadMasters have a dedicated hardware processor for decryption/encryption of SSL traffic, thus taking the load off the Exchange servers. Exactly how much of a load this would normally be for our Exchange servers is unknown. We've followed Kemp's documentation
    on unchecking 'Require SSL' for the IIS directories on Site A, and also configured Outlook Anywhere with SSL Offloading through the EMC. This was required as the Kemp's are not re-encrypting traffic to the CAS servers (which are on the same site / LAN
    segment), and we're not a bank... so don't need encryption between the LoadMasters and the client access servers.
    However, Site B (non internet facing) has 'Require SSL' enabled on IIS directories, since (I guess) traffic is encrypted when performing CAS-CAS
    proxying?
    I am, as ever, open to suggestions on this design... since our original design was to use TMG for reverse proxy. It was only the end-of-life issue
    with TMG, and the fact that we opted for the Kemp LoadMasters (which offered ESP as a replacement to TMG) that swung us down this path.
    ESP and SSO are implements on the LoadMaster at Site A (internet facing), which is (was!) not the problem site.
    Thanks again for your time and assistance guys. We’re almost there!
    Tony

  • How to return "HTTP/1.0 401 Authorization Required" from OSB's Message Flow

    How can I return "HTTP/1.0 401 Authorization Required" header from OSB's Message Flow?
    Using of "HTTP Transport -> Authentification" is not possible, because I need flow condition. Transports Headers activity from design palette doesn't allow to send such headers.
    Practical usage: request for kerberos ticket by sending two headers: 401 and WWW-Authenticate: Negotiate...

    Can you briefly expand the use case for better understanding?
    HTTP Client---> Hand Shakes or what ever ----> HTTP Proxy (OSB )---> Pipeline----
    Philosophy behind pipeline is that it is designed to work on the request. Correct me if I'm wrong.
    What you are asking is ability to control the hand shake either in Pipeline or some way during proxy configuration. Unfortunately there is no configuration that is exposed for HTTP proxies in OSB to control that behavior.
    Manoj

  • How to set HTTP status codes from BSP

    Hello,
    How can I set the HTTP status code from a BSP?
    I use response->set_status( code = 500 reason = 'Error') from OnInputProcessing event, but nothing happens...
    Tia,
    Joerg

    Hi,
    Thank you for the references, but unfortunately it still does not work for me.
    Here's what I do in my BSP:
    - The BSP displays a simple Form in which some user data
      can be entered.
    - In the OnInputProcessing event handler of this BSP the
      data is analyzed. If there is an error, the following
      code is executed:
      if l_error eq 'X'.
        data:
          res type ref to if_http_response.
        res = runtime->server->response.
        res->set_status( code   = 500
                         reason = 'Internal error' ).
      endif.
    - I would expect the Browser to display the error page,
      however I simply get the BSP Form again - the HTTP
      error is not shown at all.
    What am I doing wrong?
    Thanks, Joerg

  • Returning HTTP status codes (401, 403, etc) to Flash 8

    Hi all,
    I'm using AMFPHP on the server-side and Flash remoting
    classes to communicate with it. Everything's working great, but i'd
    like Flash to be able to recieve HTTP status codes from the server.
    For example, if on the server side (in PHP) I go:
    header("Status: 401 Unauthorized");
    I'd like the remoting service on the flash side to be able to
    get the HTTP error code (401 in the example above).
    I know this is possible with
    [url=http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context =LiveDocs_Parts&file=00002333.html]LoadVars.onHTTPStatus[/url]
    but it doesn't seem to deal with using it with Flash Remoting.
    Thanks all :)
    - Nilesh

    Hi, I am trying to PUT to update contact info and I get following error:
    2015-01-16 11:00:17,970 INFO [main] oracle.eloqua.connector.eloqua.EloquaConnector.putWithBasicAuth(97) | accessHttpsPut.url=https://secure.eloqua.com/API/REST/2.0//data/contact/7606838, text={"id":"7606838","accountName":"openIdStr001","emailAddress":"[email protected]","type":"Contact"}
    2015-01-16 11:00:18,931 ERROR [main] oracle.eloqua.connector.eloqua.EloquaConnector.putWithBasicAuth(140) | ClientProtocolException
    org.apache.http.client.HttpResponseException: Request is malformed.
    Is there any idea?
    Thanks so much.
    Sincerely.

  • How to resolve HTTPS status code 404 using WinHTTP?

    I am getting status code 404 for the below code snippet.
    Note: please add `<HOSTNAME>` when you are trying to figure out the issue.
    HINTERNET m_hConnect;
    HINTERNET m_hSession;
    HINTERNET m_hRequest;
    m_hSession = WinHttpOpen(userAgent,
    WINHTTP_ACCESS_TYPE_NO_PROXY,
    WINHTTP_NO_PROXY_NAME,
    WINHTTP_NO_PROXY_BYPASS, 0);
    if (!m_hSession) {
    printf("WinHttpOpen:Error %d has occurred.",GetLastError());
    return 0;
    // connect to the IPP server on the given port
    m_hConnect = WinHttpConnect( m_hSession, <HOSTNAME>, 443, 0);
    if (!m_hConnect) {
    printf("WinHttpConnect: Error %d has occurred.",GetLastError());
    return 0;
    // Create an HTTP Request handle.
    m_hRequest = WinHttpOpenRequest(m_hConnect, L"POST" ,L"/ipp",
    L"HTTP/1.1", WINHTTP_NO_REFERER,
    WINHTTP_DEFAULT_ACCEPT_TYPES,WINHTTP_FLAG_SECURE);
    if (!m_hRequest) {
    printf("WinHttpOpenRequest:Error %d has occurred.",GetLastError());
    return 0;
    DWORD secureflags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID |SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID;
    BOOL bResult= WinHttpSetOption(m_hRequest, WINHTTP_OPTION_SECURITY_FLAGS, (LPVOID)&secureflags, sizeof(secureflags));
    if (!bResult) {
    printf("WinHttpSetOption:Error %d has occurred.",GetLastError());
    return 0;
    bResult = WinHttpSendRequest(m_hRequest, WINHTTP_NO_ADDITIONAL_HEADERS,0,WINHTTP_NO_REQUEST_DATA,0,0,0);
    if (!bResult) {
    printf("WinHttpSendRequest:Error %d has occurred.",GetLastError());
    return 0;
    if( !WinHttpReceiveResponse( m_hRequest, NULL ) )
    if( GetLastError( ) == ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED )
    HCERTSTORE hMyStore = 0;
    PCCERT_CONTEXT pCertContext = 0;
    WCHAR szCertName[256]={0};
    //MY is the store the certificate is in.
    hMyStore = CertOpenSystemStore( 0, TEXT("MY") );
    if( hMyStore )
    pCertContext = CertFindCertificateInStore( hMyStore,
    X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
    0,
    CERT_FIND_SUBJECT_STR,
    (LPVOID) szCertName, //Subject string in the certificate.
    NULL );
    if( pCertContext )
    WinHttpSetOption( m_hRequest,
    WINHTTP_OPTION_CLIENT_CERT_CONTEXT,
    (LPVOID) pCertContext,
    sizeof(CERT_CONTEXT) );
    CertFreeCertificateContext( pCertContext );
    CertCloseStore( hMyStore, 0 );
    // NOTE: Application should now resend the request.
    bResult = WinHttpSendRequest(m_hRequest, WINHTTP_NO_ADDITIONAL_HEADERS,0,WINHTTP_NO_REQUEST_DATA,0,0,0);
    if (!bResult) {
    printf("WinHttpSendRequest:Error %d has occurred.",GetLastError());
    return 0;
    DWORD dwStatusCode = 0;
    DWORD dwSize = sizeof(DWORD);
    BOOL bResults = true;
    bResults = WinHttpQueryHeaders( m_hRequest, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, NULL, &dwStatusCode, &dwSize, NULL );
    Result: I am getting status code of 404. I am not able to figure out why it is happening.
    FYI, Using `WinINet`,  I have followed the same procedure, I am getting status code of 200, which is success. But my requirement is to use only `WinHttp`.
    Could any one please help me out to solve this issue. This is very urgent for me.
    SivaV

    Dear Henri,
    Thanks for your reply, it was really very helpful.
    I debugged
    HTTP session with Fiddler,
    I am getting certificate error.
    When I say 'Yes' in Fiddler, I am getting 200 success.
    Could you please help me out how to
    "Ignore certificate errors" using WinHTTP
    API's.
    Thanks in Advance.
    Best Regards,
    Siva
    SivaV

  • How to return order status and the status of the next order

    Greetings,
    I cannot use the LEAD function.
    How do i simulate this in Oracle 8i PE.
    I have a table of orders and for each grouping of orders i need the current status and the next status.
    Any suggestions?
    Thanks,
    Craig.

    Something like:
    SELECT i.order_id, i.item, i.status
                 MAX(i2.status) next_status
    FROM incidents i, incidents i2
    WHERE i.order_id = i2.order_id(+)
      AND i.order_id < i2.order+id (+)
    GROUP BY i.order_id, i.item, i.status
    ORDER BY i.order_id
    Greetings,
    I cannot use the LEAD function.
    How do i simulate this in Oracle 8i PE.
    I have a table of orders and for each grouping of orders i need the current status and the next status.
    Any suggestions?
    Thanks,
    Craig.

  • At various sites firefox (but not IE) returns Http status code 416: "requested range not satisfiable"; what's the solution?

    Yes, we are running firefox 5.0 and most likely all the stuff you detected (I don't know how to tell, but they sound like stuff we have)
    * 1.9.0009.1
    * ActiveTouch General Plugin Container Version 105
    * Adobe PDF Plug-In For Firefox and Netscape 10.0.1
    * NPRuntime Script Plug-in Library for Java(TM) Deploy
    * 12.0.1.647
    * RealPlayer(tm) LiveConnect-Enabled Plug-In
    * RealJukebox Netscape Plugin
    * Shockwave Flash 10.2 r152
    * Picasa plugin
    * Next Generation Java Plug-in 1.6.0_25 for Mozilla browsers
    * 4.0.50524.0
    * RealPlayer(tm) HTML5VideoShim Plug-In
    * RealNetworks(tm) RealPlayer Chrome Background Extension Plug-In

    I cleared the network history cache first: did not fix completely, but seemed to make it better. Next I cleared the everything out of the cooke cache except the cookies themselves: seemed to make problem much worse! Finally I cleared the cookies themselves: made problem much better, but still not 100%
    I think you are onto somethng, mha007. Perhaps the problem occurs as firefox checks to see if the page is already in its cache, or if the page's cookie is on record. Somewhere along the line the requested address gets screwed up.
    Reply

  • Configure HTTP Status Response Messages

    Dear Portal Experts,
    we have an issue with the the way portal response codes are put into response messages. The portal sits in an infrastructure which includes multiple security measures, including a reverse proxy. This reverse proxy does not accept certain HTTP responses, which strictly speaking are not standard compliant.
    The HTTP response status of interest is HTTP status 304 which means that a requested resource has not been changed since the last request and therefore can be taken from the cache.
    The status is returned boldfrom the portal with a bodybold, which is not accepted by the reverse proxy.
    Now, what we would like to do is configure the portal to return HTTP status 304 with a header only. Is that possible? We looked into web.xml and web-j2ee-engine.xml but could not find any hint for this. Might easily be, we looked at the wrong places (they were multiple ones...).
    Thank you very much,
    Michael

    According to RFC 2616 the implementation of HTTP code 304 is:
    If the client has performed a conditional GET request and access is allowed, but the document has not been modified, the server SHOULD respond with this status code. The 304 response MUST NOT contain a message-body, and thus is always terminated by the first empty line after the header fields.
    The response MUST include the following header fields:
          - Date, unless its omission is required by section 14.18.1
    If a clockless origin server obeys these rules, and proxies and clients add their own Date to any response received without one (as already specified by [RFC 2068], section 14.19), caches will operate correctly.
          - ETag and/or Content-Location, if the header would have been sent
            in a 200 response to the same request
          - Expires, Cache-Control, and/or Vary, if the field-value might
            differ from that sent in any previous response for the same
            variant
    If the conditional GET used a strong cache validator (see section 13.3.3), the response SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional GET used a weak validator), the response MUST NOT include other entity-headers; this prevents inconsistencies between cached entity-bodies and updated headers. If a 304 response indicates an entity not currently cached, then the cache MUST disregard the response and repeat the request without the conditional.
    If a cache uses a received 304 response to update a cache entry, the cache MUST update the entry to reflect any new field values given in the response.
    Source: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
    @Michael --> I honestly can't imagne that SAP wouldn't confirm to such an RFC (but I cannot guarantee), could it be that another component is adding the body to the 304 code or malforming this reply?
    @ SAP employees --> can you confirm if SAP has complied with RFC2616 or not???
    Cheers,
    Benjamin

  • How to Implement HTTP Request Status Code Processing

    I actually have two questions. First, I wondering how to add multiple status code processing to an http request. Secondly, I was wondering how to go about using alternate http requests to different servers in case the primary server is down. What kind of parameter would the program use to determine that the server is unavailable and switch to another server??
    Currently, the program I've written calls an rdf server (http://www.rdfabout.com/sparql) using a sparql query,
    the server returns an xml string, the program parses it, and calculates numbers
    from the string. The program works, but the problem is that the server is down occasionally.
    When the server is down, we need to add calls to another server to
    increase reliability. So, the next task is to call this server:
    http://www.melissadata.com/lookups/ZipDemo2000.asp
    I need to do exactly the same things I did with the rdf server. The
    difference will be constructing a request and a bit different parsing of
    the response.
    current SPARQL query is defined as follows:
    PREFIX dc:  <http://purl.org/dc/elements/1.1/>
    PREFIX census: <http://www.rdfabout.com/rdf/schema/census/>
    PREFIX census1: <tag:govshare.info,2005:rdf/census/details/100pct/>
    DESCRIBE ?table WHERE {
    <http://www.rdfabout.com/rdf/usgov/geo/census/zcta/90292> census:details
    ?details .
    ?details census1:totalPopulation ?table .
    ?table dc:title "SEX BY AGE (P012001)" .
    }current HTTP Request is defined as follows:
    import java.net.*;
    import java.net.URL;
    import java.net.URLConnection;
    import java.io.*;
    import java.io.DataOutputStream;
    import java.io.BufferedReader;
    import java.io.StringReader;
    import java.io.InputStreamReader;
    import java.io.PrintStream;
    import java.util.Scanner;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import java.util.Arrays; 
    public class MyConnection
         static Scanner sc = new Scanner(System.in);//allows user to input zipcode
        public static void main(String[] args) throws Exception
             int zip;//zipcode is declared as integer format
            //User defines zip through input
            //proceed to put SPARQL query into string, which is then used to call the server
            String requestPart1 =
            "query=PREFIX+dc%3A++%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+%0D%0APREFIX+census%3A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fschema%2Fcensus%2F%3E+%0D%0APREFIX+census1%3A+%3Ctag%3Agovshare.info%2C2005%3Ardf%2Fcensus%2Fdetails%2F100pct%2F%3E+%0D%0A%0D%0ADESCRIBE+%3Ftable+WHERE+%7B+%0D%0A+%3Chttp%3A%2F%2Fwww.rdfabout.com%2Frdf%2Fusgov%2Fgeo%2Fcensus%2Fzcta%2F";
            String requestPart2 = "" + zip; // zipcode is transformed from int to string format and plugged into SPARQL query here
            String requestPart3 =
            "%3E+census%3Adetails+%3Fdetails+.+%0D%0A+%3Fdetails+census1%3AtotalPopulation+%3Ftable+.+%0D%0A+%3Ftable+dc%3Atitle+%22SEX+BY+AGE+%28P012001%29%22+.+%0D%0A%7D%0D%0A&outputMimeType=text%2Fxml";
            String response = "";
            URL url = new URL("http://www.rdfabout.com/sparql");//designates server to connect to
            URLConnection conn = url.openConnection();//opens connection to server
            // Set connection parameters.
            conn.setDoInput (true);
            conn.setDoOutput (true);
            conn.setUseCaches (false);
            // Make server believe we are form data…
            conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
            DataOutputStream out = new DataOutputStream (conn.getOutputStream ());
            // Write out the bytes of the content string to the stream.
            out.writeBytes(requestPart1 + requestPart2 + requestPart3);
            out.flush ();
            out.close ();
            // Read response from the input stream.
            BufferedReader in = new BufferedReader (new InputStreamReader(conn.getInputStream ()));
            String temp;
            while ((temp = in.readLine()) != null)
                 response += temp + "\n";
            temp = null;
            in.close ();
            //parsing stuff is taken care of after here
    }What remains now is to:
    1) add status code processing: notify if the server is not available, ect.
    2) add ability to connect to additional server if primary server is down.
    I'm thinking an if/else statement, which I've tried a few different ways,
    but I don't quite know how to implement that...Also trying to add the
    status code processing/error handling, but I'm not sure how to do that
    for multiple/different errors, such as 404, 503, 504, ect.. try/catch statements?
    So yeah, just been scratching my head on this trying to figure out how to work it..
    If you can help me out on this, I've been going nuts trying to figure this out...

    I think your issue comes form the fact that you are not casting URLConnection to HttpURLConnection.
    Doing the cast would allow you to use getResponseCode() - among other methods - and test for a response different than 200.
    Read: [http://mindprod.com/jgloss/urlconnection.html|http://mindprod.com/jgloss/urlconnection.html]

  • HTTP status code returned by site-wide error handler is 200 OK?

    I'm using a developer install of ColdFusion 11. I set up the following page at http://localhost:8500/test/index.cfm:
    <cfthrow type="application" message="This is an error">
    When I visit that page, the HTTP status code returned is 500, as expected.
    I then created the following page at http://localhost:8500/error.cfm:
    <p>Sorry! That was an error.</p>
    If I set the site-wide error handler in the CF Admin to /error.cfm and visit /test/index.cfm, the HTTP status code returned is 200 OK.
    This seems weird to me. It looks like I can include the following in the error.cfm file to send an error code instead:
    <cfheader statuscode="500" statustext="Server Error">
    Does anyone see that as problematic? Is there a reason why the site-wide error handler should return 200 OK?

    Error Codes are the responsibility of the developer, to define and broadcast. Ultimately, the ColdFusion server has acted appropriately and fulfilled the request (hence the 202). Only the code would know what error was truly thrown, and how to appropriately handle that message to the user, hence the need for you to change the header in the response, if you want that broadcast to the browser in anything of than a "successful request" type of status.

  • HTTP send returned with status code(100,101)

    Hi Experts,
    I am facing an error in ADS at se38 --> FP_PDF_TEST_00
    Test Program: Version Information (for Analysis Only)
    SYSTEM ERROR
    ERROR CODE    :    100,101
    ERROR MESSAGE : SOAP Runtime Exception: CSoapExceptionTransport : HTTP send returned with status code
    SOAP Framework error: SOAP Runtime Exception: CSoapExceptionTransport : HTTP send returned with status code(100,101).
    Please let me know how to resolve this issue
    Thanks & Regards,
    Arun

    Hi,
    Thanks For your reply..
    I tryied but no use
    Actually Here i am tryping to do configuration between ECC6 and Bi (ABAP+JAVA) system
    Here my Bi  system no id different from ECC6 system no.
    The steps i did is
    1.created ADS HTTP RFC Connection  in ECC6 sytem
    2. System no. given as BI system no.
    3. If i give prefix:  /AdobeDocumentServices/Config?style=rpc  it is not allowing me to save  But i give /AdobeDocumentServices/Config it allows me to save
    4.And other settings i followed as document "Configuring ADS for Guided Procedures ''
    I am facing same error
    Test Program: Version Information (for Analysis Only)
    SYSTEM ERROR
    ERROR CODE    :    100,101
    ERROR MESSAGE : SOAP Runtime Exception: CSoapExceptionTransport : HTTP send returned with status code
    SOAP Framework error: SOAP Runtime Exception: CSoapExceptionTransport : HTTP send returned with status code(100,101).
    Please any body know me the solution
    Thanks & Regards,
    Arun

  • Test web service published returns Error code: InternalError, Http status code: 500

    Further invastigating ther error mentioned here: 
    https://social.msdn.microsoft.com/Forums/azure/en-US/14afa50f-287d-4158-852a-c9532f9f30eb/test-published-web-service-experiment-error-with-status-code-400?forum=MachineLearning
    I have made an even simpler experiment with two python scirpt modules. The experiment again runs fine in Azure ML Studio but fails in the web service test with the error
    Error code: InternalError, Http status code: 500, Request id: 53eef674-190a-4f63-bdc6-a072a45a9c72, Timestamp: Fri, 24 Apr 2015 09:30:37 GMT
    The experiment consists only of two python script modules. The code of the first module:
    import numpy as np
    import pandas as pd
    def azureml_main(dataframe1 = None, dataframe2 = None):
        dataframe1.loc[1] = ["U5000","resB",np.nan]
        dataframe1.loc[2] = ["U5000","resC",2]
        dataframe1.loc[3] = ["U5000","resD",2]
        dataframe1.loc[4] = ["U5000","resE",np.nan]
        dataframe1.loc[5] = ["U6000","resA",np.nan]
        dataframe1.loc[6] = ["U6000","resB",1]
        dataframe1.loc[7] = ["U6000","resC",2]
        dataframe1.loc[8] = ["U6000","resD",np.nan]
        dataframe1.loc[9] = ["U6000","resE",1]
        dataframe1['hasRated'] = pd.Series(1, index=dataframe1.index).astype(bool)
        df_new = pd.DataFrame()
        df_new = pd.DataFrame(dataframe1[["restaurant","rating","hasRated"]])
        return df_new,
    The code of the second module that takes as input the result of the first module:
    def azureml_main(dataframe1 = None, dataframe2 = None):
    return dataframe1,
    A url of a screenshot taken from the experiment.
    http://i.imgur.com/4nrbneA.png
    Please respond. Again I am using a free workspace of Azure ML Studio.
    Thank you very much

    Thank you for your quick reply.
    I hope you will be able to resolve this issue soon.
    asavvopoulos

Maybe you are looking for

  • Short dump in VF01 - Syntax error in program "RKEAK9RECP3000001"

    Helo all, We recently copied our production client to a QA client and when we try to save an SD invoice (VF01), we get a short dump titled - Syntax error in program "RKEAK9RECP3000001". The dump long text states: "The Dictionary structure or table "K

  • Cant view my iweb

    for some reason when i publish my iweb and click VISIT it sends me to my other personal website. my websites name is www.bdbcmusic.com thats where my iweb goes. is there a way to change my iweb URL?on the bottom of my iweb page it says [email protect

  • Jdbc-odbc java error using SQL adapter in o9iASWireless

    I've used the SQL adapter in the previous releases of wireless without any problem. Most of the time I would use it for all the wireless PLSQL applications in the Oracle database and it works very OK. I have also used it to connect with a SQLserver d

  • "No Name" drive Icon in "Devices" section. What is this?

    During a work trip, a folder popped up on my desktop. "No Name" but with an icon below Macintosh HD and iDisk under "Devices". It looks like it has people walking across the box, but I cannot see closely. It could be protractors too... It will not ej

  • Photoshop CS5 - Thumbnails in Explorer

    I convert all my photos into dng and some I leave as raw but in any case I cannot see the photos when I do  an open in CS5 and browse to see the picture, is there something I need to download 3rd party wise to view these or am I messing up somewhere?