Post XML over HTTPS

We are trying to do the following. Can anyone help by providing any pointers as how to do it.
1. A java client will be posting XML over http(s) to the Tomcat server.
2. The Tomcat server has to do the following:
- Validate the user credentails and verify that it is an valid user on IDM
- Do some DB operations and return back a response XML
We are trying to do this by having the Java client post XML over http to a jsp hosted on the Tomcat server
How do i retrieve the XML data from the HTTP post (from the HTTP body) ?
Thanks

try the below example to read data over https,
import java.net.*;
import java.io.*;
import javax.net.ssl.*;
public class SSLSocketClient {
public static void main(String[] args) throws Exception {
     String url="https://secure.com";
          try {
               SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
            SSLSocket socket = (SSLSocket)factory.createSocket(url, 443);
            socket.startHandshake();
            /* read response */
            BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null)
                System.out.println(inputLine);
            in.close();
            socket.close();
        } catch (Exception e) {
            e.printStackTrace();
}

Similar Messages

  • Post XML over HTTPS in a loop

    HI,
    I have a requirement to post XMLs over HTTPS. I also am supposed to retrieve the response XML, interpret it and do some processing based on the response status in the response XML. This has to be done for each XML.
    Currently I am establishing a new HTTPsURLConnection for each XML, wrting the XML to output stream, retrieving the response from input stream and then releasing the connection using disconnect() method.
    Is this the recommended approach or should I be creating just one connection for posting all the XMLs? Also, does java use some kind of connection pooling while creating HTTPURLConnection?
    I am frequently getting "SocketTimeoutException Exception --> connect timed out" while processing large number of XMLs. Is this exception due to large number of connections that I am creating?
    This program is running as a stand alone program on unix box.
    Regards,
    Jacob

    Is this the recommended approachYes.
    or should I be creating just one connection for posting all the XMLs?No.
    Also, does java use some kind of connection pooling while creating HTTPURLConnection? Yes.
    I am frequently getting "SocketTimeoutException Exception --> connect timed out" while processing large number of XMLs. Is this exception due to large number of connections that I am creating?Could be, especially if you're doing them in parallel.

  • How to post  xml over http

    Hi experts,,
    My idea is to post XMl file from client application to server.
    user.XMl file will be created then and there dynamically based on user entered data.
    For this i have a .java program in client application.
    And one important thing is My XMl file contain image in binary data,, which is in Base64Encoded format.
                      <?xml version="1.0" encoding="UTF-8"?>
                    <FileAttachment>
                                         <UserName>krish</userName>
                                         <password>rao</password>
                                        <image type="jpg">
                                                   <PictureData>
                                                    QAAAAIAGtaMS2/u6RnIAAAAIYAAAAKAAAAYm
                                                          l0bWFwLmJtcHPybWOAADMg1gBiVihm
                                                      ZJAAiwcA8RE+CIaB/6iAYj4AUEsBAhQAFAAAAAgAa1oxLb+7
                                                     pGcgAAAAhgAAAAoAAAAAAAAA
                                                      AAAgALaBAAAAAGJpdG1hcC5ibXBQSwUGAAAAAA
                                                    EAAQA4AAAASAAAAAAA
                                             </PictureData>
                                        </image>
                     </FileAttachment>My .xml like above.. i have to post it to server . Some thing like http://myserver:8080/Requesthandler.java which recive the xml and parse it and do some other things.
    And one thing is My server at some location and my client application at other location.
    Plz do me some help as early as possible

