com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I need help, I'm having the above error while consuming a SOAP service using Java application but my SOAPUI was able to consume it.
I have generated the JKS token and extract the public certificate and import it into the JKS file and am sure the error is not coming from that angel.



public class TestSample {

public static void main(String args) {
List<TransactionExport> transactionExports = null;
TransactionExportTransactionType type = TransactionExportTransactionType.NEW;

try {
transactionExports = getTransactionExportTransactions(type.NEW, "adey20939", "hatteiir6434b");
} catch (Exception e) {
e.printStackTrace();
}
}

private static List<TransactionExport> getTransactionExportTransactions(TransactionExportTransactionType type, String companyUserName, String companyPassword) throws WebServiceException, WebServiceValidationException {
SimpleTransactionExportService service = new SimpleTransactionExportService();
SimpleTransactionExportServiceDelegate port = service.getSimpleTransactionExportServicePort();
((BindingProvider) port).getRequestContext().put("com.sun.xml.ws.transport.https.client.SSLSocketFactory", getSocketFactory());
return port.getTransactionExportTransactions(type, companyUserName, HashPassword.makeSHA1Hash(companyPassword));// this is the error point
}

public static SocketFactory getSocketFactory() {
char cert_password = "qweeqtyye".toCharArray();
System.setProperty("javax.net.debug", "ssl");
System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");

TrustManager trustAllCerts = new TrustManager{
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate xcs, String string) throws CertificateException {
//
}

@Override
public void checkServerTrusted(X509Certificate xcs, String string) throws CertificateException {
// Trust always
}

@Override
public X509Certificate getAcceptedIssuers() {
return null;
}
}
};
SSLContext sc = null;
try { // Install the all-trusting trust manager
sc = SSLContext.getInstance("TLS");
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

KeyStore ks = KeyStore.getInstance("JKS");
ks.load(new FileInputStream("C:\destop\cert_211118\token.jks"), cert_password);
kmf.init(ks, cert_password);

// Create empty HostnameVerifier
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String string, SSLSession ssls) {
return true;
}
};

sc.init(kmf.getKeyManagers(), null, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(hv);
} catch (Exception er) {
er.printStackTrace();
}
return sc.getSocketFactory();
}


}



the error :



com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:310)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:259)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
at com.sun.proxy.$Proxy38.getTransactionExportTransactions(Unknown Source)
at com.union.ucollect.services.TestSample.getTransactionExportTransactions(TestSample.java:51)
at com.union.ucollect.services.TestSample.main(TestSample.java:41)


I don't know why I am getting the above error. Please I need help and I need it fast . Thanks in advance.










