1

我从我的客户端获得了一个 REST URI,如下所示:

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>jane@doe.com</email>
                          <firstName>Jane</firstName>
                          <lastName>Doe</lastName>
                       </enquiree>
                       <enquirer>
                          <organisation>BBC</organisation>
                          <contactName>Jeremy Clarkson</contactName>
                       </enquirer>
                       <documentRequested>HEAR</documentRequested>
                    </body>
                </documentAccessRequest>

现在我需要在 WSO2 ESB 4.6.0 中创建自己的包装 REST API,它会简单地调用上述具有相同请求和响应 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 根本不工作,它在 esb 控制台中给出了很多错误。我正在使用 SOAPUI 来测试这个 REST 服务并从那里发布相同的请求 xml。该服务部署在我们的公共IP服务器上,可以通过登录以下来查看

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

我尝试将 SOAPUI 中的媒体类型设置为 text/xml 和 application/xml

在 text/xml 的情况下,它会给出如下错误:

org.apache.axiom.soap.SOAPProcessingException: First Element 必须包含本地名称 Envelope ,但在 org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305) 找到 documentAccessResponse

如果是应用程序/xml,则会出现以下错误

INFO - LogMediator 收件人:http ://www.w3.org/2005/08/addressing/anonymous,WSAction:,SOAPAction:,MessageID:urn:uuid:53a782ab-2081-4cb1-9e94-910b75816361,方向:响应 [2013 -04-10 16:05:12,911] 错误 - PassThroughHttpSender 无法提交响应 java.lang.UnsupportedOperationException

请帮助我解决这个问题,因为它对我来说非常重要。

在此先感谢 Shakshi

4

1 回答 1

0

您可以将传输切换到非阻塞传输并检查吗?您可以在axis2.xml 中更改传输发送方和接收方。媒体类型是 application/xml ..不是 text/xml,它用于肥皂请求。

要发布请求,您可以使用 curl 实用程序。

# curl -X POST -d @request.xml "URL"
于 2013-04-10T16:53:46.573 回答