    Thak u
    but i am sitting in front of laptop but i cant find perfect code match to me.
    Give me link if possible,
    <Product>
      <SKU>99238</SKU>
      <Description>Super Gidgetidoo</Description>
      <Picture>
    Content-Description: File encoded with ENCODE64.EXE.
    Content-Disposition: attachment; filename="foo.zip"
    Content-Transfer-Encoding: BASE64
    Content-Type: application/octet-stream
    UEsDBBQAAAAIAGtaMS2/u6RnIAAAAIYAAAAKAAAAYm
    l0bWFwLmJtcHPybWOAADMg1gBiVihm
    ZJAAiwcA8RE+CIaB/6iAYj4AUEsBAhQAFAAAAAgAa1oxLb+7
    pGcgAAAAhgAAAAoAAAAAAAAA
    AAAgALaBAAAAAGJpdG1hcC5ibXBQSwUGAAAAAA
    EAAQA4AAAASAAAAAAA
      </Picture>
    </Product> If my xml like above and its created dynamically based on client input.
    I find some code to post above xml, But it post an XMl file in hard disk
    it uses output stream to post , ie read every byte in xml and write to out put stream.like below
    response.setContentType("text/xml");
          response.addHeader("Content-Disposition", "attachment; filename="
              + fileName);
          response.setContentLength((int) xml.length());
          FileInputStream input = new FileInputStream(xml);
          buf = new BufferedInputStream(input);
          int readBytes = 0;
          while ((readBytes = buf.read()) != -1)
            stream.write(readBytes);But i want to post xml file as it is , means whole xml document as an element
    let me help

  • Accessing Java webservice (XML over http) via WCF or HTTP adapter with content-type and authorization HTTP headers with POST method

    Hi Team,
    I need to access Java web service which is simple service and accepts and returns XML over HTTP. No credentials are needed to access the service. We need to pass following two HTTP headers (Content-Type and Authorization) along with XML request message:
    <GetStatus> message is being constructed in the orchestration and URI is constant to access.
    Which adapter shall I use to get the response back? I tried using WCF-WSHttp with Security Mode = Transport, and different options of client credential types but every time, error returned stating:
    System.Net.WebException:
    The HTTP request is unauthorized with client authentication scheme 'Basic'. The
    authentication header received from the server was 'Basic realm='.
    Authentication failed for principal Basic. Message payload is of type:
    String 
    In Fiddler, request looks line following
    POST <https://URL/GetServiceReopnse HTTP/1.1
    Content-Type: application/xml
    Authorization: Basic cmVmU3RhdHN2Y19kgeRfsdfs=
    Host: <Server name>
    <GetStatus XMLNS="http://server.com/.....">
    <OrgId>232323</OrgId>
    <HubId>3232342323</HubId>
    </GetStatus>
    MMK-007

    First, you should not use the HTTP Adapter because it's been deprecated and replaced by WCF.
    Start with the WCF-Custom Adapter and select the customBinding.
    You should start with the textMessageEncoder and httpTransport and go from there.

  • XML over HTTP using BPEL (not using SOAP)... is this possible?

    Hi there.
    We're trying to expose a BPEL process which will be exclusively triggered from a HTTP POST. The Client Partner Link in the BPEL process models Oracle's Transparent PunchOut standard. This standard is strict XML-over-HTTP, SOAP is not involved.
    However, I am getting issues when I POST the XML to BPEL. It is telling me that it requires a SOAPAction in the header. Again, the design dictates that this is raw XML over HTTP, so we are not to use any SOAP specific header values nor any kind of SOAP wrapper.
    I deployed the sample 'HTTPPostService' process which was delivered with BPEL. I am seeing the same error when I try to POST XML to this process as well. I get a response (in a SOAP wrapper) saying that it wants a SOAPAction in the header. The WSDL used to create this sample process clearly does not bind to SOAP, (there are no mentions of the SOAPAction in the operation, etc) so I do not understand.
    So, my question is: Is is possible to POST raw XML to a BPEL process? Or does BPEL require all processes to follow the SOAP 'protocol' ?
    Thanks for any help.
    Message was edited by:
    [email protected]

