2016-08-26 14 views
1

私はwso2 esbのカスタムaxis2モジュールで作業しています。現在、私はhttps://docs.wso2.com/display/ESB490/Writing+an+Axis2+Module のコードを使用していますが、着信要求に問題があります。応答がOKに見えますが、代わりに「アウト」の方向は次のように設定されている -WSO2 axis2モジュールの空のsoapエンベロープ

流出は、多かれ少なかれ、それが必要として働く一方
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope> 

:それは常にこのようになりますので、私が送信要求するかは重要ではありません"に"。私が間違っていない場合は、メソッドを呼び出すとリクエストが呼び出され、レスポンスが取り消されます - そうですか?私の場合、どちらもinvokeを使用しています。私が間違っていることは何ですか?

編集: 私のハンドラのコード:

public class LogHandler extends AbstractHandler implements Handler { 
    private Logger log = Logger.getLogger(LogHandler.class.toString()); 

    @Override 
    public void init(HandlerDescription handlerDescription) { 
     super.init(handlerDescription); 
    } 

    public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { 
     System.out.println("invoked: " + msgContext.getEnvelope().toString() + "\n"); 
     log.info("invoked: " + msgContext.getEnvelope().toString() + "\n"); 
     return InvocationResponse.CONTINUE; 
    } 

    public void revoke(MessageContext msgContext) { 
     log.info("revoked: " + msgContext.getEnvelope().toString() + "\n"); 
    } 

} 

モジュール:

public class LoggingModule implements Module { 
    private static final Log log = LogFactory.getLog(LoggingModule.class); 

    // initialize the module 
    public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault { 
    } 

    public void engageNotify(AxisDescription axisDescription) throws AxisFault { 
    } 

    // shutdown the module 
    public void shutdown(ConfigurationContext configurationContext) throws AxisFault { 
    } 

    public String[] getPolicyNamespaces() { 
     return null; 
    } 

    public void applyPolicy(Policy policy, AxisDescription axisDescription) throws AxisFault { 
    } 

    public boolean canSupportAssertion(Assertion assertion) { 
     return true; 
    } 
} 

module.xml:私は応答を作成するために、ペイロードメディエータを使用して、私のWSO2プロキシで

<module name="sample-logging" class="pl.wso2.logging.LoggingModule"> 
    <InFlow> 
     <handler name="InFlowLogHandler" class="pl.wso2.logging.LogHandler"> 
      <order phase="loggingPhase"/> 
     </handler> 
    </InFlow> 
    <OutFlow> 
     <handler name="OutFlowLogHandler" class="pl.wso2.logging.LogHandler"> 
      <order phase="loggingPhase"/> 
     </handler> 
    </OutFlow> 
</module> 

とRespond Mediatorを使用してそれを返します。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
    <aa>blahblah</aa> 
    </soapenv:Body> 
</soapenv:Envelope> 

がログイン2つの事: 流入

invoked: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlso 
ap.org/soap/envelope/"><soapenv:Body/></soapenv:Envelope> 

からの要求と流出

invoked: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlso 
ap.org/soap/envelope/"><soapenv:Body><m:checkpriceresponse xmlns:m="http://services.samples/xsd"><m: 
code>dsadsa</m:code></m:checkpriceresponse></soapenv:Body></soapenv:Envelope> 
+0

あなたのコードを共有してテストしてください。 –

答えて

0

私が見つけたことは、要求がInFlowで解析されている間に、そのSOAPメッセージを使用する代わりに、ありがたいことに、Soap Tracerハンドラ(またはそのコード)を使用して適切なリクエストにアクセスすることが可能です。

0

としてhttps://axis.apache.org/axis2/java/core/docs/modules.html#Step2_:_LogHandlerあたりからの応答...

与えられた要求に対して

"public void invoke(MessageContext ctx);"コントロールがハンドラに渡されたときにAxis2エンジンによって と呼ばれるメソッドです。 "public void revoke(MessageContext ctx);"ハンドラは、Axis2のエンジンによって を取り消されたときに呼び出されます。」

あなたが同じのinvoke()メソッドは、要求と応答の両方のためのトリガー取得する必要があります流入および流出の両方で同じハンドラを呼び出しているので、意味しています

+0

インフローとアウトフローの両方に1つの方法を使用しても構いません。現時点では私の主な問題ではありません。とにかく私はそれのための修正を見つけた。 – KapitanKopytko

関連する問題