Web服务:java.io.IOException:服务器返回HTTP响应代码:500用于URL

时间:2016-01-12 06:31:22

标签: java web-services cxf

我正在尝试使用cxf网络服务。我在intelliJ中有一个java示例,当我运行它时,每件事都可以。但是当我尝试在java web项目(Struts2和spring框架)中调用Web服务时,我遇到了这个异常。两个代码中的每个东西都是相同的。两者都在同一个客户端运行。

任何人都可以告诉我出了什么问题吗?

org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
.
.
.
`Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://servicebus......
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
`.
 .
 .
 .
 .
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://servicebus......
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2081)
... 111 more
我使用的代码如下:

        CustomsDebtService customsDebtService = new CustomsDebtService();
    CustomsDebt debtWebService = customsDebtService.getCustomsDebtPort();
    java.util.Map<String, Object> ctx = ((BindingProvider) debtWebServicePort).getRequestContext();
    ctx.put("ws-security.signature.properties", "keystore.properties");
    ctx.put("ws-security.encryption.properties", "truststore.properties");
    ctx.put("ws-security.encryption.username", "servicebus.ecogif.XX");
    ctx.put("ws-security.asymmetric.signature.algorithm", "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
    ctx.put("ws-security.callback-handler", "externalWebService.XXX.newDebts.CertificatePasswordCallbackHandler");
    PersonDebtInquiryResult personDebtInquiryResult;

        if (Empty.isNotEmpty(iricaDebtsInquiry.getNationalCode()))
        {

            personDebtInquiryResult=debtWebService.personDebtInquiryByNationalID("000000001");
        }

异常发生在最后一行。 所有地址都是正确的。

还有一些配置的.jks文件,我把它们放在ctx中(在代码中)。这个文件的正确路径是什么,这样可以通过代码理解。是否可能因错误的路径而出现问题?

0 个答案:

没有答案