gpt4 book ai didi

java - 无法使用 Apache CXF Soap 通过代理建立隧道

转载 作者:行者123 更新时间:2023-12-02 05:35:54 26 4
gpt4 key购买 nike

我正在尝试使用 Apache CXF 通过 HTTPS 代理上的 SOAP 进行调用。

它是一个在 Cloud Foundry 上运行的 Java 应用程序。代理作为 Cloud Foundry 服务提供。 Rest 调用通过 RestTemplateCustomizer 中的配置进行处理。

我尝试了以下方法(我尝试了每一条赞扬的语句,但没有成功):

    PortType port = cs.getServicePort();
assert port instanceof BindingProvider;
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
//bp.getRequestContext().put("https.proxyHost", endpoint.getHost());
//bp.getRequestContext().put("https.proxyPort", endpoint.getPort());

final Client client = ClientProxy.getClient(port);
final HTTPConduit http = (HTTPConduit) client.getConduit();

http.getClient().setProxyServer(endpoint.getHost());
http.getClient().setProxyServerPort(endpoint.getPort());
http.getProxyAuthorization().setUserName(configProperties.getUser());
http.getProxyAuthorization().setPassword(configProperties.getPassword());

//http.getProxyAuthorization().setAuthorizationType("Basic");
//http.getClient().setProxyServerType(ProxyServerType.SOCKS);

http.getAuthorization().setUserName(configProperties.getUser());
http.getAuthorization().setPassword(configProperties.getPassword());
//http.getAuthorization().setAuthorizationType("Basic");

堆栈跟踪看起来像:

2019-05-16T11:11:53.76+0200 [APP/PROC/WEB/0] OUT javax.xml.ws.WebServiceException:无法发送消息。 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.jaxws.JaxWsClientProxy.mapException(JaxWsClientProxy.java:183) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145) 2019-05-16T11:11:53.76+0200 [APP/PROC/WEB/0] 已在 com.sun.proxy.$Proxy288.getConfigurations(来源未知)

#

2019-05-16T11:11:53.76+0200 [APP/PROC/WEB/0] OUT 导致:java.io.IOException: IOException 调用 https://service.com/services/Service/v1 :无法通过代理建立隧道。代理返回“HTTP/1.1 407 需要代理身份验证” 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在sun.reflect.NativeConstructorAccessorImpl.newInstance0( native 方法)中退出 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 2019-05-16T11:11:53.76+0200 [APP/PROC/WEB/0] 在 java.lang.reflect.Constructor.newInstance(Constructor.java:423) 处退出 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.transport.http.HTTPConduit $ WrappedOutputStream.mapException(HTTPConduit.java:1402) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.transport.http.HTTPConduit $ WrappedOutputStream.close(HTTPConduit.java:1386) 2019-05-16T11:11:53.76+0200 [APP/PROC/WEB/0] 已在 org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) 上发布 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.interceptor.MessageSenderInterceptor $ MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:440) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) 2019-05-16T11:11:53.76 + 0200 [APP/PROC/WEB/0]在org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140) 2019-05-16T11:11:53.76+0200 [APP/PROC/WEB/0] OUT ... 131个常见帧省略

最佳答案

找到了解决方案。我必须设置以下标志:

-Djdk.http.auth.tunneling.disabledSchemes=""

关于java - 无法使用 Apache CXF Soap 通过代理建立隧道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56165261/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com