title: Why am I receiving a java.net.SocketException: Connection reset error from web service through SOAP UI and Java client?
body: <p>I am converting a visual foxpro application to a java web application and one small, but important piece of the application makes a soap request to a web service. </p>
  
  <p>I have written 3 test clients to call this web service, and I have also tested through SOAP UI.  Every one of my tests to this web service returns the error: java.net.SocketException: Connection reset.  So I am obviously missing the same thing in every method of test, or doing the same thing wrong.  </p>
  
  <p>I have the foxpro code, and I have successfully submitted the request via foxpro and received a valid response.  But I don't have any experience with Foxpro, so I have been struggling with the difference between the code in foxpro that works and the new code I'm writing in java.  </p>
  
  <p>I am hoping that someone with more experience with Soap and web services can see my code, maybe try it themselves, and help me understand what the problem is.</p>
  
  <p>I will provide the web service url as well as all my code.  I will also provide the foxpro command line code that works.  </p>
  
  <p>The foxpro code uses <code>CreateObject("Microsoft.XMLHTTP")</code>.  I have learned through my research that this is also used in ASP, VB.net and C#.  </p>
  
  <p>1) Here is the web service that I need to call:</p>
  
  <p>Host: <code>https://rlisapi.myfwc.com/</code></p>
  
  <p>Soap Endpoint: <code>https://rlisapi.myfwc.com/wsReceipts.asmx</code></p>
  
  <p>WSDL: <code>https://rlisapi.myfwc.com/wsReceipts.asmx?WSDL</code></p>
  
  <p>This web service doesn't contain ws-security.  The credentials are in the request itself.  I can't provide those, of course, but I don't believe they are needed to help me solve the connection reset problem.</p>
  
  <p>2) First client I created used SAAJ API.  Here is my code:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.net.InetAddress;
  import java.net.Socket;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.xml.soap.MessageFactory;
  import javax.xml.soap.Name;
  import javax.xml.soap.SOAPBody;
  import javax.xml.soap.SOAPBodyElement;
  import javax.xml.soap.SOAPConnection;
  import javax.xml.soap.SOAPConnectionFactory;
  import javax.xml.soap.SOAPElement;
  import javax.xml.soap.SOAPEnvelope;
  import javax.xml.soap.SOAPException;
  import javax.xml.soap.SOAPMessage;
  import javax.xml.soap.SOAPPart;
  import javax.xml.transform.Source;
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerException;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.stream.StreamResult;
  
  import org.apache.log4j.Logger;
  
  import com.mycompany.webapp.domain.transaction.BusinessEntityTransaction;
  import com.mycompany.webapp.domain.transaction.ccars.PaymentCart;
  import com.mycompany.webapp.domain.transaction.rlis.RlisTransaction;
  
  public class RlisService {
      private static Logger logger = Logger.getLogger("com.companyxyz.webapp.service.transaction.RlisService");   
  
      public List&lt;BusinessEntityTransaction&gt; getCurrentTransactions(PaymentCart paymentCart) {
          List&lt;BusinessEntityTransaction&gt; transactionList = new ArrayList&lt;BusinessEntityTransaction&gt;();
          List&lt;RlisTransaction&gt; rlisList = new ArrayList&lt;RlisTransaction&gt;();
          try {
              logger.info("Adding current transactions from RLIS system...");
              rlisList = this.getCurrentTransactionsViaSoapRequest();
  
              for (RlisTransaction tx : rlisList){
                  //add transaction received from web service to transactionList
              }
  
          } catch (UnsupportedOperationException e) {
              e.printStackTrace();
          } catch (SOAPException e) {
              e.printStackTrace();
          }
          // do something with the rlisList - the list of RlisTransactions
          return transactionList;
      }
  
      private List&lt;RlisTransaction&gt; getCurrentTransactionsViaSoapRequest() 
              throws UnsupportedOperationException, SOAPException {
          List&lt;RlisTransaction&gt; rlisTransactions = new ArrayList&lt;RlisTransaction&gt;();
          // Create SOAP Connection
          try {
              SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
              SOAPConnection soapConnection = soapConnectionFactory.createConnection();
  
              // Send SOAP Message to SOAP Server
              String url = "https://rlisapi.myfwc.com/wsReceipts.asmx";
              SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);
  
              // Process the SOAP Response
  
              printSOAPResponse(soapResponse);
  
              soapConnection.close();
          } catch (TransformerException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          return rlisTransactions;
      }
  
  
      private static SOAPMessage createSOAPRequest() throws SOAPException, IOException {
          MessageFactory messageFactory = MessageFactory.newInstance();
          SOAPMessage soapMessage = messageFactory.createMessage();
          SOAPPart soapPart = soapMessage.getSOAPPart();
  
          //String serverURI = "http://rlisapi.outdoorlicensesolution.com/";
  
          // SOAP Envelope
          SOAPEnvelope envelope = soapPart.getEnvelope();
          //envelope.addNamespaceDeclaration("http://api.outdoorlicensesolution.com/RLIS/", serverURI);
  
          // SOAP Body
          SOAPBody soapBody = envelope.getBody();
          Name bodyName = envelope.createName("getDailyReceipts", "rlis", "http://api.outdoorlicensesolution.com/RLIS/");
          SOAPBodyElement getDailyReceiptsElement = soapBody.addBodyElement(bodyName); 
  
       //Name contentLenghName = envelope.createName("Content-Length");
          Name consumerPinName = envelope.createName("ConsumerPIN");
          Name agentIdName = envelope.createName("AgentID");
          Name receiptDateName = envelope.createName("ReceiptDate");
  
          //SOAPElement contentLengthElement = getDailyReceiptsElement.addChildElement(contentLenghName);        
          //contentLengthElement.addTextNode("494");
  
          SOAPElement consumerPinElement = getDailyReceiptsElement.addChildElement(consumerPinName);
          consumerPinElement.addTextNode("my-consumer-pin");
  
          SOAPElement agentIdElement = getDailyReceiptsElement.addChildElement(agentIdName);
          agentIdElement.addTextNode("000"); //not a real agent id
  
          SOAPElement receiptDateElement = getDailyReceiptsElement.addChildElement(receiptDateName);
          receiptDateElement.addTextNode("2013-07-01T00:00:00");
  
  
  
  /*
  //this is the soap request string from foxpro:
  &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"&gt;
  &lt;soap:Body&gt;
  &lt;getDailyReceipts xmlns="http://api.outdoorlicensesolution.com/RLIS/"&gt;
  &lt;Content-Length&gt;494&lt;/Content-Length&gt;
  &lt;ConsumerPIN&gt;APIKEY&lt;/ConsumerPIN&gt;
  &lt;AgentID&gt;AGENTID&lt;/AgentID&gt;
  &lt;ReceiptDate&gt;SALEDATE&lt;/ReceiptDate&gt; 
  &lt;/getDailyReceipts&gt; 
  &lt;/soap:Body&gt; 
  &lt;/soap:Envelope&gt; 
  
   */
          soapMessage.saveChanges();
  
          /* Print the request message */
          System.out.print("Request SOAP Message = ");
          soapMessage.writeTo(System.out);
          System.out.println();
  
          return soapMessage; 
      }
  
      private static void printSOAPResponse(SOAPMessage soapResponse) throws TransformerException, SOAPException {
          logger.debug(soapResponse.getSOAPBody());
          TransformerFactory transformerFactory = TransformerFactory.newInstance();
          Transformer transformer = transformerFactory.newTransformer();
          Source sourceContent = soapResponse.getSOAPPart().getContent();
          logger.debug("\nResponse SOAP Message = ");
          System.out.print("\nResponse SOAP Message = ");
          StreamResult result = new StreamResult(System.out);
          transformer.transform(sourceContent, result);
  
      }
  
  }
  </code></pre>
  
  <p>(3) The next version of my client uses Socket and OutputStreamWriter</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.net.InetAddress;
  import java.net.Socket;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.xml.soap.MessageFactory;
  import javax.xml.soap.Name;
  import javax.xml.soap.SOAPBody;
  import javax.xml.soap.SOAPBodyElement;
  import javax.xml.soap.SOAPConnection;
  import javax.xml.soap.SOAPConnectionFactory;
  import javax.xml.soap.SOAPElement;
  import javax.xml.soap.SOAPEnvelope;
  import javax.xml.soap.SOAPException;
  import javax.xml.soap.SOAPMessage;
  import javax.xml.soap.SOAPPart;
  import javax.xml.transform.Source;
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerException;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.stream.StreamResult;
  
  import org.apache.log4j.Logger;
  
  import com.mycompany.webapp.domain.transaction.BusinessEntityTransaction;
  import com.mycompany.webapp.domain.transaction.ccars.PaymentCart;
  import com.mycompany.webapp.domain.transaction.rlis.RlisTransaction;
  
  public class RlisService {
      private static Logger logger = Logger.getLogger("com.companyxyz.webapp.service.transaction.RlisService");   
  
      public List&lt;BusinessEntityTransaction&gt; getCurrentTransactions(PaymentCart paymentCart) {
          List&lt;BusinessEntityTransaction&gt; transactionList = new ArrayList&lt;BusinessEntityTransaction&gt;();
          List&lt;RlisTransaction&gt; rlisList = new ArrayList&lt;RlisTransaction&gt;();
          try {
              logger.info("Adding current transactions from RLIS system...");
              rlisList = this.getCurrentTransactionsViaXmlHttp();         
              for (RlisTransaction tx : rlisList){
                  //add transaction received from web service to transactionList
              }
  
          } catch (UnsupportedOperationException e) {
              e.printStackTrace();
          }
          // do something with the rlisList 
          return transactionList;
      }
  
      private List&lt;RlisTransaction&gt; getCurrentTransactionsViaXmlHttp(){
          List&lt;RlisTransaction&gt; rlisTransactions = new ArrayList&lt;RlisTransaction&gt;();
  
          String xmldata = "&lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
          "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
          "xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\"&gt;" +
          "&lt;soap:Body&gt;" +
          "&lt;getDailyReceipts xmlns=\"http://api.outdoorlicensesolution.com/RLIS/\"&gt;" +
          //"&lt;Content-Length&gt;494&lt;/Content-Length&gt;" +
          "&lt;ConsumerPIN&gt;APIKEY&lt;/ConsumerPIN&gt;" +
          "&lt;AgentID&gt;AGENTID&lt;/AgentID&gt;" +
          "&lt;ReceiptDate&gt;SALEDATE&lt;/ReceiptDate&gt;" +
          "&lt;/getDailyReceipts&gt;" +
          "&lt;/soap:Body&gt;" +
          "&lt;/soap:Envelope&gt;";
  
          try{
  
            //Create socket
            String hostname = "rlisapi.myfwc.com";
            int port = 443;
            InetAddress  addr = InetAddress.getByName(hostname);
            Socket sock = new Socket(addr, port);
            //Socket sock = new Socket(hostname, port);
  
            //Send header
            String path = "https://rlisapi.myfwc.com/wsReceipts.asmx";
            BufferedWriter  wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(),"UTF-8"));
            // You can use "UTF8" for compatibility with the Microsoft virtual machine.
            wr.write("POST " + path + " HTTP/1.0\r\n");
            wr.write("Host: rlisapi.myfwc.com\r\n");
            wr.write("Content-Length: " + xmldata.length() + "\r\n");
            wr.write("Content-Type: text/xml; charset=\"utf-8\"\r\n");
            wr.write("\r\n");
  
            //Send data
            wr.write(xmldata);
            wr.flush();
  
            // Response
            BufferedReader rd = new BufferedReader(new InputStreamReader(sock.getInputStream()));
            String line;
            while((line = rd.readLine()) != null)
            System.out.println(line);
  
          } catch (Exception e) {
                e.printStackTrace();
          }
  
          return rlisTransactions;
      }
  
  }
  </code></pre>
  
  <p>(4) I have a similar test client that uses HttpUrlConnection</p>
  
  <pre><code>import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStreamWriter;
  import java.net.HttpURLConnection;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLConnection;
  
  public class TestXmlClient {
  
      public static void main(String[] args) {
          String argUrl = "https://rlisapi.myfwc.com/wsReceipts.asmx";
  
          System.out.println("Test XML Client");
  
          String requestXml = 
                  "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;" +
                  "&lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
                  "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
                  "xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\"&gt;" +
                  "&lt;soap:Body&gt;" +
                  "&lt;getDailyReceipts xmlns=\"http://api.outdoorlicensesolution.com/RLIS/\"&gt;" +
                  "&lt;Content-Length&gt;494&lt;/Content-Length&gt;" +
                  "&lt;ConsumerPIN&gt;my-consumer-pin&lt;/ConsumerPIN&gt;" +
                  "&lt;AgentID&gt;000&lt;/AgentID&gt;" +  //not real agent id
                  "&lt;ReceiptDate&gt;2013-07-01T00:00:00&lt;/ReceiptDate&gt;" +
                  "&lt;/getDailyReceipts&gt;" +
                  "&lt;/soap:Body&gt;" +
                  "&lt;/soap:Envelope&gt;" ;
  
          System.out.println("Request: " + requestXml);
  
          //try {
          URL url;
          OutputStreamWriter writer = null;
          InputStreamReader reader = null;
          HttpURLConnection con = null;
  
          try {
              url = new URL (argUrl);
          con = (HttpURLConnection) url.openConnection();
  
          URLConnection urlc = url.openConnection();
          HttpURLConnection httpc = (HttpURLConnection)urlc;
          // only interested in the length of the resource
          httpc.setRequestMethod("HEAD");
          int len = httpc.getContentLength();
  
          System.out.println("length: " + len);
  
          // specify that we will send output and accept input
          con.setDoInput(true);
          con.setDoOutput(true);
  
          con.setConnectTimeout( 20000 );  // long timeout, but not infinite
          con.setReadTimeout( 20000 );
  
          con.setUseCaches (false);
          con.setDefaultUseCaches (false);
  
          // tell the web server what we are sending
          //con.setRequestProperty ( "Content-Type", "text/xml" );
          con.setRequestProperty ( "Content-Type", "text/xml; charset=utf-8" );
          //con.setRequestProperty("Connection", "close"); 
  
          writer = new OutputStreamWriter( con.getOutputStream() );
  
          writer.write(requestXml);
          writer.flush();
          writer.close();
  
          // reading the response
          reader = new InputStreamReader( con.getInputStream() );
          StringBuilder buf = new StringBuilder();
          char[] cbuf = new char[ 2048 ];
          int num;
          while ( -1 != (num=reader.read( cbuf ))) {
              buf.append( cbuf, 0, num );
          }
          String result = buf.toString();
          System.err.println( "\nResponse from server after POST:\n" + result );
  
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              System.out.println(e.getStackTrace());
              e.printStackTrace();
          } catch (Exception e){
              e.printStackTrace();
          } finally{
              if (writer != null) { 
                  try { 
                      writer.close(); 
                  } catch (Exception e) { 
                      // ignore... 
                  } 
              }
              if (reader != null) { 
                  try { 
                      reader.close(); 
                  } catch (Exception e) { 
                      // ignore... 
                  } 
              } 
  
              if (con != null) { 
                  try { 
                      con.disconnect(); 
                  } catch (Exception e) { 
                      // ignore... 
                  } 
  
              }   
          }
      }
  }
  </code></pre>
  
  <p>Finally, in addition to all these test clients, I also tried submitting various requests using SOAP UI.  Interestingly, I couldn't load the wsdl from the url so I saved the wsdl source code to a local file and used it.</p>
  
  <p>Here is the request generated by Soap UI from the wsdl file:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:rlis="http://api.outdoorlicensesolution.com/RLIS/"&gt;
     &lt;soap:Header/&gt;
     &lt;soap:Body&gt;
        &lt;rlis:getDailyReceipts&gt;
           &lt;!--Optional:--&gt;
           &lt;rlis:ConsumerPIN&gt;?&lt;/rlis:ConsumerPIN&gt;
           &lt;rlis:AgentID&gt;?&lt;/rlis:AgentID&gt;
           &lt;rlis:ReceiptDate&gt;?&lt;/rlis:ReceiptDate&gt;
        &lt;/rlis:getDailyReceipts&gt;
     &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>WSDL saved locally:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://api.outdoorlicensesolution.com/RLIS/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://api.outdoorlicensesolution.com/RLIS/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt;
    &lt;wsdl:types&gt;
      &lt;s:schema elementFormDefault="qualified" targetNamespace="http://api.outdoorlicensesolution.com/RLIS/"&gt;
        &lt;s:element name="getDailyReceipts"&gt;
          &lt;s:complexType&gt;
            &lt;s:sequence&gt;
              &lt;s:element minOccurs="0" maxOccurs="1" name="ConsumerPIN" type="s:string" /&gt;
              &lt;s:element minOccurs="1" maxOccurs="1" name="AgentID" type="s:int" /&gt;
              &lt;s:element minOccurs="1" maxOccurs="1" name="ReceiptDate" type="s:dateTime" /&gt;
            &lt;/s:sequence&gt;
          &lt;/s:complexType&gt;
        &lt;/s:element&gt;
        &lt;s:element name="getDailyReceiptsResponse"&gt;
          &lt;s:complexType&gt;
            &lt;s:sequence&gt;
              &lt;s:element minOccurs="0" maxOccurs="1" name="getDailyReceiptsResult" type="tns:ArrayOfReceipt" /&gt;
            &lt;/s:sequence&gt;
          &lt;/s:complexType&gt;
        &lt;/s:element&gt;
        &lt;s:complexType name="ArrayOfReceipt"&gt;
          &lt;s:sequence&gt;
            &lt;s:element minOccurs="0" maxOccurs="unbounded" name="Receipt" nillable="true" type="tns:Receipt" /&gt;
          &lt;/s:sequence&gt;
        &lt;/s:complexType&gt;
        &lt;s:complexType name="Receipt"&gt;
          &lt;s:sequence&gt;
            &lt;s:element minOccurs="1" maxOccurs="1" name="OrderID" type="s:int" /&gt;
            &lt;s:element minOccurs="1" maxOccurs="1" name="TotalSaleAmount" type="s:decimal" /&gt;
            &lt;s:element minOccurs="1" maxOccurs="1" name="TaxCollectorFees" type="s:decimal" /&gt;
            &lt;s:element minOccurs="1" maxOccurs="1" name="OrderDate" type="s:dateTime" /&gt;
            &lt;s:element minOccurs="0" maxOccurs="1" name="OrderStatus" type="s:string" /&gt;
            &lt;s:element minOccurs="1" maxOccurs="1" name="AmountToACH" type="s:decimal" /&gt;
            &lt;s:element minOccurs="1" maxOccurs="1" name="CustomerID" type="s:int" /&gt;
            &lt;s:element minOccurs="0" maxOccurs="1" name="CustomerName" type="s:string" /&gt;
            &lt;s:element minOccurs="0" maxOccurs="1" name="ClerkUserName" type="s:string" /&gt;
            &lt;s:element minOccurs="0" maxOccurs="1" name="TarponTagBegin" type="s:string" /&gt;
            &lt;s:element minOccurs="0" maxOccurs="1" name="TarponTagEnd" type="s:string" /&gt;
            &lt;s:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string" /&gt;
          &lt;/s:sequence&gt;
        &lt;/s:complexType&gt;
      &lt;/s:schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name="getDailyReceiptsSoapIn"&gt;
      &lt;wsdl:part name="parameters" element="tns:getDailyReceipts" /&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="getDailyReceiptsSoapOut"&gt;
      &lt;wsdl:part name="parameters" element="tns:getDailyReceiptsResponse" /&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:portType name="wsReceiptsSoap"&gt;
      &lt;wsdl:operation name="getDailyReceipts"&gt;
        &lt;wsdl:input message="tns:getDailyReceiptsSoapIn" /&gt;
        &lt;wsdl:output message="tns:getDailyReceiptsSoapOut" /&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:portType&gt;
    &lt;wsdl:binding name="wsReceiptsSoap" type="tns:wsReceiptsSoap"&gt;
      &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http" /&gt;
      &lt;wsdl:operation name="getDailyReceipts"&gt;
        &lt;soap:operation soapAction="http://api.outdoorlicensesolution.com/RLIS/getDailyReceipts" style="document" /&gt;
        &lt;wsdl:input&gt;
          &lt;soap:body use="literal" /&gt;
        &lt;/wsdl:input&gt;
        &lt;wsdl:output&gt;
          &lt;soap:body use="literal" /&gt;
        &lt;/wsdl:output&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:binding&gt;
    &lt;wsdl:binding name="wsReceiptsSoap12" type="tns:wsReceiptsSoap"&gt;
      &lt;soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /&gt;
      &lt;wsdl:operation name="getDailyReceipts"&gt;
        &lt;soap12:operation soapAction="http://api.outdoorlicensesolution.com/RLIS/getDailyReceipts" style="document" /&gt;
        &lt;wsdl:input&gt;
          &lt;soap12:body use="literal" /&gt;
        &lt;/wsdl:input&gt;
        &lt;wsdl:output&gt;
          &lt;soap12:body use="literal" /&gt;
        &lt;/wsdl:output&gt;
      &lt;/wsdl:operation&gt;
    &lt;/wsdl:binding&gt;
    &lt;wsdl:service name="wsReceipts"&gt;
      &lt;wsdl:port name="wsReceiptsSoap" binding="tns:wsReceiptsSoap"&gt;
        &lt;soap:address location="https://rlisapi.myfwc.com/wsReceipts.asmx" /&gt;
      &lt;/wsdl:port&gt;
      &lt;wsdl:port name="wsReceiptsSoap12" binding="tns:wsReceiptsSoap12"&gt;
        &lt;soap12:address location="https://rlisapi.myfwc.com/wsReceipts.asmx" /&gt;
      &lt;/wsdl:port&gt;
    &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>I will also provide you with the Foxpro code that works:</p>
  
  <pre><code>*******************************************
  SALEDATE = DATE()-1
  XMLRESPONSE = ''
  
  M.AGENTID = '000'
  M.APIKEY = 'my-consumer-pin'
  
  M.cSALEDATE = STR(YEAR(SALEDATE),4) + '-' + PADL(ALLTRIM(STR(MONTH(SALEDATE),2)),2,'0') + '-' + PADL(ALLTRIM(STR(DAY(SALEDATE),2)),2,'0') + 'T00:00:00'
  
  TEXT TO XMLHTTP NOSHOW
  &lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"&gt;
  &lt;soap:Body&gt;
  &lt;getDailyReceipts xmlns="http://api.outdoorlicensesolution.com/RLIS/"&gt;
  &lt;Content-Length&gt;494&lt;/Content-Length&gt;
  &lt;ConsumerPIN&gt;APIKEY&lt;/ConsumerPIN&gt;
  &lt;AgentID&gt;AGENTID&lt;/AgentID&gt;
  &lt;ReceiptDate&gt;SALEDATE&lt;/ReceiptDate&gt;
  &lt;/getDailyReceipts&gt;
  &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  ENDTEXT
  XMLHTTP = STRTRAN(XMLHTTP,'APIKEY',M.APIKEY)
  XMLHTTP = STRTRAN(XMLHTTP,'AGENTID',M.AGENTID)
  XMLHTTP = STRTRAN(XMLHTTP,'SALEDATE',M.cSALEDATE)
  
  
  
  oHTTP = CreateObject("Microsoft.XMLHTTP")
  oHTTP.Open("POST", "https://rlisapi.myfwc.com/wsReceipts.asmx", .F.)
  
  oHTTP.setRequestHeader('Content-Type', 'text/xml; charset=utf-8 ')
  oHTTP.Send(XMLHTTP)
  
  
  DO CASE
  CASE oHTTP.status = 200
                  XMLRESPONSE = oHTTP.ResponseText
                  RELEASE oHTTP
  CASE oHTTP.status = 201
                  WAIT'PROCESSING PLEASE WAIT' WINDOW NOWAIT
                  RELEASE oHTTP
  CASE oHTTP.status = 202
                  WAIT 'PROCESSING PLEASE WAIT' WINDOW NOWAIT
                  RELEASE oHTTP
  CASE oHTTP.status = 400
                  RELEASE oHTTP
                  MESSAGEBOX("RLIS BAD REQUEST ERROR",0,'CCARS')
                  RETURN
  CASE oHTTP.status = 401
                  RELEASE oHTTP
                  MESSAGEBOX("RLIS UNAUTHORIZED ERROR",0,'CCARS')
                  RETURN
  CASE oHTTP.status = 403
                  RELEASE oHTTP
                  MESSAGEBOX("RLIS FORBIDDEN ERROR",0,'CCARS')
                  RETURN
  CASE oHTTP.status = 404
                  RELEASE oHTTP
                  MESSAGEBOX("CONNECTION TO RLIS SITE NOT AVAILABLE",0,'CCARS')
                  RETURN
  CASE oHTTP.status = 500
                  RELEASE oHTTP
                  MESSAGEBOX("RLIS INTERNAL SERVER ERROR",0,'CCARS')
                  RETURN
  OTHERWISE
                  RELEASE oHTTP
                  MESSAGEBOX(oHTTP.status,0,'CCARS')
                  MESSAGEBOX("RLIS INTERNAL SERVER ERROR CODE " + STR(oHTTP.status,3,0),0,'CCARS')
                  RETURN
  ENDCASE
  
  MESSAGEBOX(XMLRESPONSE)
  </code></pre>
  
  <hr>
  
  <p>Here is the full stacktrace of the error:</p>
  
  <pre><code>java.net.SocketException: Connection reset
  at java.net.SocketInputStream.read(SocketInputStream.java:168)
  at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:422)
  at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:460)
  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:863)
  at       com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1215)
  at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1199)
  at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
  at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
  at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)
  at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
  at com.taxcollector.ccars.service.transaction.TestSoapClient.main(TestSoapClient.java:51)
  </code></pre>
  
  <p>From all my research over the last couple of days, what I've determined is that this error is most often caused by the server closing the connection prior the client being done reading it.  </p>
  
  <p>At first I thought there was something wrong with the web service itself, but since I'm able to run the foxpro command and get a valid response, that can't be the case.  </p>
  
  <p>I tried changing many of the preferences in Soap UI settings too, including the socket timeout.  </p>
  
  <p>Also, my requests do not go through a proxy server.</p>
  
  <p>Any suggestions or advice will be greatly appreciated!
  Thank you.</p>
  
  <hr>
  
  <p>UPDATED POST FOLLOWS</p>
  
  <hr>
  
  <p>Here is the capture from Wireshark, simple ACKs omitted.</p>
  
  <pre><code>4034    2013-07-05 10:34:04.556901000   192.168.0.106   162.209.25.202  SSLv2   178 Client Hello
  4038    2013-07-05 10:34:04.669714000   162.209.25.202  192.168.0.106   SSLv3   1386    Server Hello, Certificate, Server Hello Done
  4040    2013-07-05 10:34:04.880678000   192.168.0.106   162.209.25.202  SSLv3   331 Client Key Exchange
  4041    2013-07-05 10:34:04.885161000   192.168.0.106   162.209.25.202  SSLv3   72  Change Cipher Spec
  4042    2013-07-05 10:34:04.887886000   192.168.0.106   162.209.25.202  SSLv3   127 Encrypted Handshake Message
  4045    2013-07-05 10:34:05.142999000   162.209.25.202  192.168.0.106   TCP 54  https &gt; 58365 [RST, ACK] Seq=2769 Ack=445 Win=4584 Len=0
  </code></pre>
  
  <p>Then the series of messages repeats.</p>
  
  <p>So I think what this is showing is that there was first a connection request made from the client ,which was acknowledged by the server.
  Then there was a Client Hello, a Server Hello, Handshake Protocol Certificate, Server Hello Done, Client Key Exchange, Change Cipher Spec, Encrypted Handshake Message and then finally the Connection Reset (RST) from the server.</p>
  
  <p>I looked up what the Expert Info on the last frame means, and it looks like it could mean protocol sequence suspicious, e.g. sequence wasn't continuous or a retransmission was detected...</p>
  
  <p>This still has me scratching my head!  I don't understand what I may be doing in my code, or from Soap UI that could cause this connection reset from the server.  And why it doesn't happen from the Microsoft.XMLHTTP post in foxpro code...  Could it be that my request is getting sent as fragments and the server won't accept that?  </p>
  
  <p>I think I am going to try to run a wireshark capture while running the foxpro command, but that is on a PC with Windows 8, so I need to first figure out how to run it under admin.  The java test client I'm running that gets a connection reset is on my mac.</p>
  
  <p>In the meantime, does anyone have any further insight?</p>