0

cxf.xml構成ファイルの正しい場所はどこですか? スタンドアロンの jar 形式のクライアント ws コンシューマーでの SOAP メッセージのログ記録を有効にしようとしています。wsdltojava ユーティリティでアーティファクトを生成し、自動生成された開始点テスト クライアントを使用すると、非常にうまく機能します。ドキュメントに従って構成ファイルを作成しましたが、コンソールでは何も起こっていません。これは私の cxf.xml ファイルの内容です:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cxf="http://cxf.apache.org/core"
      xsi:schemaLocation=" 
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="abstractLoggingInterceptor" abstract="true">
    <property name="prettyLogging" value="true"/>
</bean>
<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" parent="abstractLoggingInterceptor"/>
<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" parent="abstractLoggingInterceptor"/>

<cxf:bus>
    <cxf:inInterceptors>
        <ref bean="loggingInInterceptor"/>
    </cxf:inInterceptors>
    <cxf:outInterceptors>
        <ref bean="loggingOutInterceptor"/>
    </cxf:outInterceptors>
    <cxf:outFaultInterceptors>
        <ref bean="loggingOutInterceptor"/>
    </cxf:outFaultInterceptors>
    <cxf:inFaultInterceptors>
        <ref bean="loggingInInterceptor"/>
    </cxf:inFaultInterceptors>
</cxf:bus>  

</beans>

プロジェクトルートとsrcの下に配置しようとしましたが、何もしませんでした。私は何が欠けていますか?

私のクライアントコードは次のようなものです:

public final class ClientMHttps {

private static final QName SERVICE_NAME = new       QName("http://thecompany/service-b", "myendpoint-v1");

private  myendpointPortType port ;

public ClientMHttps() throws java.lang.Exception {
    URL wsdlURL = myendpointV1.WSDL_LOCATION;

    myendpointV1 ss = new myendpointV1(wsdlURL, SERVICE_NAME);
    port = ss.getmyendpointPortTypeEndpointHttpsM(); 




}

    public DeleteMarkedStatusResponse do_DeleteMarkedStatus(DeleteMarkedStatusRequest  _deleteMarkedStatus_body) throws java.lang.Exception
    {
    System.out.println("Invoking deleteMarkedStatus...");
    javax.xml.ws.Holder<HeaderType> _header =  this.HeaderFarm();
    DeleteMarkedStatusResponse _deleteMarkedStatus__return = port.deleteMarkedStatus(_deleteMarkedStatus_body, _header);
    System.out.println("deleteMarkedStatus.result=" + _deleteMarkedStatus__return);
    return _deleteMarkedStatus__return;


    }
4

3 に答える 3

0

CXF Web サービス クライアントを作成する<jaxws:client>要素を Spring 構成ファイル (cxf.xml) に追加する必要があります。次に、コードでこのクライアント Bean を使用して、Web サービスを呼び出す必要があります。

使用するロギング フレームワークによっては、ここでMETA-INF/cxf/org.apache.cxf.Logger説明されているように を構成する必要がある場合があります。

log4jlogbackまたはlog4j2用に CXF を構成する方法をより詳細に説明するブログ投稿を作成しました。

あまり詳細ではない CXF ロギング機能を使用することもできます。

于 2015-01-10T21:12:06.033 に答える
0

修正する必要があるのは、Bean 名と cxf.xml の場所だけだと思います。

src/main/resources/cxf.xml では、次のような cxf.xml ファイルを使用して、すべての CXF メッセージをログに記録できます。

<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:cxf="http://cxf.apache.org/core"
      xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

    <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="logInbound"/>
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="logOutbound"/>
        </cxf:outInterceptors>
        <cxf:outFaultInterceptors>
            <ref bean="logOutbound"/>
        </cxf:outFaultInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="logInbound"/>
        </cxf:inFaultInterceptors>
    </cxf:bus> 
</beans>
于 2012-10-27T15:35:01.120 に答える