0

I am trying to consume service created on 'WSO2 Data service server’ into a local .NET Client (Windows application). I am able to communicate with the service(I was able to list of operations those Service provides). But when I try invoking a method application throws following error.

The XML element 'ABCD' from namespace 'XYZ' references a method and a type. Change the method's message name using WebMethodAttribute or change the type's root element using the XmlRootAttribute.

I just added service reference to Windows application through visual studio and tried invoking method

Could anyone give step by step process to fix above issue?

tk_
  • 16,415
  • 8
  • 80
  • 90

2 Answers2

0

This happens when you use the same name for operations and elements in your Data Service configuration. The proxy gets created in VS when you add a service reference cannot distinguish between the type and the method. Could you try giving different names for operations and other XML attributes in your Data Service configuration? If it still doesn't work please post your Data Service configuration.

0

is there a solution other than giving different names to resultsets?

If I have 3 methods in a web service and all of them export the same

Then it feels unnatural to me to rename them to Customers1, Customers2 and Customers3 for example

Here is my sample which causes problems in .NET because there are 3 methods all returning Entries->Entry

<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/yyy@10.10.10.10: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>
Sava
  • 142
  • 1
  • 9