2017-10-03 9 views
0

내가 WSO2 EI 꽤 새로운 오전 내 ESB 흐름에 정의 된 API에서 DSS 서비스를 호출하려고 몇 가지 문제를 발견하고 발견했다.ESB API 플로우에서 DSS 쿼리를 수행하려고 할 때이 오류가 발생하는 이유는 무엇입니까? 조작에 대한 엔드 포인트 참조 (EPR)를하지

내가 이런 식으로했을 : 나는이 작업을 파일 내 DSS 서비스와 관련된 agrimarketprice-dss.dbs 속으로

1) :

<operation name="GetCommodityDetails"> 
    <call-query href="SelectCommodityDetails"> 
     <with-param name="commodity_details_id" query-param="commodity_details_id"/> 
    </call-query> 
</operation> 

쿼리를 호출하는 id = commodity_details_id입니다. 그것은 잘 작동, 나는 그것과 함께 시도해보십시오 도구와 나는 예상 결과 집합을 얻을.

2) 그 때 나는이 ESB 흐름에 의해 정의 된이 API를 정의 :

<?xml version="1.0" encoding="UTF-8"?> 
<api context="/commodity_details" name="commodity_details" xmlns="http://ws.apache.org/ns/synapse"> 
    <resource methods="GET" protocol="http" uri-template="/{commodityId}"> 
     <inSequence> 
      <property expression="get-property('uri.var.commodityId')" name="commodityId" scope="default" type="STRING"/> 
      <log level="custom"/> 
      <log description="commodity_details" level="custom" separator="-"> 
       <property name="commodity_details" value="'commodity_details START'"/> 
      </log> 
      <log level="custom"> 
       <property expression="$ctx:commodityId" name="COMMODITY ID"/> 
      </log> 

      <property name="messageType" scope="axis2" type="STRING" value="application/xml"/> 
      <payloadFactory media-type="xml"> 
       <format> 
        <ds:GetCommodityDetails xmlns:ds="http://ws.wso2.org/dataservice"> 
         <ds:commodity_details_id>$1</ds:commodity_details_id> 
        </ds:GetCommodityDetails> 
       </format> 
       <args> 
        <arg evaluator="xml" expression="$ctx:commodityId" xmlns:ds="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd"/> 
       </args> 
      </payloadFactory> 
      <header name="Action" scope="default" value="urn:GetCommodityDetails"/> 
      <call> 
       <endpoint key="agrimarketprice_Endpoint"/> 
      </call> 
     </inSequence> 
     <outSequence/> 
     <faultSequence/> 
    </resource> 
</api> 

당신은 내가 이전 이전 작업 내 DSS 서비스로 정의를 호출하는 것을 시도하고있다 이전 ESB 흐름에서 볼 수 있듯이

<property name="messageType" scope="axis2" type="STRING" value="application/xml"/> 
<payloadFactory media-type="xml"> 
    <format> 
     <ds:GetCommodityDetails xmlns:ds="http://ws.wso2.org/dataservice"> 
      <ds:commodity_details_id>$1</ds:commodity_details_id> 
     </ds:GetCommodityDetails> 
    </format> 
    <args> 
     <arg evaluator="xml" expression="$ctx:commodityId" xmlns:ds="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd"/> 
    </args> 
</payloadFactory> 
<header name="Action" scope="default" value="urn:GetCommodityDetails"/> 
<call> 
    <endpoint key="agrimarketprice_Endpoint"/> 
</call> 

그래서 나는 $의 CTX가 나타내는 검색 ID를 포함하는 페이로드를 만드는 오전 : : 이런 식으로 내가 logge 때문에는 (올바른 값을 포함 commodityId 그것). 그런 다음 실행해야하는 작업의 이름을 헤더에 설정합니다 ("urn : GetCommodityDetails"). 나는 다른 API의 다른 쿼리를 사용 (하지만이 때문에

<?xml version="1.0" encoding="UTF-8"?> 
<endpoint name="agrimarketprice_Endpoint" xmlns="http://ws.apache.org/ns/synapse"> 
    <address uri="http://localhost:8280/services/agrimarketprice-dss"/> 
</endpoint> 

이 엔드 포인트가 올바른지 : Finnaly 내가 이전 DSS 서비스의 세부 사항을 포함하는 agrimarketprice_Endpoint쪽으로 호출을 수행,이 콘텐츠입니다 이 다른 쿼리에서는 JSON 문서에서 매개 변수를 추출하기 때문에 다른 논리).

