org.apache.cxf.interceptor.Fault: Could not send Message.(CXFクライアント呼び出しエラー)

3829 ワード

weblogic+cxf     
        webservice,          ;

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:220)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:171)
at $Proxy11.sayHello(Unknown Source)
at com.test.cxf.Client.main(Client.java:18)
Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
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.handleResponse(HTTPConduit.java:1900)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1828)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:590)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 7 more


 
 
以下は、クライアントがwebserviceを呼び出すコードです.
public String caculateYaocjh(){
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean ();
		factory.setServiceClass(IYaoHLJhService.class);
		factory.setAddress("http://localhost:8085/athena/services/yaocjhService");
		try{               
				IYaoHLJhService hs=  (IYaoHLJhService) factory.create();
		        hs.createYaoHLJhMx(); 
		   } catch (Exception e) {
				throw new ActionException(e.getMessage()); 
			}   
		   //  
			Map<String, String> message = new HashMap<String, String>();
			message.put("message", "webService          ");
			setResult("result",message);
		   return AJAX;
	} 

 
 
ネット上では多くの説があります.
例:
Spring cxf異常:
2つの理由があります.
  • クライアントのインタフェースのパケット名(またはインタフェース名)とサービス側のパケット名(またはインタフェース名)とが一致しない
  • .
  • クライアントのインタフェースに@Webservice注記
  • が追加されていません.
     
     
    例:
    sunのhttps handlerを優先的にロードします.
    プログラムにweblogを追加します.xmlプロファイル;
     
    これらはすべて私の問題を解決していないで、最後に1篇の良い文章を見て、私の問題を解決しました.
     
    この点を理解してください.
    現在の最新仕様はJAX-WS(JAX-RPCと区別)であり、jaxws-ri(sunの参照実装)学習(samples/fromwsdl)をダウンロードすることができる.基本原理を理解して、具体的な開発はあなたが選んだ開発プラットフォームに依存して、Apache CXF、Apache Axis 2、weblogic、websphereはすべて相応の処理方法があります.このうちWeblogic 11 gはjaxws-riに基づいており、彼らは家族です.
     
     
    webserviceとxfireが実現しているネット上には多くのものがあり、すべて正しいです.
    これは全部話しています.http://atomti.iteye.com/blog/476408を参照してください.
     
    WebserviceはCXFのこれとよく話しています.http://blog.csdn.net/cyf_cyf/article/details/7187911を参照してください.
     
     
    私の間違いはここにあります.
     
     
    factory.setAddress("http://localhost:8085/athena/services/yaocjhService");
    

     
    このコードを次の形式に変更すると、正しく実行できます.
    factory.setAddress("http://localhost:8085/athena/services/yaocjhService?wsdl");