HTTP Message

Hi there,
I am writing a program that is supposed to show a person all the step involved in sending an http request to a web server.
I was just wondering if there was a way that I could actually get the http request message initially sent through java.
For example, I am looking for a way to see this information from an http GET message:
GET /somedir/page.html HTTP/1.1
Host: www.google.com
Connection: close
User-agent: Mozilla/4.0
Does anyone know if it's possible to represent this in java?

Something like this might work:
import java.net.*;
import java.io.*;
public class DumpServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = null;
        try {
            serverSocket = new ServerSocket(4444);
        } catch (IOException e) {
            System.err.println("Could not listen on port: 4444.");
            System.exit(1);
        Socket clientSocket = null;
        try {
            clientSocket = serverSocket.accept();
        } catch (IOException e) {
            System.err.println("Accept failed.");
            System.exit(1);
        PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
        BufferedReader in = new BufferedReader(
                    new InputStreamReader(
                    clientSocket.getInputStream()));
        String outputLine;
        char[] arin = new char[1024];
        while (true)
          int iread = in.read(arin);
          if (iread < 0) break;
          outputLine = new String(arin, 0, iread);
             System.out.println(outputLine);
        out.close();
        in.close();
        clientSocket.close();
        serverSocket.close();
}You connect to it with a browser with the URL "http://localhost:4444/".
It won't respond to the browser, just dump lines to standard out.
Edited by: sb4 on Mar 9, 2011 12:19 PM

Similar Messages

  • HTTP_RESP_STATUS_CODE_NOT_OK - HTTP message to XI system

    Hi,
    We receive this error when trying to post HTTP message to XI system.
    Have edited the username, password in SICF, xi->engine but it did not solve the problem.
    Can you please let us know if there is anything else we can do.
    Regards,
    Amar

    hi,
    when making a call to xi you need to provide credentials before the interface is executed .
    for example
      reqString = reqString + document.MessageParameters.Server.value+":";
      reqString = reqString + document.MessageParameters.Port.value + "/sap/xi/adapter_plain?";
      reqString = reqString + "namespace=" + senderNamespace;
      reqString = reqString + "&interface=" + document.MessageParameters.SenderInterface.value;
      reqString = reqString + "&service=" + document.MessageParameters.SenderService.value;
      reqString = reqString + "&party=" + document.MessageParameters.SenderParty.value;
      reqString = reqString + "&agency=" + document.MessageParameters.SenderAgency.value;
      reqString = reqString + "&scheme=" + document.MessageParameters.SenderScheme.value;
      reqString = reqString + "&QOS=" + document.MessageParameters.Qos.value;
      reqString = reqString + "&sap-user=<b>useid</b>&sap-password=<b>pwd</b>";
      reqString = reqString + "&sap-client=" + document.MessageParameters.Client.value + "&sap-language=D";
    cheers,
    naveen

  • "Failed to Send the HTTP Message..." - HTTPSupport problem

    Hello,
    We're having a few difficulties when the HTTPServer in UDS5.0.3 running on Solaris 8. Basically, we have a pair of MS .NET servers using some XML Webservices that we reside on the UDS server.
    The symptoms of the problem are that a lot of "Failed to send the HTTP message..." messages are being seen in the log for the partition that contains instances of the HTTPServer. The reason given is a UsageException on the ExternalConnection - stating that the "Object is not open for I/O so it cannot be read or written" (ExternalConnection::Write at 1). This only occurs when a HTTP Response is to be sent back to the .NET server.
    Unfortunately, this exception appears to be occurring somewhere within the code held in the HTTPSupport library, so we can't easily trace the error. Worse still, we don't actually know what's causing the error.
    Does the error indicate a problem with comms between our UDS HTTPServer and the .NET servers? We've also noticed a large number of socket connections being left in a state of CLOSE_WAIT when this error occurs (which eventually block the port altogether resulting in the HTTPServer instances becoming unresponsive).
    As far as I can tell, the Solaris TCP/IP settings are all at the OS default.
    Many thanks for any assistance,
    Jason Bridgen.

    Hi Gordon,
    The problem was solved, the customer changed his ip adress on the server and it's OK now!
    Thank you !!
    Hilla.

  • ABAP Program to send HTTP message

    Hi All,
    I tried executing the program in "[ABAP-Based HTTP Client for Messages to SAP XI|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ae388f45-0901-0010-0f99-a76d785e3ccc]" Article to send HTTP messages to XI system.
    Entered all required parameters and entered XMl Payload with the option "Insert Payload as Text"
    The scenario in XI has Integration Process and the first step is a Sync-Async step.
    The message execution fails in that step with status "Pipeline Timeout"
    I can see only half of the xml payload in sxmb_moni.
    There are no short dumps and the Integration Process is working fine when I send messages using HTTP client.
    Let me know if there are any checks for tracing the problem.
    Thanks,
    Uma

    Hi,
    I have gone thru this blog but I want send SMS to US Mobile no.I checked other webservice but it supports only few cellular networks in US.
    any other alternate for this...
    anyway thanks for your reply
    Regards,
    Nivas

  • How can I capture the complete http-message sent from client to WAS?

    Hello,
    When debugging a BSP application several utility classes/objects are available. Only I can't find the original authentication information forwarded by the client (userid). Therefor I would like to have available the whole http-message (full header and body) so I can distil the information myself.
    Is there a method available which gives me the full, original http-message sent by the client?
    NOTE: I use http-watch in my browser but this is not available on the reversed proxy.
    kind regards,
    Roelof Jan

    Thanks Durairaj,
    I have converted ws_xtring to a string which results in the readable stream below:
    GET /tomonline(bD1lbiZjPTAxMA==)/bp_login.htm HTTP/1.0##host: kappa.trespa.com:8
    015##accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vn
    d.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-sho
    ckwave-flash, /##accept-language: en-us##cache-control: no-cache##connection:
    Keep-Alive##cookie: sap-usercontext=sap-client=010;##pragma: no-cache##referer:
    https://trespa.infonet-asp.com/__extraweb__authen##user-agent: Mozilla/4.0 (comp
    atible; MSIE 6.0; Windows NT 5.0)##authorization:
    But now we get to my real problem. I'm missing authentication information in the httpmessage, forwarded by a reversed proxyserver which is visible in the serverlog (SMICM>Goto>HTTP Log>Server Name>Display Entries):
    ...snapshot of logtail, related to http string above
    212.189.47.211 - tomadmin [20/Apr/2006:11:50:12 +0200] "GET /tomonline(bD1lbiZjPTAxMA==)/bp_login.htm HTTP/1.0" 500 3700
    >212.189.47.211 = the ipadres of the reversed proxy (=client for the BSP application)
    >tomadmin       = the userid which is forwarded basic authentication userid by reversed proxy
    I'm purely interested in this userid <b>tomadmin</b> which I want to use in my application.
    Where did my <b>tomadmin</b> go???
    I configured the service ztomonline as anonymous login. Maybe this mechanism strips of the userid.
    regards Roelof Jan
    Message was edited by: Roelof Jan Bouwknegt

  • How to handle HTTP Message Format

    Hi All,
    i have the interface like XML File(Supplier)--XI--HTTP Message Post(SRM Server)
    How to handle this case and how to handle the HTTP Message formats, what Adapters and all i need to use here
    Regards
    Vamsi

    check susma's reply
    File to HTTP
    File to HTTP
    /people/kausik.medavarapu/blog/2005/12/29/csv-file-lookup-with-http-request-and-response-in-xi

  • HTTP  message timeout

    Hi All,
    I am unable to set the time out value for complete message time out=-1 in weblogic 10.
    In weblogic 8.1 we can set the value og http message time out as -1.
    Is there any such parameter for weblogic 10?
    If yes can we set it to -1.
    By setting complete timeout =480, I am facing timeout issues for message greater than 10MB.

    Hi,
    *<complete-http-message-timeout>* is the maximum number of seconds spent waiting for a complete HTTP message to be received. If you configure network channels for this server, each channel can override this HTTP message timeout.
    This timeout helps guard against a denial of service attack in which a caller indicates that it will be sending a message of a certain size which it never finishes sending.
    *A value of -1 indicates that this value should be obtained from network channels configured for this server.*
    Minimum value: -1
    Maximum value: 480 (U have set the Maximum possible value for this at your end)
    Secure value: 60
    Admin Console Location to Edit this value:
    Home---> DomainName-->Server Summary--->AdminServer (Or any other Server)---> Protocol(tab)---->General(tab)
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Wonders Are here)

  • Transfer files from one directory to another using HTTPS message protocol

    My client has an requirement where the source files are in different directory and they need to be placed in a target directory with the same filename..it looked simple so far... but the actual complexity is that the source files are on a Novell server where my XI box doesn't have visibility ( Novel client cannot be installed on OS win 2003 64 bit)  so File adapter cannot be used to read/write files, i need to design a solution to overcome this. My plan is to write a script or web service in Novel server and use that in the Sender HTTP adapter and also write another Web service to listen to Receiver HTTP adapter, i am not sure how HTTP adapter can be used for transfering files but my client insists on HTTPS as it is more secure. Can any one throw some light... if they had similar requirement before.
    Thanks,
    Ravi

    Hi,
    Sounds ok but... just to understand.. is the target also not accessible from the File Adapter? Otherwise why would you not use the file adapter on the receiver side?
    Secondly HTTP is ok but you realise that for monitoring the HTTP adapter is not part of the Adapter engine and hence if you have issues you could not simply goto the Comm Channel Monitoring to investigate?
    Maybe an approach using SOAP may be better assuming the mssages are not huge.
    Lastly you ask why would you use XI if you can just develop a separate servlet to do the job... well you can mention the following:
    Central Place for Monitoring all message flow and maintenance
    If you are using CCMS then it is very easy to integrate the errors there
    Consistency in overall design to be aligned with other interfaces
    these kind of things are good to bring up... remember that way after the project has completed someone will have to monitor and maintain all of this so it is nice to have a central point of reference to see exactly what interfaces you company has.

  • FSCM via WS-RM (without PI) HTTP message errors

    Hi,
    ( I'm not sure if this is the correct forum for his question so moderators let me know if not)
    I am using ECC 6 ehp 5 which enables you to implement FSCM services via WS-RM (Web Service Reliable Messaging) instead of previously having to use PI. I have gone through SOAMANAGER and created the both the service and consumer proxy as per the SAP guide u2018SAP Financial Supply Chain Management Delta Information SAP Credit Management Enhancement Package 5 for ERP 6.0u2019 but when they get triggered I get firstly status scheduled then when I try and release them from the queue they go into error with the message u2018HTTP response contains status code 401 with the description Unauthorizedu2019
    When I look at the long text (in German) in the SOAP message via SXMB_MONI a translation of the error to English is
    u201CLogin failed
    What has happened?
    Calling the URL http://<our PI instance>:8000/sap/xi/engine was canceled due to bad credentials. u201C
    Can anyone help as it seem strange that it should be trying to call PI when specifically the guide I followed is all about making use of EHP5 functionality to not need PI because both the provider and the consumer are on the same box, ECC.
    Additonal Infomation:
    The service was set up for CreditCommitmentNotification_In . The endpoint was created without communication security and Transport channel Authentication was set as UserID/Passowrd
    The consumer proxy was for CreditCommitmentNotification_Out. And the logical port with reference tot he WSDL for the service was created.
    Thanks in advance.
    Peter

    Hey Peter,
    We are looking for the guide you mentioned to get started on configuring this scenario in EhP5. Is it possible to share that guide?? If so please let me know, I can give you my e-mail ID.
    Regards,
    Sreedhar

  • HTTP message lands up in Adapter Engine

    Hi All
    I must be missing something basic here -
    We have a synchronous HTTP->XI->BW scenario. The message exchange seems to be fine as we can see the response back from BW. The problem is that when we look at SXMB_MONI(SXI_MONITOR) for the message we can't find it. However, on using the runtime workbench ->message monitoring we are able to see the relevant messages, only that they are listed under the "Adapter Engine" and not the "Integration Engine". It is only when there is an error in the message exchange that the messages are visible in SXMB_MONI and in the RWb under the Integration engine.
    Would somebody be able to explain why? And is there a way of making the successful messages appear in SXMB_MONI(ie Integration engine).
    Thanks a lot
    Salil

    Hey
    usually successful sycn message wont show up in sxmb_moni just like that,you need to enable entries in logging and trace
    sxmb_adm ---> integration engine Configuration ---> Specific Configuration
    enter the following
    RUNTIME LOGGING 1
    RUNTIME TRACE_LEVEL 3
    but make sure ur not doing this in Prd system coz that might fill up whole databse very quickly,only do this in dev box
    Thanx
    Aamir
    Message was edited by:
            Aamir Suhail

  • HTTP messages not received by SAP PI system

    hi all,
    We are using SFDC integration , where we are receiving message using HTTP Sender CC. But these messages are not seen in sxmb_moni. How can we check if the messages are reaching SAP PI . What are the settings needed for HTTP communication in SAp pi. Please help.
    Regards,
    Vinithra

    Hello,
    You may need to turn on synch logging in ie. To do this type tcode sxmb_adm, then go to Integration Engine Configuration -> F9 (edit config) -> set LOGGING_SYNC to 1
    Hope this helps,
    Mark

  • Aglet - how to create http message

    Guys, i need help in using Aglet. I want to display a http web using Aglet.
    I try to run WebServerAglet, the example that i got by installing aglet. But i still couldnt run it in tahiti server. I already enabled the option "Accept HTTP request as a message".
    The error message is : "java.lang.ExceptionInnitializerError
    null".
    Do you have explanation of the error? or What i have to do to make a web agent?
    Please help me, since there are not much references i can find.
    thx before.

    Hi Rob,
    If you are using IIS there is a config variable that allows you do this. First create a virtual directory in IIS point to <install dir>\Inetpub\wwwroot directory.
    and then do the below steps
    a.     Login to Content Server
    b.     Click on Administration Admin Server
    c.     Click on Content Server instance name(button)
    d.     Click on General Configuration
    e.     Update SSWebFilterIgnoreList configuration variable
    f.     SSWebFilterIgnoreList=virtualDirectory There should not be any spaces
    g.     Click on save
    h.     Restart Content Server
    Let me if this is what you are looking for.
    regards,
    deepak

  • Howto Send/GET a HTTP message in CRS

    hi all!
    In my solution, I need to communicate with third-party system via HTTP Protocol . So, How do I send a HTTP Request to a application server and receive the HTTP RESPONSE in CRS Script Editor?
    It's very urgent. Please reply me as soon as possible. I'll vote you 5* :)

    The normal way you talk to a Web service is to send an HTTP POST to a URL. The URL consists of a URI + a query string defining the arguments. name=value pairs in the query string are separated by ampersands, and the query string is separated from the URI with a question mark.
    So perhaps your Web service is located at http://some_server:8000/someApp and you want to pass arguments name1=value1 and name2=value2. The software will build up a URL like this
    http://some_server:8000/someApp?name1=value1&name2=value2
    I suspect the CRS application does this.
    What returns from the POST could be an XML document which you can parse.
    Regards,
    Geoff

  • Can't set Authorization header in http message

    Perhaps someone can help me with a problem I'm having. I want
    to set an Authorization header in an HTTP request. From the
    documentation, I can set the "headers" attribute in the HTTPService
    element or I can use a <mx:headers> subelement. It is looking
    for an object or array. I hoping to set the header to look like:
    Authorization: GoogleLogin auth=1234abcd....
    When I use an object, it does not show at all. When I use an
    array of a single string, it includes the zero index of the array
    in the header something like:
    0: Authorization: GoogleLogin....
    Has anybody added custom headers to Http requests before?
    What am I missing?
    --Danny

    Perform for "idUserInteractionLevels" with a Google Site search in this site: http://www15.ocn.ne.jp/~preopen/iddom/domCS-CS3.html. You will get all sorts of questions answered if you are looking for InDesign help with VBScript. One of best sites with InDesign objects clearly documented.
    Hope this helps.
    I created a whole VBScript that will import XML and generate a PDF document in a interactive mode invlking this script from a Web Service.
    PRabhu

  • Error using XI HTTP adapter specific message attribute URL parameters

    Hi XI gurus, in our XI 7.0 SPS11,
    we have problem using URL parameters of plain HTTP receiver adapter.
    If I set Adapter specific message Properties in communication channel and activate switch for Apply URL parameters (using Parameter 1 to 5) filling them using message mapping, we have no effect; instead we have error "Dynamic Header - Missing Message Attributes: Fields/Parameters".
    We carried out this test:
    1. not using adapter specific message attribute and setting
    a static URL target with fixed parameters it runs correctly.
    2. using adapter specific message attribute for target
    URL and URL parameters both doesn't runs correctly.
    3. using adapter specific message attribute only for target
    URL doesn't run correctly.
    These attribute key used for URL parameters:
    URLParamOne
    URLParamTwo
    URLParamThree
    URLParamFour
    URLParamFive
    Namespace: http://sap.com/xi/XI/System/HTTP
    Can you solve this issue? Are there oss notes, corrections, ...
    Thanks in advance.
    Marco Tricase

    Some other test done with TCP gateway.
    Activated adapter specific message properties for
    *URL
    *HTTP Header fields (one header field named "lisca")
    *URL Parameters (one param named "objectType")
    The HTTP message catched by TCP Gateway
    POST /csl/cslinker HTTP/1.0
    content-type: text/xml; charset=UTF-8
    content-length: 318
    connection: close
    accept: /
    user-agent: SAP Web Application Server (1.0;700)
    host: 10.10.43.94:54000
    accept-encoding: gzip
    <?xml version="1.0" encoding="UTF-8"?>
    seems nothing has been generated, and obviusly URL and params have been set in message mapping.
    Hope some guru has been solved the issue ...
    Pasquale Rossiello

Maybe you are looking for