share|improve this question





























    0















    I need help, I'm having the above error while consuming a SOAP service using Java application but my SOAPUI was able to consume it.
    I have generated the JKS token and extract the public certificate and import it into the JKS file and am sure the error is not coming from that angel.



    public class TestSample {

    public static void main(String args) {
    List<TransactionExport> transactionExports = null;
    TransactionExportTransactionType type = TransactionExportTransactionType.NEW;

    try {
    transactionExports = getTransactionExportTransactions(type.NEW, "adey20939", "hatteiir6434b");
    } catch (Exception e) {
    e.printStackTrace();
    }
    }

    private static List<TransactionExport> getTransactionExportTransactions(TransactionExportTransactionType type, String companyUserName, String companyPassword) throws WebServiceException, WebServiceValidationException {
    SimpleTransactionExportService service = new SimpleTransactionExportService();
    SimpleTransactionExportServiceDelegate port = service.getSimpleTransactionExportServicePort();
    ((BindingProvider) port).getRequestContext().put("com.sun.xml.ws.transport.https.client.SSLSocketFactory", getSocketFactory());
    return port.getTransactionExportTransactions(type, companyUserName, HashPassword.makeSHA1Hash(companyPassword));// this is the error point
    }

    public static SocketFactory getSocketFactory() {
    char cert_password = "qweeqtyye".toCharArray();
    System.setProperty("javax.net.debug", "ssl");
    System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");

    TrustManager trustAllCerts = new TrustManager{
    new X509TrustManager() {
    @Override
    public void checkClientTrusted(X509Certificate xcs, String string) throws CertificateException {
    //
    }

    @Override
    public void checkServerTrusted(X509Certificate xcs, String string) throws CertificateException {
    // Trust always
    }

    @Override
    public X509Certificate getAcceptedIssuers() {
    return null;
    }
    }
    };
    SSLContext sc = null;
    try { // Install the all-trusting trust manager
    sc = SSLContext.getInstance("TLS");
    KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

    KeyStore ks = KeyStore.getInstance("JKS");
    ks.load(new FileInputStream("C:\destop\cert_211118\token.jks"), cert_password);
    kmf.init(ks, cert_password);

    // Create empty HostnameVerifier
    HostnameVerifier hv = new HostnameVerifier() {
    public boolean verify(String string, SSLSession ssls) {
    return true;
    }
    };

    sc.init(kmf.getKeyManagers(), null, null);
    HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
    HttpsURLConnection.setDefaultHostnameVerifier(hv);
    } catch (Exception er) {
    er.printStackTrace();
    }
    return sc.getSocketFactory();
    }


    }



    the error :



    com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:310)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:259)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217)
    at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
    at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
    at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
    at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
    at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
    at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
    at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
    at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
    at com.sun.proxy.$Proxy38.getTransactionExportTransactions(Unknown Source)
    at com.union.ucollect.services.TestSample.getTransactionExportTransactions(TestSample.java:51)
    at com.union.ucollect.services.TestSample.main(TestSample.java:41)


    I don't know why I am getting the above error. Please I need help and I need it fast . Thanks in advance.










    share|improve this question

























      0












      0








      0








      I need help, I'm having the above error while consuming a SOAP service using Java application but my SOAPUI was able to consume it.
      I have generated the JKS token and extract the public certificate and import it into the JKS file and am sure the error is not coming from that angel.



      public class TestSample {

      public static void main(String args) {
      List<TransactionExport> transactionExports = null;
      TransactionExportTransactionType type = TransactionExportTransactionType.NEW;

      try {
      transactionExports = getTransactionExportTransactions(type.NEW, "adey20939", "hatteiir6434b");
      } catch (Exception e) {
      e.printStackTrace();
      }
      }

      private static List<TransactionExport> getTransactionExportTransactions(TransactionExportTransactionType type, String companyUserName, String companyPassword) throws WebServiceException, WebServiceValidationException {
      SimpleTransactionExportService service = new SimpleTransactionExportService();
      SimpleTransactionExportServiceDelegate port = service.getSimpleTransactionExportServicePort();
      ((BindingProvider) port).getRequestContext().put("com.sun.xml.ws.transport.https.client.SSLSocketFactory", getSocketFactory());
      return port.getTransactionExportTransactions(type, companyUserName, HashPassword.makeSHA1Hash(companyPassword));// this is the error point
      }

      public static SocketFactory getSocketFactory() {
      char cert_password = "qweeqtyye".toCharArray();
      System.setProperty("javax.net.debug", "ssl");
      System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");

      TrustManager trustAllCerts = new TrustManager{
      new X509TrustManager() {
      @Override
      public void checkClientTrusted(X509Certificate xcs, String string) throws CertificateException {
      //
      }

      @Override
      public void checkServerTrusted(X509Certificate xcs, String string) throws CertificateException {
      // Trust always
      }

      @Override
      public X509Certificate getAcceptedIssuers() {
      return null;
      }
      }
      };
      SSLContext sc = null;
      try { // Install the all-trusting trust manager
      sc = SSLContext.getInstance("TLS");
      KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

      KeyStore ks = KeyStore.getInstance("JKS");
      ks.load(new FileInputStream("C:\destop\cert_211118\token.jks"), cert_password);
      kmf.init(ks, cert_password);

      // Create empty HostnameVerifier
      HostnameVerifier hv = new HostnameVerifier() {
      public boolean verify(String string, SSLSession ssls) {
      return true;
      }
      };

      sc.init(kmf.getKeyManagers(), null, null);
      HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
      HttpsURLConnection.setDefaultHostnameVerifier(hv);
      } catch (Exception er) {
      er.printStackTrace();
      }
      return sc.getSocketFactory();
      }


      }



      the error :



      com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:310)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:259)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
      at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
      at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
      at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
      at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
      at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
      at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
      at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
      at com.sun.proxy.$Proxy38.getTransactionExportTransactions(Unknown Source)
      at com.union.ucollect.services.TestSample.getTransactionExportTransactions(TestSample.java:51)
      at com.union.ucollect.services.TestSample.main(TestSample.java:41)


      I don't know why I am getting the above error. Please I need help and I need it fast . Thanks in advance.










      share|improve this question














      I need help, I'm having the above error while consuming a SOAP service using Java application but my SOAPUI was able to consume it.
      I have generated the JKS token and extract the public certificate and import it into the JKS file and am sure the error is not coming from that angel.



      public class TestSample {

      public static void main(String args) {
      List<TransactionExport> transactionExports = null;
      TransactionExportTransactionType type = TransactionExportTransactionType.NEW;

      try {
      transactionExports = getTransactionExportTransactions(type.NEW, "adey20939", "hatteiir6434b");
      } catch (Exception e) {
      e.printStackTrace();
      }
      }

      private static List<TransactionExport> getTransactionExportTransactions(TransactionExportTransactionType type, String companyUserName, String companyPassword) throws WebServiceException, WebServiceValidationException {
      SimpleTransactionExportService service = new SimpleTransactionExportService();
      SimpleTransactionExportServiceDelegate port = service.getSimpleTransactionExportServicePort();
      ((BindingProvider) port).getRequestContext().put("com.sun.xml.ws.transport.https.client.SSLSocketFactory", getSocketFactory());
      return port.getTransactionExportTransactions(type, companyUserName, HashPassword.makeSHA1Hash(companyPassword));// this is the error point
      }

      public static SocketFactory getSocketFactory() {
      char cert_password = "qweeqtyye".toCharArray();
      System.setProperty("javax.net.debug", "ssl");
      System.setProperty("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", "true");

      TrustManager trustAllCerts = new TrustManager{
      new X509TrustManager() {
      @Override
      public void checkClientTrusted(X509Certificate xcs, String string) throws CertificateException {
      //
      }

      @Override
      public void checkServerTrusted(X509Certificate xcs, String string) throws CertificateException {
      // Trust always
      }

      @Override
      public X509Certificate getAcceptedIssuers() {
      return null;
      }
      }
      };
      SSLContext sc = null;
      try { // Install the all-trusting trust manager
      sc = SSLContext.getInstance("TLS");
      KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

      KeyStore ks = KeyStore.getInstance("JKS");
      ks.load(new FileInputStream("C:\destop\cert_211118\token.jks"), cert_password);
      kmf.init(ks, cert_password);

      // Create empty HostnameVerifier
      HostnameVerifier hv = new HostnameVerifier() {
      public boolean verify(String string, SSLSession ssls) {
      return true;
      }
      };

      sc.init(kmf.getKeyManagers(), null, null);
      HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
      HttpsURLConnection.setDefaultHostnameVerifier(hv);
      } catch (Exception er) {
      er.printStackTrace();
      }
      return sc.getSocketFactory();
      }


      }



      the error :



      com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:310)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:259)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:217)
      at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:130)
      at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
      at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:1121)
      at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:1035)
      at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:1004)
      at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:862)
      at com.sun.xml.internal.ws.client.Stub.process(Stub.java:448)
      at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:178)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:93)
      at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
      at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
      at com.sun.proxy.$Proxy38.getTransactionExportTransactions(Unknown Source)
      at com.union.ucollect.services.TestSample.getTransactionExportTransactions(TestSample.java:51)
      at com.union.ucollect.services.TestSample.main(TestSample.java:41)


      I don't know why I am getting the above error. Please I need help and I need it fast . Thanks in advance.







      java soap soapui soap-client






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 '18 at 9:44









      Kunle AjiboyeKunle Ajiboye

      1121212




      1121212
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427995%2fcom-sun-xml-internal-ws-client-clienttransportexception-the-server-sent-http-st%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427995%2fcom-sun-xml-internal-ws-client-clienttransportexception-the-server-sent-http-st%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?