0

JSON クライアントから ESB 経由で DSS サーバーへのリクエストを呼び出そうとしています。フェッチ データ サービスを呼び出そうとしています。クライアント コード、ESB インシーケンス構成を以下に示します。以下のようなサーバー エラーが発生します。

LogMediator 宛先: http://www.w3.org/2005/08/addressing/anonymous、WSAction: 、SOAPAction: 、MessageID: urn:uuid:da913ea8-4122-4f58-9732-4106a55b465a、方向: 応答、MESSAGE = 実行中デフォルトの「障害」シーケンス、ERROR_CODE = 0、ERROR_MESSAGE = メッセージを返送する予期しないエラー、エンベロープ:

クライアントコードは次のとおりです。

 URL url = new URL("http://xxx:xx:xx:xxx/entitytype");
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
    conn.setDoOutput(true);
    conn.setRequestMethod("POST");
    conn.setRequestProperty("Content-Type", "application/json");
    String studentDetails = "{\"hierarchyEntityRequest\":{\"entityName\":\"Chandragiri\",\"parentEntity\":900000001}}";

    System.setProperty("studentDetails",studentDetails);
    OutputStream os = conn.getOutputStream();
    os.write(studentDetails.getBytes());
    os.flush();

    if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
        throw new RuntimeException("Failed : HTTP error code : "
                + conn.getResponseCode());
    }

    BufferedReader br = new BufferedReader(new InputStreamReader(
            (conn.getInputStream())));


    conn.disconnect();

} catch (MalformedURLException e) {

    e.printStackTrace();

} catch (IOException e) {

    e.printStackTrace();

}

ESB 構成サービスは次のとおりです。

           <payloadFactory>
  <format>
     <p:getEntityById xmlns:p="http://com.pcs.entity">
           <xs:data xmlns:xs="http://com.pcs.entity">get-property('uri.var.myhierachy')</xs:data>
        </p:getEntityById>
     </format>
     <args>
        <arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('uri.var.myhierachy')"/>
     </args>
  </payloadFactory>
  <enrich>
     <source clone="true" type="body"/>
     <target action="replace" type="property" property="myhierachy"/>
  </enrich>
<enrich>
     <source clone="true" type="body"/>
     <target action="replace" type="property" property="myhierachy"/>
  </enrich>
  <send>
     <endpoint key="HierarchyService"/>
  </send>
  <property name="messageType" value="application/json" scope="axis2" type="STRING"/>
  <log level="full" category="TRACE"/>

4

1 に答える 1

1

メッセージを DSS サーバーに送信し、応答を返さない場合は、後述のように「OUT_ONLY」プロパティを「true」に指定できます。

<property action="set" name="OUT_ONLY" value="true"/>

クライアントに応答を返したい場合は、構成の最後の要素として、または out シーケンス内に mediator を含めることができます。

<send/>
于 2013-06-20T07:24:29.213 に答える