2

我创建了以下 WSO2 数据服务器服务。

    <?xml version="1.0" encoding="UTF-8"?>
   <data name="Codelists" serviceGroup="test group" serviceNamespace="********">  
      <description></description>  
      <config id="codelist-DS">    
         <property name="org.wso2.ws.dataservice.driver">com.mysql.jdbc.Driver</property>    
         <property name="org.wso2.ws.dataservice.protocol">jdbc:mysql://localhost:3306/codelists_db</property>    
         <property name="org.wso2.ws.dataservice.user">*****</property>    
         <property name="org.wso2.ws.dataservice.password">*****</property>  
      </config>  
      <query id="getCodeListsSQL" useConfig="codelist-DS">    
         <sql>SELECT CL, MASTER_CL, DESCR, EXTRA1, EXTRA2, EXTRA3, COMMENT FROM CODE_LIST</sql>    
         <result element="codelists" rowName="codelist">      
            <element column="CL" name="number" xsdType="xs:integer"/>      
            <element column="MASTER_CL" name="master-codelist" xsdType="xs:integer"/>      
            <element column="DESCR" name="description" xsdType="xs:string"/>      
            <element column="EXTRA1" name="extra1" xsdType="xs:string"/>      
            <element column="EXTRA2" name="extra2" xsdType="xs:string"/>      
            <element column="EXTRA3" name="extra3" xsdType="xs:string"/>      
            <element column="COMMENT" name="comment" xsdType="xs:string"/>      
            <call-query href="getCodeValueSQL">        
               <with-param column="CL" name="cl"/>      
            </call-query>    
         </result>  
      </query>  
      <query id="getCodeListSQL" useConfig="codelist-DS">    
         <sql>SELECT CL, MASTER_CL, DESCR, EXTRA1, EXTRA2, EXTRA3, COMMENT FROM CODE_LIST WHERE CL=:cl</sql>    
         <result element="codelists" rowName="codelist">      
            <element column="CL" name="number" xsdType="xs:integer"/>      
            <element column="MASTER_CL" name="master-codelist" xsdType="xs:integer"/>      
            <element column="DESCR" name="description" xsdType="xs:string"/>      
            <element column="EXTRA1" name="extra1" xsdType="xs:string"/>      
            <element column="EXTRA2" name="extra2" xsdType="xs:string"/>      
            <element column="EXTRA3" name="extra3" xsdType="xs:string"/>      
            <element column="COMMENT" name="comment" xsdType="xs:string"/>      
            <call-query href="getCodeValueSQL">        
               <with-param name="cl" query-param="cl"/>      
            </call-query>    
         </result>    
         <param name="cl" sqlType="STRING"/>  
      </query>  
      <query id="getCodeValueSQL" useConfig="codelist-DS">    
         <sql>SELECT ID, VALUE, CODE_LIST_NUM, MASTER_VALUE, DESCR, VALUE_ORDER, COMMENT, DISPLAY_TYPE, EXTRA1, EXTRA2, EXTRA3, VALID_FROM, VALID_TO, STATUS_CODE, DATA_SOURCE, LAST_MODIFIED FROM CODE_VALUE WHERE CODE_LIST_NUM=:cl</sql>    
         <result element="items" rowName="item">      
            <element column="ID" name="id" xsdType="xs:integer"/>      
            <element column="VALUE" name="value" xsdType="xs:string"/>      
            <element column="CODE_LIST_NUM" name="codelist-number" xsdType="xs:integer"/>      
            <element column="MASTER_VALUE" name="master-value" xsdType="xs:string"/>      
            <element column="DESCR" name="description" xsdType="xs:string"/>      
            <element column="VALUE_ORDER" name="value-order" xsdType="xs:integer"/>      
            <element column="COMMENT" name="comment" xsdType="xs:string"/>      
            <element column="DISPLAY_TYPE" name="display-type" xsdType="xs:integer"/>      
            <element column="EXTRA1" name="extra1" xsdType="xs:string"/>      
            <element column="EXTRA2" name="extra2" xsdType="xs:string"/>      
            <element column="EXTRA3" name="extra3" xsdType="xs:string"/>      
            <element column="VALID_FROM" name="valid-from" xsdType="xs:date"/>      
            <element column="VALID_TO" name="valid-to" xsdType="xs:date"/>      
            <element column="STATUS_CODE" name="status-code" xsdType="xs:string"/>      
            <element column="DATA_SOURCE" name="data-source" xsdType="xs:date"/>      
            <element column="LAST_MODIFIED" name="last-modified" xsdType="xs:dateTime"/>    
         </result>    
         <param name="cl" sqlType="INTEGER"/>  
      </query>  
      <resource method="GET" path="codelist/{cl}">    
         <call-query href="getCodeListSQL">      
            <with-param name="cl" query-param="cl"/>    
         </call-query>  
      </resource>  
      <resource method="GET" path="codelists">    
         <call-query href="getCodeListsSQL"/>  
      </resource>
   </data>

我想通过 wso2 ESB 使用这个服务。但是我无法让它工作。我应该如何在 ESB 中公开服务以及我应该应用什么类型的安全性?你能给我一些参考指南吗?

我尝试了以下 ESB 配置:

<proxy name="Codelists" transports="https" startOnLoad="true" trace="disable">
    <target>
        <endpoint>
            <address uri="http://localhost:9446/services/Codelists"/>
        </endpoint>
        <outSequence>
            <send/>
        </outSequence>
    </target>
    <publishWSDL uri="https://localhost:9446/services/Codelists?wsdl"/>
    <policy key="conf:/repository/axis2/service-groups/Codelists/services/Codelists/policies/UTOverTransport"/>
    <enableSec/>
</proxy>

但是,当我使用“TryIt”功能时,使用此配置,我会收到授权错误或以下情况:

    [2012-08-02 10:03:50,966]  WARN - ClientHandler I/O error : Connection reset by peer For : 127.0.0.1:9446 For Request : Axis2Request [Message ID : urn:uuid:57d99ccc-9dde-428b-bfdb-73f87276a491] [Status Completed : false] [Status SendingCompleted : true]
[2012-08-02 10:03:50,967]  WARN - EndpointContext Endpoint : endpoint_8196419801b8a9afd598ca65d60b30bbbe9d6abaf3e21ab2 will be marked SUSPENDED as it failed
[2012-08-02 10:03:50,967]  WARN - EndpointContext Suspending endpoint : endpoint_8196419801b8a9afd598ca65d60b30bbbe9d6abaf3e21ab2 - last suspend duration was : 30000ms and current suspend duration is : 30000ms - Next retry after : Thu Aug 02 10:04:20 EEST 2012
4

1 回答 1

1
  • 检查是否可以使用 dataservices tryit ui 尝试创建的数据服务。
  • 如果是这样,您可以简单地创建一个直通代理(不启用安全性)并尝试通过 ESB 调用相同的服务。
  • 如果您想将该代理服务公开为安全服务,您可以简单地启用安全性并从 16 个可用的安全方案中选择一个合适的安全方案。
  • Please refer http://wso2.org/project/esb/java/4.0.3/docs/ for more info
于 2012-08-06T05:22:28.293 回答