2013-04-10 63 views
1

我已經從我的客戶給予了REST URI是如下:WSO2寧靜的API

https://vm3.digitary.net/verifier/HEDDRequestDocumentAccess

以下請求XML已經被張貼到上述URI獲得響應XML。

<documentAccessRequest xmlns="http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013 http://www.digitary.net/schema/dare/hedd/documentAccessRequest/2013"> 
        <head> 
        <institutionCode>BBCU</institutionCode> 
        <username>HEDDUser</username> 
        <password>HEDDPass</password> 
        </head> 
        <body> 
         <heddEnquiryId>12347895844</heddEnquiryId> 
         <enquiree> 
          <email>[email protected]</email> 
          <firstName>Jane</firstName> 
          <lastName>Doe</lastName> 
         </enquiree> 
         <enquirer> 
          <organisation>BBC</organisation> 
          <contactName>Jeremy Clarkson</contactName> 
         </enquirer> 
         <documentRequested>HEAR</documentRequested> 
        </body> 
       </documentAccessRequest> 

現在我必須使自己的包裝REST API在WSO2 ESB 4.6.0這將只需調用具有相同的請求和響應XML上述REST URI的要求。這個想法是通過REST API傳遞給上面提到的API。

我已實現了以下REST API:

<api xmlns="http://ws.apache.org/ns/synapse" name="TestDareRest" context="/documentRequest" hostname="46.137.187.137" port="8280"> 
    <resource methods="POST" url-mapping="/request/*"> 
     <inSequence> 
     <log/> 
     <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/> 
     <send> 
      <endpoint> 
       <address uri="https://vm3.digitary.net/verifier/HEDDRequestDocumentAccess" format="pox"/> 
      </endpoint> 
     </send> 
     </inSequence> 
     <outSequence> 
     <log/> 
     <property name="ContentType" value="application/xhtml+xml" scope="axis2"/> 
     <send/> 
     </outSequence> 
    </resource> 
</api> 

但上述API完全不工作,它是gving錯誤的負載在ESB控制檯。我使用SOAPUI來測試這個REST服務並從那裏發佈相同的請求xml。該服務部署我們的公網IP的服務器上,並且可以通過登錄中可以看出以下

https://46.137.187.137:9443/carbon/admin/index.jsp with username/pwd as admin/admin 

我試圖爲文本/ xml和application/XML

在SOAPUI同時設置媒體類型在文本的情況下,/XML它如下是給錯誤:

org.apache.axiom.soap.SOAPProcessingException:第一個元素必須包含本地名,信封,卻發現documentAccessResponse 在org.apache.axiom.soap.impl.builder。 StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)

在應用/ XML的情況下,它是給以下錯誤

INFO - LogMediator到:http://www.w3.org/2005/08/addressing/anonymous,WSAction:,的SOAPAction:,郵件ID:甕:UUID:53a782ab-2081-4cb1-9e94-910b75816361,方向:響應 [2013年4月10日16:05:12911]錯誤 - PassThroughHttpSender無法提交響應 java.lang.UnsupportedOperationException

請幫我解決這個問題,因爲它已經得到了我很多的關鍵。

由於提前 Shakshi

回答

0

你能切換到交通運輸非阻塞檢查? 您可以更改axis2.xml中的傳輸發送者和接收者。 媒體類型是應用程序/ xml ..而不是來自soap請求的text/xml。

要發佈請求,您可以使用捲曲工具。

# curl -X POST -d @request.xml "URL" 
+0

我做了你所建議的,現在傳輸是非阻塞的,因爲你可以在ESB啓動日誌中看到meesage。 INFO - HttpCoreNIOListener HTTP監聽器在端口8280上啓動。但是我的REST API不工作,現在它給出錯誤ERROR - HttpCoreNIOSender org.apache.http.ProtocolException:傳輸編碼頭已經存在(Synapse可能試圖發送一個確切的反應不止一次) – ShakshiS 2013-04-11 11:55:53