2012-05-10 202 views
0

我試圖將'WSO2數據服務服務器'上創建的服務轉換爲本地.NET客戶端(Windows應用程序)。我能夠與服務進行通信(我能夠列出這些服務提供的操作)。但是,當我嘗試調用方法應用程序拋出以下錯誤。在C#.Net中使用WSO2數據服務Windows應用程序

命名空間'XYZ'中的XML元素'ABCD'引用了一個方法和一個類型。使用WebMethodAttribute更改方法的消息名稱,或使用XmlRootAttribute使用 更改類型的根元素。

我通過Visual Studio剛剛添加的服務參考Windows應用程序,並試圖調用方法

誰能給循序漸進的過程來解決上述問題?

回答

0

當您在數據服務配置中對操作和元素使用相同的名稱時,會發生這種情況。在添加服務引用時,代理將在VS中創建,無法區分類型和方法。您可以嘗試爲數據服務配置中的操作和其他XML屬性賦予不同的名稱嗎?如果仍不起作用,請發佈您的數據服務配置。

0

是否有解決方案,而不是給結果集不同的名稱?

如果我有一個Web服務3種方法,他們都輸出相同

然後感覺不自然的我給他們重命名爲Customers1,Customers2和Customers3例如

這裏是我的樣本這在.NET中導致問題,因爲有3種方法都返回條目 - >條目

<data name="ws_getSubnoCCInfo" serviceNamespace="com.test.ws"> 
    <config id="tro"> 
     <property name="driverClassName">oracle.jdbc.driver.OracleDriver</property> 
     <property name="url">jdbc:oracle:thin:xxx/[email protected]:1521/DB</property> 
     <property name="username">xxx</property> 
     <property name="password">yyy</property> 
    </config> 
    <query id="subnoHasCCSQL" useConfig="tro"> 
     <sql>select case when count(*) &gt; 0 then 'OK' else 'NOK' end hasCC from ccinfo where subno = :subno</sql> 
     <result element="Entries" rowName="Entry"> 
     <element column="hasCC" name="hasCC" xsdType="string"/> 
     </result> 
     <param name="subno" sqlType="STRING"/> 
    </query> 
    <query id="idNoHasCCSQL" useConfig="tro"> 
     <sql>select case when count(*) &gt; 0 then 'OK' else 'NOK' end hasCC from ccinfo cc, tabs.crm_departement ui where cc.contrno = ui.contrno and ui.id_no = :id_no</sql> 
     <result element="Entries" rowName="Entry"> 
     <element column="hasCC" name="hasCC" xsdType="string"/> 
     </result> 
     <param name="id_no" sqlType="STRING"/> 
    </query> 
    <query id="contrnoHasCCSQL" useConfig="tro"> 
     <sql>select case when count(*) &gt; 0 then 'OK' else 'NOK' end hasCC from ccinfo cc where contrno = :contrno</sql> 
     <result element="Entries" rowName="Entry"> 
     <element column="hasCC" name="hasCC" xsdType="string"/> 
     </result> 
     <param name="contrno" sqlType="STRING"/> 
    </query> 
    <operation name="subnoHasCC"> 
     <call-query href="subnoHasCCSQL"> 
     <with-param name="subno" query-param="subno"/> 
     </call-query> 
    </operation> 
    <operation name="idNoHasCC"> 
     <call-query href="idNoHasCCSQL"> 
     <with-param name="id_no" query-param="id_no"/> 
     </call-query> 
    </operation> 
    <operation name="contrnoHasCC"> 
     <call-query href="contrnoHasCCSQL"> 
     <with-param name="contrno" query-param="contrno"/> 
     </call-query> 
    </operation> 
</data> 
相關問題