Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9143527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:02:44+00:00 2026-06-17T10:02:44+00:00

I have developed manually a soap connection via Java sockets (it was a very

  • 0

I have developed manually a soap connection via Java sockets (it was a very simple soap request and Axis was giving lots of build problem).

To achieve this, I basically copied the HTTP header I was getting out of Soap UI when , and coded the follwing:

String hostname = "aaaaa";
int port = 11111;
InetAddress  addr = InetAddress.getByName(hostname);
Socket sock = new Socket(addr, port);
sock.setSoTimeout(100000);
BufferedWriter  wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(),"UTF-8"));
wr.write("POST " + "http://aaaa:11111/servicePath" + " HTTP/1.1\r\n");
wr.write("Host: aaaaa:11111\r\n");
wr.write("Accept-Encoding: gzip,deflate\r\n");
wr.write("Content-Length: " + soapXml.length() + "\r\n");
wr.write("Content-Type: text/xml; charset=\"UTF-8\"\r\n");
//wr.write("Connection: Keep-Alive\r\n");
wr.write("SOAPAction: \"/someSoapAction\"\r\n");
wr.write("User-Agent: Apache-HttpClient/4.1.1 (java 1.5)\r\n");
wr.write("\r\n");
wr.write(soapXml);
wr.flush();

The requests are successful, meaning I get from the service the responses I expect.
For instance, when I put in my hand written “soapXml” some invalid parameters, I get a 500 error back with XML explaining the problem, If I set everything correctly I get a 200 OK with an xml body following the header.

The problem is that the socket hangs 60 seconds before reading the HTTP body in case of a 200OK.

It basically reads the full header, then waits 60 seconds, then (I think some protocol times out and) finally reads the xml body.

Here’s the code with which I read the response:

String line;
BufferedReader rd = new BufferedReader(new java.io.InputStreamReader(sock.getInputStream(),"UTF-8"));
while ((line = rd.readLine()) != null) { 
            i++;
            LOG.debug("cycle: "+i+" -------- "+line);
                     //after printing the header, it hangs 60 seconds before printing the follwing XML  
            if ((line.length() >0) && (line.charAt(0) == '<'))
            {
                responseXML = line;
            }
}

Here is a sample 200 OK header:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Content-Length: 1052
Date: Sun, 13 Jan 2013 08:33:45 GMT -- hanging 60 seconds here
-- blank line
<?xml version="1.0" encoding="UTF-8"?>................</SOAP-ENV:Envelope>

Has anybody ever faced this? Please note this is not a server problem apparently, since with soap UI the answer is immediately provided.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:02:45+00:00Added an answer on June 17, 2026 at 10:02 am

    The server environment change (a new machine was provided) solved the issue.

    Now response time is below 1 sec also for 200OK.

    Unluckily I don’t have any details regarding the tech stack of the envrionment. Anyways thanks for help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a Java server using Eclipse that accepts TCP socket connection from
I have developed a Java Swing application, and it will be installed on multiple
How do I get current date details in java? I have developed a class:
We have a Java EE 5 project developed using Netbeans 6.7.1 with Glassfish v2.1.
I have developed a download/upload manager script. When I upload a file via POST
I developed an android app. Its manifest is very simple and copied below. <?xml
I have developed sample api as jar file. This jar file contains the code
I have developed a web site that requires user registration and authentication for some
I have developed a website using Razor (Microsoft WebMatrix) and now I want to
I have developed a small administration page for game servers which you can add/remove/edit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.