2016-11-06 2 views
0

私はWSO2 APIマネージャーバージョン2.0.0を使用しています。 API Publisherでは、in pathパラメータを使用してAPIにPOSTエンドポイントを追加しました。"。"を含むAPIパスにパラメータを追加できません。文字

POST /person/{id}

すべてが正常に動作します。パスパラメーターidがエンドポイントに追加されます。

パスに.文字がどこかに含まれていると、これは機能しません。 POST /cool.person/{id}を追加すると、パラメータリストが空になります。また、このエンドポイントに手動でパラメータを追加することもできません。

私は何か間違っているのですか、これはバグですか?

+0

私はそれがうまくいくと思います。ワイヤーログとポストログを有効にしてください。 http://lakshanigamage.blogspot.com/2015/03/how-to-enable-wire-logs-in-wso2-esbapim.html – Bee

+0

説明したようにデバッグログを有効にしましたが、追加情報は書き込まれませんでした。しかし、あなたは問題を再現できますか?私はローカルマシン上で実行されている単純なスタンドアロンのインストールを使用しています。何も特別なものはありません。それは単なる速いテストだった。 – Florian

+0

それは私のためにうまく動作します。リクエストを送信すると、ワイヤログが表示されます。もう一度お試しください。 – Bee

答えて

1

私の知見によると、これに関する私の知見によれば、POST /person/{id}POST /cool.person/{id}は正しいです。 問題がエンドポイントにあり、エンドポイントが別のエントリを追加する権限をPOSTメソッドで与えていないと思います。 私はあなたの道を辿り、あなたの状況を再現できませんでしたが、そこに別のエントリーを置くためにエンドポイントからの許可が必要であることがわかりました。 は、私は私のsynapsが応答

<?xml version="1.0" encoding="UTF-8"?> 
<api xmlns="http://ws.apache.org/ns/synapse" 
    name="admin--UrlTest" 
    context="/paternType/1.0" 
    version="1.0" 
    version-type="context"> 
    <resource methods="POST" url-mapping="/persons.list" faultSequence="fault"> 
     <inSequence> 
     <property name="api.ut.backendRequestTime" 
        expression="get-property('SYSTEM_TIME')"/> 
     <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION"> 
      <then> 
       <send> 
        <endpoint name="admin--UrlTest_APIproductionEndpoint_0"> 
        <http uri-template="http://jsonplaceholder.typicode.com/posts?"/> 
        <property name="ENDPOINT_ADDRESS" 
           value="http://jsonplaceholder.typicode.com/posts?"/> 
        </endpoint> 
       </send> 
      </then> 
      <else> 
       <send> 
        <endpoint name="admin--UrlTest_APIsandboxEndpoint_0"> 
        <http uri-template="http://jsonplaceholder.typicode.com/posts?"/> 
        <property name="ENDPOINT_ADDRESS" 
           value="http://jsonplaceholder.typicode.com/posts?"/> 
        </endpoint> 
       </send> 
      </else> 
     </filter> 
     </inSequence> 
     <outSequence> 
     <class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/> 
     <send/> 
     </outSequence> 
    </resource> 
    <resource methods="POST" url-mapping="/persons" faultSequence="fault"> 
     <inSequence> 
     <property name="api.ut.backendRequestTime" 
        expression="get-property('SYSTEM_TIME')"/> 
     <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION"> 
      <then> 
       <send> 
        <endpoint name="admin--UrlTest_APIproductionEndpoint_1"> 
        <http uri-template="http://jsonplaceholder.typicode.com/posts?"/> 
        <property name="ENDPOINT_ADDRESS" 
           value="http://jsonplaceholder.typicode.com/posts?"/> 
        </endpoint> 
       </send> 
      </then> 
      <else> 
       <send> 
        <endpoint name="admin--UrlTest_APIsandboxEndpoint_1"> 
        <http uri-template="http://jsonplaceholder.typicode.com/posts?"/> 
        <property name="ENDPOINT_ADDRESS" 
           value="http://jsonplaceholder.typicode.com/posts?"/> 
        </endpoint> 
       </send> 
      </else> 
     </filter> 
     </inSequence> 
     <outSequence> 
     <class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/> 
     <send/> 
     </outSequence> 
    </resource> 
    <resource methods="GET" url-mapping="/personlist" faultSequence="fault"> 
     <inSequence> 
     <property name="api.ut.backendRequestTime" 
        expression="get-property('SYSTEM_TIME')"/> 
     <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION"> 
      <then> 
       <send> 
        <endpoint name="admin--UrlTest_APIproductionEndpoint_2"> 
        <http uri-template="http://jsonplaceholder.typicode.com/posts?"/> 
        <property name="ENDPOINT_ADDRESS" 
           value="http://jsonplaceholder.typicode.com/posts?"/> 
        </endpoint> 
       </send> 
      </then> 
      <else> 
       <send> 
        <endpoint name="admin--UrlTest_APIsandboxEndpoint_2"> 
        <http uri-template="http://jsonplaceholder.typicode.com/posts?"/> 
        <property name="ENDPOINT_ADDRESS" 
           value="http://jsonplaceholder.typicode.com/posts?"/> 
        </endpoint> 
       </send> 
      </else> 
     </filter> 
     </inSequence> 
     <outSequence> 
     <class name="org.wso2.carbon.apimgt.usage.publisher.APIMgtResponseHandler"/> 
     <send/> 
     </outSequence> 
    </resource> 
    <handlers> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler"/> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler"> 
     <property name="apiImplementationType" value="ENDPOINT"/> 
     </handler> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler"/> 
     <handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageHandler"/> 
     <handler class="org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler"> 
     <property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/> 
     </handler> 
     <handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/> 
    </handlers> 
</api> 

GET request and two POST requests

Firt POST request as <code>/persons</code>

Second POST request as <code>/persons.list</code>

Jeewanaのとスナップショットをファイル添付します。

+0

別の点として、エンドポイントに '/ person/{id}'のようなURLパターンを持つサービスが含まれている可能性があります。しかし、 '/cool.person/{id}'のようなURLパターンを持つサービスはありません。 **私のポイントは "です。"文字は理由ではなく、理由はエンドポイントサービスかもしれません** – JeewanaSL

+0

詳細なお返事ありがとうございます。主な問題はエンドポイントではなく、パブリッシャーのUI内でパラメーターを追加できないという事実です。ですから、パブリッシャーでcool.person/{id}を定義しているときは、実際にパラメーターを表示していますか?あるいは、別のクエリパラメータを追加できますか? – Florian

関連する問題