2017-11-09 15 views
0

실패로 매핑 된 응답 코드 404를 가져 오는 오픈 소스 API를 사용하려고합니다.Mulesoft에서 웹 API를 사용하여 "Response code 404 failed to mapped"가 표시됩니다.

<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/> 
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="api.taxjar.com" port="443" basePath="v2/taxes" doc:name="HTTP Request Configuration"/> 
<flow name="postTaxCollectionFlow"> 
    <http:listener config-ref="HTTP_Listener_Configuration" path="/taxcollection" allowedMethods="POST" doc:name="HTTP"/> 
    <dw:transform-message doc:name="Transform Message" metadata:id="2789cbd2-5ca6-46c2-856f-67ba2bdfa6dd"> 
     <dw:input-payload mimeType="application/json"/> 
     <dw:set-payload> 
      <![CDATA[%dw 1.0 
      %output application/json 
      --- 
      payload 
      ]]></dw:set-payload> 
    </dw:transform-message> 
    <http:request config-ref="HTTP_Request_Configuration" path="https://api.taxjar.com/v2/taxes" method="POST" doc:name="Web Service"> 
     <http:request-builder> 
      <http:query-param paramName="Authorization" value="Token token=&quot;8dbc821e651fe0672c4032e65209b37c&quot;"/> 
      <http:query-param paramName="Content-Type" value="application/json"/> 
     </http:request-builder> 
    </http:request> 
    <byte-array-to-object-transformer doc:name="Byte Array to Object"/> 
    <json:object-to-json-transformer doc:name="Object to JSON"/> 
    <logger message="#[payload]" level="INFO" doc:name="Logger"/> 
</flow> 

및 오류 메시지는 실패로 매핑

응답 코드 (404)이다. 페이로드 : org.glassfish.[email protected] 요소 :/postTaxCollectionFlow/프로세서/1 taxcollection_apisero @ taxcollection_apisero.xml : 23 (웹 서비스) 요소 XML : HTTP : 요청 빌더

구성을 도와주세요

답변

2

http : 요청 커넥터가 잘못된 URL을 구성하고 있기 때문에 404 오류가 발생했습니다. HTTP 요청 커넥터 구성에 MuleSoft documentation에서

:이 논리 URL을 사용

You need to provide a path and method for your requests, as well as reference 
a Connector Configuration global element. Note that the path field doesn’t 
define the full path, but rather the subpath, within the host and after the 
optional base path that can be specified in the Connector Configuration global element. 

당신이 필요 칠 https://api.taxjar.com:443/v2/taxes/https://api.taxjar.com/v2/taxes

0

시도를하다로부터 데이터를 요청하려고하는 코드에 건설되고 Postman/RestClient의 URL을 입력하고 유효한 응답을 제공하는지 확인하십시오. 나는 몇 가지 더미 데이터 posted.It와 흐름을 복제 시도

보인다는 히트

"https://api.taxjar.com/v2/taxes/taxcollection"URL이 우편 배달부로 작동하는 경우 응답

{ 
"error": "Not Found", 
"detail": "No such route 'POST /v2/taxes/taxcollection'", 
"status": "404" 
} 

아래주고있다

그 Mule과 함께해야합니다. 우편 발송자가 아니라 노새가 아닌 경우에는 작동합니다. 요청 데이터를 게시하고 (가능한 경우) 노새 흐름을 전달하십시오. 근본 원인을 파악하는 데 도움이됩니다.

0

Webservice 구성 요소의 경로를 확인하십시오. 호스트와 포트를 이미 지정 했으므로 경로를 완료로 지정할 필요가 없습니다. 경로를 변경하고 응답을 확인하십시오.

0

Jason Estevan의 답변에 완전히 동의합니다. 귀하의 HTTP 아웃 바운드 커넥터의 구성은 다음과 같이해야합니다 :

<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="api.taxjar.com" port="443" doc:name="HTTP Request Configuration"/> 

및 아웃 바운드 커넥터는 다음과 같이해야한다 : 했나 URL의

<http:request config-ref="HTTP_Request_Configuration" path="v2/taxes" method="POST" doc:name="Web Service"> 
     <http:request-builder> 
      <http:query-param paramName="Authorization" value="Token token=&quot;8dbc821e651fe0672c4032e65209b37c&quot;"/> 
      <http:query-param paramName="Content-Type" value="application/json"/> 
     </http:request-builder> 
    </http:request> 

경로에서 유일한 경로는 호스트 이름 & 포트 후 인 와야한다. 이미 호스트 이름 & 포트를 커넥터 구성에 정의 했으므로 경로에 있으면 안됩니다.