    I am also trying to do the same stuff. If i deploy the sample application HttpGetService, will i be able to send the request from browser the way we send typical http get request?
    here is the url which i want to use to invoke Http get BPEL
    http://cybage1:9700/httpbinding/default/HTTPGetService?ssn=10&id=20
    but i am getting following exception
    500 Internal Server Error
    java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
         at java.util.ArrayList.RangeCheck(ArrayList.java:507)
         at java.util.ArrayList.get(ArrayList.java:324)
         at com.collaxa.cube.ws.http.HttpBindingServlet.call(HttpBindingServlet.java:113)
         at com.collaxa.cube.ws.http.HttpBindingServlet.doGet(HttpBindingServlet.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:798)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:278)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:120)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)

  • XML over HTTP out of the EJB container

    I need to communicate with a legacy system via XML over HTTP from the EJB layer. I created a custom solution for this on a previous assignment using Castor for the marshaling etc. and standard JDK classes for the opening the HTTP connection, posting etc. I am thinking of implementing a similar solution in the using the DAO pattern. Are there any new open-source implementations for such XML/HTTP connectivity (non-SOAP)? Surely there is somethign out there!
    Thanks,
    -Chris

    In general, it is bad design to make network calls from the EJB layer, just as it is against the spec to do things such as create threads, write to the file system, etc.
    I know this doesn't answer your question but it is something to consider.

  • Designing services for xml over http client requests

    Hi
    I am new to WebServices and Weblogic Integration. I have been using it for only over a month. I have a very basic design issue.
    We have to provide a service that
    1. accepts xml over http requests
    2. Returns a request ack
    3. Process Form a response -This activity consumes time so it will be made asynchronous
    4. Send the response as xml over http
    5. Wait for response ack
    6. Get another type of request from client, the processign of which depends on the result of the previous request .. and so on..
    The problem here is that Webservices accepts only SOAP messages but our client will send raw xml messages. Also we need to remember the condition of the previous state.
    I dont know if my assumption that SOAP is used is right.
    Please tell me how to design a raw xml based system without using SOAP messages.
    Thanks
    nithya

    I don't see nothing wrong with your code, there must be something else happening.
    You sure you are not being some proxy server?? but even then you are making a post request so it shouldn't be happening.
    MeTitus

  • Client call using   XML over Http using HttpClient

    Using HTTPClient while calling HTTPPost method to generate request for external system using XML over http using below code
    client.getState().setCredentials(new AuthScope(ipAddress,portNumber),new UsernamePasswordCredentials(username, password));
         PostMethod method = new PostMethod(url);
         String str = accDoc.toString();
    method.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(str.getBytes())));
    method.setDoAuthentication( true );                
    int result = client.executeMethod(method);
    server system getting 2 request. first request without basic authentcation details and second request with full auhentication details.
    So unnecessary eatra call without authentication details is going during calling the client program using above code.
    Please let me know which part of the above code is generationg extra call.
    Thanks in advance for your help

    I don't see nothing wrong with your code, there must be something else happening.
    You sure you are not being some proxy server?? but even then you are making a post request so it shouldn't be happening.
    MeTitus

  • Using Business Service that supports XML over HTTP in OSB

    Hi,
    I needed to integrate my system with another legacy system that supports communication only through XML over HTTP. I am just trying to understand much about this XML over HTTP. I think in OSB, this is possible only possible through REST interfaces.
    Is there any other way and what about HTTP bindings in WSDLs? can you please let me know if you have any insights.
    I have gone through the urls about REST interfaces given in these forums. But just wanted to confirm the following scenaiors possible in OSB.
    - Client will connect to SOAP based proxy service which will in turn call REST based business service.
    - Client will connect to REST base proxy service which will in turn call SOAP based business service.
    Following point is not clear from the URLs i went through so just wanted to confirm the following too:
    - Client will connect to REST base proxy service which will in turn call SOAP based business service. And is it possible to add anything in soap header before calling soap based business service..
    Thanks & Regards
    Siva

    Hi Siva,
    XML over HTTP is a general use case and OSB supports it very well. REST is a special case and should be used when required. To know more about REST you may refer -
    http://www.infoq.com/articles/rest-introduction
    Now coming to OSB, SOAP and simple XML are two different cases. If you are creating XML type service then it is not binded to a WSDL/XSD but SOAP based service should always be binded with a WSDL. You may add/modify transport headers in OSB.
    Evaluate your requirements and then decide what exactly you need to use. Few links which may be of your use -
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/configuringandusingservices.html#wp1150438
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/configuringandusingservices.html#wp1154255
    http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/configuringandusingservices.html#wp1141071
    section "Configuring Business Services using the HTTP Transport" here - http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/httppollertransport/transports.html#wp1083292
    http://blogs.oracle.com/jeffdavies/2009/06/restful_services_with_oracle_s_1.html
    http://blogs.oracle.com/jamesbayer/2008/07/using_rest_with_oracle_service.html
    Regards,
    Anuj

  • Basic Question: plain XML over HTTP

    I would be getting messages in plain XML over HTTP. What should I use to receive those messages. Server is not SOAP based, so client cannot be SOAP based. Should I use JAX-RPC, but when I looked at the documentation, it is giving info regarding SOAP and plain xml over http. Can anyone help me?
    Thanks

    From my understanding, you would be getting a plain xml string by connecting to a server over http.
    You can is DOM or SAX apis to parse this xml input stream.
    For eg: if you are using DOM apis, then you can pass the input stream of the HttpURLConnection as follow...
         DocumentBuilderFactory buildFactory = DocumentBuilderFactory.newInstance();
         buildFactory.setIgnoringElementContentWhitespace(false);
         buildFactory.setValidating(false);
         DocumentBuilder docBuilder = buildFactory.newDocumentBuilder();
         URL url=new URL("http://someserver.com/abc.jsp");
         HttpURLConnection conn= (HttpURLConnection)url.openConnection();
         InputStream in= conn.getInputStream();
         Document doc = docBuilder.parse(in);
         ..Hope this helps...

  • Any good XML over HTTP examples?

    Hi,
    Does anyone know of a good example of using a XML over HTTP web service? Especially one that would be easily graspable by someone who's new to web services (read: me)?
    Is there a way to generate stub classes from a WSDL? I tried to do it in NetBeans but it didn't work, maybe NetBeans expects SOAP web services?
    Thanks

    Hi,
    This use case seems to be best handled using a RESTful Web Service. Check the Restlet project for a supporting framework:
    http://www.restlet.org/documentation/1.0/tutorial
    Best regards,
    Jerome
    http://www.restlet.org

  • Can we send  XML  over HTTPS ?

    Can we send XML over HTTPS ?

    malcolmmc wrote:
    meacod wrote:
    rabbits?
    Rabbits
    http://www.rabbitmq.com/
    They wrote
    +RabbitMQ is designed from the ground up to interoperate with other messaging systems: it is the leading implementation of AMQP, the open standard for business messaging, and, through adapters, supports XMPP, SMTP, STOMP and HTTP for lightweight web messaging.+
    They mentioned only HTTP ....Does HTTPS implied here ?

  • Query regarding encoding/decoding of XML over HTTP Post request

    Hello,
    I am working on a project where I need to put SMS inside XML and
    eventually transfer this XML via HTTP post from/to server/client.
    Assuming the SMS to be 7-bit text the XML may look something like
    <?xml+version="1.0"?>
    <SMS
    TESTMESSAGE
    </SMS>
    This XML when encoded in a HTML post may look something like
    http://<IP Address>:<port>/
    POST /MessageReceiver.jsp HTTP/1.0
    Host: www.SomeHost.net
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 90
    xmlMsg=%3C%3Fxml+version%3D%221.0%22%3F%3E%0D%0A%3CSMS%0D%0A%09TESTMESSAGE0D%0A%3C%2FSMS%3E
    This xml is UTF-8 (7-bit ASCII) by default since no encoding format has been specified.
    My question - how will the encoding of xml change to - when 8 bit binary data
    is transferred via xml.
    for e.g.
    <?xml+version="1.0"?>
    <SMS
    <!!!!!BINARY DATA!!!!!>
    </SMS>
    for such a file how/what shld the encoding be set to.
    Further my spec-states the following.
    "The content of the XML must respect the encoding. Thus a SMS
    containing typically french characters must use ISO-8859-1 encoding"
    "This code needs to work with both UTF-8 and UTF-16 standards (ASCII and Unicode). Because of this the parsing code should work internally with UTF-16 and translate up/down to/from UTF-8 (ASCII) only when dealing with the basic HTTP."
    could anyone clarify this for me.

    The first thing you need to do is clear up some fundamental misconceptions about character encodings. UTF-8 is not the same thing as "7-bit ASCII", and UTF-16 is not the same as "Unicode". Anyway, you're making this a lot more difficult than it needs to be. Just use UTF-8 to encode and decode all messages; it can handle all the characters from any language you're likely to run into.

  • Query regarding sending XML over HTTP Post request

    Hello,
    I am trying to send XML data from a server to client via HTTP Post request
    And vice versa � receive the data by a client
    Assume that the xml data looks something like
    <?xml+version="1.0"?>
    So my post query will look like
    http://<IP Address>:<port>/
    POST /MessageReceiver.jsp HTTP/1.0
    Host: www.SomeHost.net
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 38
    %3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
    This information will be received by the client and converted back to xml data.
    My query is - is there some library/open-source stuff that
    does the process of transcoding the entity's non-ASCII characters
    at the server side
    and decoding the URL back to human-readable form at the client side?
    i.e. I need a simple mechanism to convert
    <?xml+version="1.0"?>
    to
    %3C%3Fxml%2Bversion%3D%221.0%22%3F%3E+
    at the server side, while sending data
    and do the opposite at the client side to get the xml back.
    Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?
    Or is there any other standard tool that checks for well-formed properties of xml?
    regards,
    Deepak.

    java.net.URLEncoder / URLDecoder?
    Also could some one confirm if JTidy is a right tool to check if the xml is well-formed?No, it's for parsing HTML. An XML parser is checking for well-formedness in any case.

  • XML over HTTP between client and server

    We are trying to pass XML between a client and servlet over HTTP.
              We used the code from the StockClient/StockServlet examples as a
              starting point but cannot get it to work. Basically we
              have a simple command line java client that is trying to access
              a VERY simple servlet. When the client tries to write data into
              the output stream associated with the connection I get:
              "Connection rejected: 'Login timed out after: '15000' ms....."
              I have read several postings that instruct me to raise the
              timeout limit, but as you can see, I surely don't need 15 seconds
              to write this data out! Is there something special I need to do?
              Does this have anything to do with known issue #10065
              (http://www.weblogic.com/docs51/release_notes/rn_knownprob51.html)
              I have followed all of the instructions in the example code
              (http://www.weblogic.com/docs51/classdocs/xml.html)...
              Any assistance is appreciated...
              here is the client code:
              import java.io.*;
              import java.net.*;
              public class TestClient
              public static void main(String aa[])
              URL url = null;
              HttpURLConnection urlc = null;
              PrintWriter pw = null;
              file://Commented lines indicate other things I have tried
              try
              url = new URL("http://localhost:7001/ParserServlet");
              file://urlc = url.openConnection();
              urlc = (HttpURLConnection)url.openConnection();
              file://urlc.setRequestProperty("Content-Type", "text/xml");
              urlc.setDoOutput(true);
              urlc.setDoInput(true);
              file://urlc.connect();
              pw = new PrintWriter(new OutputStreamWriter
              (urlc.getOutputStream()), true);
              pw.println("<?xml version='1.0'?><test>testing123</test>");
              pw.flush();
              file://urlc.disconnect();
              } catch(IOException ex) {
              System.out.println(ex.getMessage());
              Here is the servlet code:
              import javax.servlet.*;
              import javax.servlet.http.*;
              import java.io.*;
              import java.net.*;
              public class TestServlet extends HttpServlet
              public synchronized void init(ServletConfig config) throws
              ServletException
              super.init(config);
              System.out.println("Inside init()");
              public final void doPost(HttpServletRequest request, HttpServletResponse
              response)
              throws ServletException, IOException
              System.out.println("Inside doPost()");
              protected void doGet(HttpServletRequest req,
              HttpServletResponse resp)
              throws ServletException,
              java.io.IOException
              System.out.println("Inside doGet()");
              

              Jon,
              One thing is missed in your client code. When you use HTTP POST to send request,
              you have two ways to tell the Web server when to stop reading from your input and
              to start process your input: the first one is using "Content-Lenght" header property
              to specify how many bytes you want to send to your servlet, the seocnd is use "Transfer-Code:
              Chunked" and is much more complicated. I didn't see you pass "Content-Length" in
              your client code, in which case, the Web server (Weblogic) cannot know the end of
              your request data and could keep waiting for last byte to come out or waiting for
              the socket time out (that is what you get).
              Since you use servlet, not JSP, I would recommend to code in this way (it works fine
              for me, no guranttee for your situation):
              Client code: Use a big temprary string, or StringBuffer, or StringWriter to store
              all the request data (your xml file content) before you send out the request. After
              you finish to form your XML string, calculate the number of bytes (should equal to
              the length of the string) and add the request header as
              urlc.setRequestProperty("Content-Length", bytes_length);
              I will not suggest you using PrintWriter. Think use BufferedOutputStream constructed
              from URLConnection and write the bytes (use String.getBytes()) to the servlet and
              then flush.
              Servlet code: in the doPost() of your servlet, try to find the request data length
              by calling request.getContentLength(), then open the InputStream (think to use BufferedInputStream
              for performance). Read the contents from the InputStream byte by byte and counter
              the number of bytes. Once you get the number of bytes as specified via request Content-Length,
              break your reading loop and start whatever you want.
              Hope it helps.
              "Jon Clark" <[email protected]> wrote:
              >We are trying to pass XML between a client and servlet over HTTP.
              >We used the code from the StockClient/StockServlet examples as a
              >starting point but cannot get it to work. Basically we
              >have a simple command line java client that is trying to access
              >a VERY simple servlet. When the client tries to write data into
              >the output stream associated with the connection I get:
              >"Connection rejected: 'Login timed out after: '15000' ms....."
              >I have read several postings that instruct me to raise the
              >timeout limit, but as you can see, I surely don't need 15 seconds
              >to write this data out! Is there something special I need to do?
              >Does this have anything to do with known issue #10065
              >(http://www.weblogic.com/docs51/release_notes/rn_knownprob51.html)
              >I have followed all of the instructions in the example code
              >(http://www.weblogic.com/docs51/classdocs/xml.html)...
              >
              >Any assistance is appreciated...
              >
              >here is the client code:
              >import java.io.*;
              >import java.net.*;
              >
              >public class TestClient
              >{
              > public static void main(String aa[])
              > {
              > URL url = null;
              > HttpURLConnection urlc = null;
              > PrintWriter pw = null;
              >
              > file://Commented lines indicate other things I have tried
              > try
              > {
              > url = new URL("http://localhost:7001/ParserServlet");
              > file://urlc = url.openConnection();
              > urlc = (HttpURLConnection)url.openConnection();
              > file://urlc.setRequestProperty("Content-Type", "text/xml");
              > urlc.setDoOutput(true);
              > urlc.setDoInput(true);
              > file://urlc.connect();
              > pw = new PrintWriter(new OutputStreamWriter
              > (urlc.getOutputStream()), true);
              > pw.println("<?xml version='1.0'?><test>testing123</test>");
              > pw.flush();
              > file://urlc.disconnect();
              > } catch(IOException ex) {
              > System.out.println(ex.getMessage());
              > }
              > }
              >}
              >
              >
              >
              >Here is the servlet code:
              >
              >import javax.servlet.*;
              >import javax.servlet.http.*;
              >import java.io.*;
              >import java.net.*;
              >
              >public class TestServlet extends HttpServlet
              >{
              > public synchronized void init(ServletConfig config) throws
              >ServletException
              >
              >
              > super.init(config);
              > System.out.println("Inside init()");
              > }
              >
              > public final void doPost(HttpServletRequest request, HttpServletResponse
              >response)
              > throws ServletException, IOException
              > {
              > System.out.println("Inside doPost()");
              > }
              >
              > protected void doGet(HttpServletRequest req,
              > HttpServletResponse resp)
              > throws ServletException,
              > java.io.IOException
              > {
              > System.out.println("Inside doGet()");
              > }
              >}
              >
              >
              >
              >
              

Maybe you are looking for