TID: [-1234] [] [2017-10-03 11:55:16,574] INFO {org.apache.synapse.mediators.builtin.LogMediator} - {org.apache.synapse.mediators.builtin.LogMediator} 
TID: [-1234] [] [2017-10-03 11:55:16,574] INFO {org.apache.synapse.mediators.builtin.LogMediator} - commodity_details = 'commodity_details START' {org.apache.synapse.mediators.builtin.LogMediator} 
TID: [-1234] [] [2017-10-03 11:55:16,575] INFO {org.apache.synapse.mediators.builtin.LogMediator} - COMMODITY ID = 1 {org.apache.synapse.mediators.builtin.LogMediator} 
TID: [-1234] [] [2017-10-03 11:55:16,597] INFO {org.apache.synapse.core.axis2.TimeoutHandler} - This engine will expire all callbacks after GLOBAL_TIMEOUT: 120 seconds, irrespective of the timeout action, after the specified or optional timeout {org.apache.synapse.core.axis2.TimeoutHandler} 
TID: [-1234] [] [2017-10-03 11:55:16,637] ERROR {org.apache.axis2.engine.AxisEngine} - The endpoint reference (EPR) for the Operation not found is /services/agrimarketprice-dss/1 and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator. {org.apache.axis2.engine.AxisEngine} 
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /services/agrimarketprice-dss/1 and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator. 
     at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102) 
     at org.apache.axis2.engine.Phase.invoke(Phase.java:329) 
     at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261) 
     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167) 
     at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:326) 
     at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:158) 
     at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
     at java.lang.Thread.run(Thread.java:745) 
TID: [-1234] [] [2017-10-03 11:55:16,642] ERROR {org.apache.synapse.transport.passthru.ServerWorker} - Error processing GET request for : /services/agrimarketprice-dss/1 {org.apache.synapse.transport.passthru.ServerWorker} 
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation not found is /services/agrimarketprice-dss/1 and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator. 
     at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102) 
     at org.apache.axis2.engine.Phase.invoke(Phase.java:329) 
     at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261) 
     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167) 
     at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:326) 
     at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:158) 
     at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
     at java.lang.Thread.run(Thread.java:745) 
TID: [-1] [] [2017-10-03 11:58:16,778] INFO {org.apache.synapse.transport.passthru.SourceHandler} - Writer null when calling informWriterError {org.apache.synapse.transport.passthru.SourceHandler} 
TID: [-1] [] [2017-10-03 11:58:16,780] WARN {org.apache.synapse.transport.passthru.SourceHandler} - Connection time out after request is read: http-incoming-6 Socket Timeout : 180000 Remote Address : /168.202.253.227:62418 {org.apache.synapse.transport.passthru.SourceHandler} 

그것은에 보인다

provlem 내가 탄소 로그에 다음과 같은 오류 메시지를 획득하고 내 API를 호출 할 때 (내 쿼리를 실행 호출을 수행하려고 할 때 내 생각)이다 날이 오류는이 로그 정보와 관련된되어야한다 :

The endpoint reference (EPR) for the Operation not found is /services/agrimarketprice-dss/1 and the WSA Action = null 

에 전달 된 ID (1)를 추가 할 tryng 것을 보인다 (즉, 서비스 이름) 작업을 ignorning agrimarketprice-DSS (즉 GetCommodityDetails 및 헤더에 지정).

그래서 무엇이 잘못 되었나요? 내가 뭘 놓치고 있니? 이 오류를 수정하려면 어떻게해야합니까?EDIT-1

: 나는 다른 방법을 시도 : API가 는 요청의 URL 경로에서하지만,이 같은 JSON 문서에서을 commodity_id 검색하지 않습니다 그래서

{ 
"commodity_id": 1 
} 

, 변경

<?xml version="1.0" encoding="UTF-8"?> 
<api context="/commodity_details" name="commodity_details" xmlns="http://ws.apache.org/ns/synapse"> 
    <resource methods="POST" protocol="http" uri-template="/"> 
     <inSequence> 
      <log level="full"/> 
      <log level="custom"> 
       <property expression="json-eval($.commodity_id)" name="Commodity ID"/> 
      </log> 
      <property expression="json-eval($.commodity_id)" name="CommodityId" scope="default" type="STRING"/> 
      <property name="messageType" scope="axis2" type="STRING" value="application/xml"/> 
      <payloadFactory media-type="xml"> 
       <format> 
        <ds:GetCommodityDetails xmlns:ds="http://ws.wso2.org/dataservice"> 
         <ds:commodity_details_id>$1</ds:commodity_details_id> 
        </ds:GetCommodityDetails> 
       </format> 
       <args> 
        <arg evaluator="json" expression="$.commodity_id"/> 
       </args> 
      </payloadFactory> 
      <header name="Action" scope="default" value="urn:GetCommodityDetails"/> 
      <call> 
       <endpoint key="agrimarketprice_Endpoint"/> 
      </call> 

      <send/> 
     </inSequence> 
     <outSequence> 
      <send/> 
     </outSequence> 
     <faultSequence/> 
    </resource> 
</api> 
:이 방법으로 API 그것은) 쿼리가 제대로 수행됩니다 (하지만 난 URL에서 commodity_id를 검색 (쿼리 매개 변수로 사용되도록해야 만 해결 될 수있다, 잘 작동

이렇게하면 DSS 서비스가 올바르게 호출되고 쿼리가 수행되며 API는 예상 된 결과를 클라이언트에 다시 보냅니다.

하지만 POST 요청의 JSON 문서에서 ID를 검색하는 것이 정상적으로 작동하지만 URL에서 검색하지 못하는 이유는 무엇입니까?

+0

조치 헤더를 제거하십시오.

simar

답변

0

다음과 같이 호출 메니 에이터 앞에 soapAction 헤더를 설정하십시오. 와이어 로그를 활성화하여 SOAPAction 헤더가 dataservice에 대한 요청에 설정되었는지 확인할 수 있습니다.