I have a wso2esb4.8.1 with features for wso2DSS. i have generate web service inthis url:
http://ec2-54-221-93-14.compute-1.amazonaws.com:9764/services/wsuaecd?tryit#
this is the xml for the web service
<data name="wsuaecd" serviceNamespace="Wsuaecd">
<config id="default">
<property name="carbon_datasource_name">UAECD</property>
</config>
<query id="select_with_key_bd_direccion_uaecd_query" useConfig="default">
<sql>SELECT id_direccion, tipo_identificacion, identificacion, nombre_propietario, primer_apellido, segundo_apellido, direccion_real, cod_barrio, nombre_barrio, cod_localidad, nombre_localidad, cod_upz, nombre_upz, cod_estrato, chip FROM public.bd_direccion_uaecd WHERE id_direccion=?</sql>
<sql dialect="postgresql">SELECT id_direccion, tipo_identificacion, identificacion, nombre_propietario, primer_apellido, segundo_apellido, direccion_real, cod_barrio, nombre_barrio, cod_localidad, nombre_localidad, cod_upz, nombre_upz, cod_estrato, chip FROM public.bd_direccion_uaecd WHERE id_direccion=?</sql>
<result element="bd_direccion_uaecdCollection" rowName="bd_direccion_uaecd">
<element column="id_direccion" name="id_direccion" xsdType="xs:long"/>
<element column="tipo_identificacion" name="tipo_identificacion" xsdType="xs:string"/>
<element column="identificacion" name="identificacion" xsdType="xs:string"/>
<element column="nombre_propietario" name="nombre_propietario" xsdType="xs:string"/>
<element column="primer_apellido" name="primer_apellido" xsdType="xs:string"/>
<element column="segundo_apellido" name="segundo_apellido" xsdType="xs:string"/>
<element column="direccion_real" name="direccion_real" xsdType="xs:string"/>
<element column="cod_barrio" name="cod_barrio" xsdType="xs:string"/>
<element column="nombre_barrio" name="nombre_barrio" xsdType="xs:string"/>
<element column="cod_localidad" name="cod_localidad" xsdType="xs:long"/>
<element column="nombre_localidad" name="nombre_localidad" xsdType="xs:string"/>
<element column="cod_upz" name="cod_upz" xsdType="xs:string"/>
<element column="nombre_upz" name="nombre_upz" xsdType="xs:string"/>
<element column="cod_estrato" name="cod_estrato" xsdType="xs:long"/>
<element column="chip" name="chip" xsdType="xs:string"/>
</result>
<param name="id_direccion" ordinal="1" sqlType="BIGINT"/>
</query>
<query id="select_all_bd_direccion_uaecd_query" useConfig="default">
<sql>SELECT id_direccion, tipo_identificacion, identificacion, nombre_propietario, primer_apellido, segundo_apellido, direccion_real, cod_barrio, nombre_barrio, cod_localidad, nombre_localidad, cod_upz, nombre_upz, cod_estrato, chip FROM public.bd_direccion_uaecd</sql>
<properties>
<property name="forceJDBCBatchRequests">false</property>
<property name="maxRows">100</property>
</properties>
<sql dialect="postgresql">SELECT id_direccion, tipo_identificacion, identificacion, nombre_propietario, primer_apellido, segundo_apellido, direccion_real, cod_barrio, nombre_barrio, cod_localidad, nombre_localidad, cod_upz, nombre_upz, cod_estrato, chip FROM public.bd_direccion_uaecd</sql>
<result element="bd_direccion_uaecdCollection" rowName="bd_direccion_uaecd">
<element column="id_direccion" name="id_direccion" xsdType="xs:long"/>
<element column="tipo_identificacion" name="tipo_identificacion" xsdType="xs:string"/>
<element column="identificacion" name="identificacion" xsdType="xs:string"/>
<element column="nombre_propietario" name="nombre_propietario" xsdType="xs:string"/>
<element column="primer_apellido" name="primer_apellido" xsdType="xs:string"/>
<element column="segundo_apellido" name="segundo_apellido" xsdType="xs:string"/>
<element column="direccion_real" name="direccion_real" xsdType="xs:string"/>
<element column="cod_barrio" name="cod_barrio" xsdType="xs:string"/>
<element column="nombre_barrio" name="nombre_barrio" xsdType="xs:string"/>
<element column="cod_localidad" name="cod_localidad" xsdType="xs:long"/>
<element column="nombre_localidad" name="nombre_localidad" xsdType="xs:string"/>
<element column="cod_upz" name="cod_upz" xsdType="xs:string"/>
<element column="nombre_upz" name="nombre_upz" xsdType="xs:string"/>
<element column="cod_estrato" name="cod_estrato" xsdType="xs:long"/>
<element column="chip" name="chip" xsdType="xs:string"/>
</result>
</query>
<operation name="select_with_key_bd_direccion_uaecd_operation">
<call-query href="select_with_key_bd_direccion_uaecd_query">
<with-param name="id_direccion" query-param="id_direccion"/>
</call-query>
</operation>
<operation name="select_all_bd_direccion_uaecd_operation">
<call-query href="select_all_bd_direccion_uaecd_query"/>
</operation>
</data>
The response for the queries with parameters is:
<axis2ns104:DataServiceFault xmlns:axis2ns104="http://ws.wso2.org/dataservice">DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:id_direccion
</axis2ns104:DataServiceFault>
does anyone has thesame issue? ithink is related with the configuration, but im pretty new in wso2 .
thanks in advanced.
Your question feels similiar to my question.
Data Service fails when deployed with ESB
If our questions are the same then you will be able to solve your problem by simply using DSS and not ESB together.
Create an instance with DSS only and verify this resolves your issue.
Related
whenever i am giving any special character to a variable, it throws below error.
element Type: Schemas validity error : Element Type': '&' is not a valid value of the atomic type 'xs:Name'.
It accepts only colon (:).
Below is my schema.
<element name="measCollecFile">
<complexType>
<sequence>
<choice>
<element name="Types">
<simpleType>
<list itemType="Name"/>
</simpleType>
</element>
<element name="Type"
minOccurs="0" maxOccurs="unbounded">
<complexType>
<simpleContent>
<extension base="Name">
<attribute name="p"
type="positiveInteger" use="required"/>
</extension>
</simpleContent>
</complexType>
</element>
</choice>
</sequence>
</complexType>
</element>
Can anyone help me for finding from where this error is coming and how to get rid of it..
You have some invalid XML, which you haven't shown us. It's invalid because your schema requires some element to have a value that is a valid instance of xs:Name, and a valid instance of xs:Name cannot contain an ampersand.
I have a problem with for xsl:foreach and the select xpath
<LIST>
<ELEMENT name="QX25">
<ELEMENT name="QX55A" value="1" />
<ELEMENT name="QX55B" value="2" />
<ELEMENT name="QX55C" value="xyz" />
<ELEMENT name="QX55D" value="dzy" />
</ELEMENT>
<ELEMENT name="QX55">
<ELEMENT name="QX55A" value="1" />
<ELEMENT name="QX55B" value="2" />
<ELEMENT name="QX55C" value="xyz" />
<ELEMENT name="QX55D" value="dzy" />
</ELEMENT>
<ELEMENT name="QX55">
<ELEMENT name="QX55A" value="2" />
<ELEMENT name="QX55B" value="1" />
<ELEMENT name="QX55C" value="dzy" />
<ELEMENT name="QX55D" value="xyz" />
<ELEMENT name="QX55E" value="X" />
</ELEMENT>
<ELEMENT name="QX55">
<ELEMENT name="QX55A" value="3" />
<ELEMENT name="QX55B" value="2" />
<ELEMENT name="QX55C" value="xyz" />
<ELEMENT name="QX55E" value="X" />
</ELEMENT>
<ELEMENT name="QX55">
<ELEMENT name="QX55A" value="4" />
<ELEMENT name="QX55B" value="3" />
<ELEMENT name="QX55C" value="xyz" />
<ELEMENT name="QX55E" value="P" />
</ELEMENT>
</LIST>
I want to get all the LIST/ELEMENT with name QX55 that DO NOT have a child ELEMENT which name="QX55E" and value="X".
any other value is fine as well as not having a child ELEMENT with name="QX55E" at all.
This means I would like to have the following result:
<ELEMENT name="QX55">
<ELEMENT name="QX55A" value="1" />
<ELEMENT name="QX55B" value="2" />
<ELEMENT name="QX55C" value="xyz" />
<ELEMENT name="QX55D" value="dzy" />
</ELEMENT>
<ELEMENT name="QX55">
<ELEMENT name="QX55A" value="4" />
<ELEMENT name="QX55B" value="3" />
<ELEMENT name="QX55C" value="xyz" />
<ELEMENT name="QX55E" value="P" />
</ELEMENT>
what I have tried:
<xsl:for-each select="/LIST/ELEMENT[#name='QX55']/ELEMENT[not(#name='QX55E' and #value='X')]/../.">
Can anyone help?
Use the path /LIST/ELEMENT[#name='QX55'][not(ELEMENT[#name = 'QX55E' and #value = 'X' ])].
You could use the count() function:
<xsl:for-each select=" /LIST/ELEMENT[ #name='QX55' and count( ELEMENT[ #name='QX55E' and #value='X' ] ) = 0 ] " >
I have created a simple Data Service using wso2 dss as follows.
Query : SELECT id, key, value, description FROM dbo.configs where key like '%:filter%'
Final XML :
<query id="select_all_configs_like_query" useConfig="default">
<sql>SELECT id, key, value, description FROM dbo.configs where key like '%:filter%' </sql>
<result element="configsCollection" rowName="configs">
<element column="id" name="id" xsdType="xs:integer"/>
<element column="key" name="key" xsdType="xs:string"/>
<element column="value" name="value" xsdType="xs:string"/>
<element column="description" name="description" xsdType="xs:string"/>
</result>
<param name="filter" sqlType="QUERY_STRING"/>
</query>
<operation name="select_all_configs_like_operation">
<call-query href="select_all_configs_like_query">
<with-param name="filter" query-param="filter"/>
</call-query>
</operation>
When I invoke the service it responds with an empty response. No Error on the console. Once I checked the database history, query is recorded as below
SELECT id, key, value, description FROM dbo.configs where key like '%:filter%'
Looks like parameter is not assigned to the actual query. Any Help?
You can use the Concat function within the SQL statement so for example CONCAT('%',:filter,'%')
Using wso2, DSS version 3.01, I am trying to have an input parameter that could be an optional parameter. A user can say, give me all the info for this specific code, or if a user does not specify any code, I want to give all the rows of data. Can you help?
Instead of creating a query for each optional parameter, you can also do the following:
<query id="selectEmployees" useConfig="default">
<sql>select * from Employees where (:employeeNumber is null or employeeNumber = :employeeNumber)</sql>
<result element="employees" rowName="employee">
<element column="lastName" name="last-name" xsdType="string"/>
<element column="firstName" name="first-name" xsdType="string"/>
<element column="email" name="email" xsdType="string"/>
<element column="salary" name="salary" xsdType="double"/>
</result>
<param defaultValue="#{NULL}" name="employeeNumber" ordinal="1" paramType="SCALAR" sqlType="INTEGER" type="IN"/>
</query>
<operation name="getEmployees">
<call-query href="selectEmployees">
<with-param name="employeeNumber" query-param="employeeNumber"/>
</call-query>
</operation>
Now you can call 'getEmployees' with 'employeeNumber' and get specific employee,
or you can call 'getEmployees' without 'employeeNumber' and get all employees.
(Calling without 'employeeNumber' is by omitting the 'employeeNumber' tag, or using 'xsi:nil="true"'.)
Obviously, you cannot query for the value 'null' this way.
ok soo for example
<query id="employeesByNumberSQL" useConfig="default">
<sql>select * from Employees where employeeNumber = ?</sql>
<result element="employees" rowName="employee">
<element column="lastName" name="last-name" xsdType="string"/>
<element column="firstName" name="first-name" xsdType="string"/>
<element column="email" name="email" xsdType="string"/>
<element column="salary" name="salary" xsdType="double"/>
</result>
<param name="employeeNumber" ordinal="1" paramType="SCALAR" sqlType="INTEGER" type="IN"/>
select * from Employees
You have two queries employeesByNumberSQL, employeesByNumberSQL1 these two are mapped togetemployeesByNumber and getemployeesByNumber2
Well you can make input parameters optional by giving default values to the input parameters. For example
<query id="MyQ" useConfig="myDS">
<sql>select cust_id,name from customer where cust_id = ?</sql>
<result element="Entries" rowName="Entry">
<element column="cust_id" name="cust_id" xsdType="string"/>
<element column="name" name="name" xsdType="string"/>
</result>
<param defaultValue="1" name="cust_id" sqlType="INTEGER"/>
</query>
Here if you do not mention the input parameters it will take the input parameter as one. Or else you need to create two queries and handle them programmatically
I have a source which has a element personOrBusiness
<xsd:element name="personOrBusiness" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="business"/>
<xsd:enumeration value="person"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
I want this to be mapped to FirmOrPerson any idea what xslt map should i write.
<element name="ContactParty">
<complexType>
<sequence>
<element name="Language" type="string"/>
<element name="Service" type="string"/>
<element name="ContactRole" type="string"/>
<element name="FirmOrPerson" type="string"/>
<element name="Address" minOccurs="0">
<complexType>
<sequence>
<element name="Street" type="string"/>
<element name="HouseNumber" type="int"/>
<element name="Box" type="string"/>
<element name="City" type="string"/>
<element name="ZIPCode" type="int"/>
<element name="State" type="string"/>
<element name="Region" type="string"/>
<element name="Country" type="string"/>
<element name="isInCityLimit" type="boolean"/>
</sequence>
</complexType>
</element>
<choice>
<element name="Firm">
<complexType>
<sequence>
<element name="legalForm" type="string"/>
<element name="legalName" type="string"/>
<element name="EnterpriseNumber" type="string"/>
<element name="NACEcode" type="string"/>
</sequence>
</complexType>
</element>
<element name="Person">
<complexType>
<sequence>
<element name="Title" type="string"/>
<element name="LastName" type="string"/>
<element name="firstName" type="string"/>
<element name="NationalRegistrationNumber" type="string"/>
<element name="PhoneType" type="string"/>
<element name="Phone" type="string"/>
</sequence>
</complexType>
</element>
</choice>
</sequence>
</complexType>
</element>
Google for xsl:choose and xsl:element
http://www.w3schools.com/xsl/el_choose.asp
http://www.w3schools.com/XSL/el_element.asp