0

私はラバ<cxf:proxy-service>で作業しており、後で使用するためにメッセージに添付する Web サービス メソッド名を抽出する必要があります。

Callable インターフェイスを実装するサービス プロキシ クラスがあります。最初は、次のような操作名を取得しようとしました。

public Object onCall(MuleEventContext eventContext) throws Exception {  
    try {
        MuleMessage inboundMessage = eventContext.getMessage();

        Set<String> props = inboundMessage.getInvocationPropertyNames();
        System.out.println("CXF invocation properties ==> " + props);
        System.out.println("CXF invocation property ==> " +  inboundMessage.getInvocationProperty("cxf_operation"));

しかし、上記のコードは間違った操作名を与えています。(サービスには 4 つのオペレーションがあり、常に 2 番目のオペレーション名が付けられます)。以下は、これに使用されるミュール フローです。

<flow name="proxyService">
    <http:inbound-endpoint address="${some.address}"
        exchange-pattern="request-response">

        <cxf:proxy-service wsdlLocation="classpath:abc.wsdl"
            namespace="http://namespace"
            service="MyService">

        </cxf:proxy-service>
    </http:inbound-endpoint>
    <component class="com.services.MyServiceProxy" />

そこで、インバウンド cxf インターセプターを作成して操作名を抽出することにしました。以下のインターセプターは正常に機能します<cxf:jaxws-service>が、要素では機能しません<cxf:proxy-service>

これが私のインターセプターです:

public class GetCXFOperation extends AbstractPhaseInterceptor<Message> {

public GetCXFOperation() {
    super(Phase.PRE_INVOKE);

}

@Override
public void handleMessage(Message message) throws Fault {
    Exchange exchange = message.getExchange();
    Endpoint ep = exchange.get(Endpoint.class);
    OperationInfo op = exchange.get(OperationInfo.class);
    if(op != null){
    System.out.println("Operation Name: " + op.getName().getLocalPart());
    } else{
         Object nameProperty = exchange.get("org.apache.cxf.resource.operation.name"); 
    if(nameProperty != null)

    System.out.println(nameProperty.toString());
    }

}

}

で操作名を抽出する方法についてのガイダンスをお探し<cxf:proxy-service>ですか? 正しい答えを得る簡単なラバの方法はありますか? または、インターセプターを呼び出す必要がある別のフェーズがありますか? どのフェーズが機能するか<cxf:proxy-service>

4

0 に答える 0