Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7897487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:10:44+00:00 2026-06-03T08:10:44+00:00

I have a simple query select t.firstname, t.lastname, t.zipcode, t.city from name_data t where

  • 0

I have a simple query

select t.firstname, t.lastname, t.zipcode, t.city 
from name_data t where name_id = ?

The ‘?’ is the input parameter and is never null.

The query returns a record looking like one of these:

Case 1 – Individual

 'First Name'   'Last Name'     'zipcode'   'city'
 -------------------------------------------------------
 John           Doe             1177        Somewhere

Case 2 – Company

 'First Name'   'Last Name'     'zipcode'   'city'
 -----------------------------------------------------------
 <<null>>       ACME Ltd        1199        'Somewhere else'

When I am getting the second record, The DSS throw a NullPointerException.

I guess this is because the <> value in Firstname and I found a way to bypass this by testing the null value in the SQL (Oracle)

“select nvl(t.firstname, ‘ ‘) firstname, nvl(t.lastname, ‘ ‘), lastname, nvl(t.zipcode, ‘ ‘), nvl(t.city, ‘ ‘) etc…”

And this for all columns which can be null (my query is a bit longer than this) as they are optionnal.

I know this should not happens (in theory) if the database was correctly designed (like create two different entities for managing people and companies)
but it is a commercial product and then I just cannot change it and I took a simple case to explain instead a long query.

The extract of my .dbs is:

<?xml version="1.0" encoding="UTF-8"?>
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="http:///org/wso2/carbonstudio/eclipse/ds" 
    name="${groupId}.${artifactId}-customeraddress-1" 
    serviceNamespace="urn:customeraddress.database.mycompany.org/1" 
    serviceGroup="${groupId}" baseURI="">
  <description>This is the datasource to access the customer address information</description>
  <config id="ambocs">
    <property name="org.wso2.ws.dataservice.driver">@ambocs.driver@</property>
    <property name="org.wso2.ws.dataservice.protocol">@ambocs.url@</property>
    <property name="org.wso2.ws.dataservice.user">@ambocs.user@</property>
    <property name="org.wso2.ws.dataservice.password">@ambocs.password@</property>
    <property name="org.wso2.ws.dataservice.minpoolsize">@ambocs.minpoolsize@</property>
    <property name="org.wso2.ws.dataservice.maxpoolsize">@ambocs.maxpoolsize@</property>
    <property name="org.wso2.ws.dataservice.validation_query">select 1 from dual</property>
  </config>
  <query id="getCustomerAddressByIdRef" useConfig="ambocs" returnRowId="true">
    <sql>
        select 
            nvl(nd.first_name, ' ') first_name, 
            nvl(nd.last_name, ' ') last_name,
            nvl(nd.adr_zip, ' ') zipcode,
            nvl(nd.adr_city, ' ') city, 
            nvl(nd.adr_country, ' ') country 
        from name_data nd
        where nd.name_id = ?
    </sql>
    <properties>
      <property name="org.wso2.ws.dataservice.query_timeout"></property>
      <property name="org.wso2.ws.dataservice.fetch_direction"></property>
      <property name="org.wso2.ws.dataservice.fetch_size"></property>
      <property name="org.wso2.ws.dataservice.max_field_size"></property>
      <property name="org.wso2.ws.dataservice.max_rows"></property>
    </properties>
    <result element="ContactDetails" rowName="ContactDetail" 
       defaultNamespace="urn:customeraddress.database.mycompany.org/1" outputType="xml">
      <attribute name="firstName" column="first_name" query-param="" requiredRoles="" xsdType="xs:string"/>
      <attribute name="lastName" column="last_business_name" query-param="" requiredRoles="" xsdType="xs:string"/>
      <attribute name="locality" column="city" query-param="" requiredRoles="" xsdType="xs:string"/>
      <attribute name="postcode" column="zipcode" query-param="" requiredRoles="" xsdType="xs:string"/>
      <attribute name="country" column="country" query-param="" requiredRoles="" xsdType="xs:string"/>      
    </result>
    <param name="nameId" type="IN" sqlType="STRING" defaultValue="" />
  </query>
  <operation name="getCustomerAddressById">
    <call-query href="getCustomerAddressByIdRef">
        <with-param name="nameId" column="nameId" query-param="nameId"/>
    </call-query>
  </operation>
</data>

Do you know if there is an option to put in the .dbs in order to manage the null value returned by the query?

I tried to find a documentation on the wso2.org but it is very simple examples and nothing about this case.

UPDATE
Here the table schema:

CREATE TABLE "NAME_DATA"
(
    "NAME_ID"               NUMBER(9,0) CONSTRAINT "PK_NAME_ID" NOT NULL ENABLE,
    "SYS_CREATION_DATE"     DATE NOT NULL ENABLE,
    "SYS_UPDATE_DATE"       DATE,
    "LAST_NAME"             VARCHAR2(60),
    "FIRST_NAME"            VARCHAR2(32),
    "ZIP_CODE"              VARCHAR2(4),
    "CITY"                  VARCHAR2(255),
    "COUNTRY"               CHAR(3 BYTE),
    CONSTRAINT "NAME_DATA_PK" PRIMARY KEY ("NAME_ID")
) 

CREATE UNIQUE INDEX "NAME_DATA_PK" ON "NAME_DATA" ("NAME_ID")
CREATE INDEX "IDX_NAME_DATA_1" ON "NAME_DATA"("LAST_NAME","FIRST_NAME")
CREATE INDEX "IDX_NAME_DATA_2" ON "NAME_DATA"(UPPER("FIRST_NAME"))
CREATE INDEX "IDX_NAME_DATA_3" ON "NAME_DATA"(UPPER("LAST_NAME"))

UPDATE 2 – stacktrace:

TID: [0] [WSO2 Data Services Server] [2012-03-27 14:02:22,730] ERROR {org.apache.axis2.transport.http.AxisServlet} -   {org.apache.axis2.transport.http.AxisServlet}
java.lang.NullPointerException
    at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteAttr(BaseNsStreamWriter.java:468)
    at com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute(BaseNsStreamWriter.java:230)
    at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeAttribute(XMLStreamWriterWrapper.java:88)
    at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeAttribute(MTOMXMLStreamWriter.java:230)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.writeXMLEvent(DSWrappedXMLStreamWriter.java:418)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.writeOutInitialXMLEvents(DSWrappedXMLStreamWriter.java:508)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.finalizeBuffering(DSWrappedXMLStreamWriter.java:501)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.flush(DSWrappedXMLStreamWriter.java:145)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:102)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
    at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
    at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:563)
    at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
    at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
    at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
    at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:409)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:199)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.wso2.carbon.bridge.BridgeServlet.service(BridgeServlet.java:164)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.wso2.carbon.server.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:154)
    at org.wso2.carbon.server.TomcatServer$1.invoke(TomcatServer.java:254)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
    at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
TID: [0] [WSO2 Data Services Server] [2012-03-27 14:02:22,730] ERROR {org.apache.axis2.transport.http.AxisServlet} -   {org.apache.axis2.transport.http.AxisServlet}
java.lang.NullPointerException
    at com.ctc.wstx.sw.BaseNsStreamWriter.doWriteAttr(BaseNsStreamWriter.java:468)
    at com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute(BaseNsStreamWriter.java:230)
    at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeAttribute(XMLStreamWriterWrapper.java:88)
    at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeAttribute(MTOMXMLStreamWriter.java:230)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.writeXMLEvent(DSWrappedXMLStreamWriter.java:418)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.writeOutInitialXMLEvents(DSWrappedXMLStreamWriter.java:508)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.finalizeBuffering(DSWrappedXMLStreamWriter.java:501)
    at org.wso2.carbon.dataservices.core.engine.DSWrappedXMLStreamWriter.flush(DSWrappedXMLStreamWriter.java:145)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:102)
    at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:110)
    at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
    at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:563)
    at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)
    at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
    at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
    at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
    at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:409)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:286)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443)
    at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:199)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.wso2.carbon.bridge.BridgeServlet.service(BridgeServlet.java:164)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.wso2.carbon.server.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:154)
    at org.wso2.carbon.server.TomcatServer$1.invoke(TomcatServer.java:254)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
    at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

For testing this, you have to remove all “nvl(…)” in the DBS otherwise it is working well. It was a record where the first_name was “null”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:10:45+00:00Added an answer on June 3, 2026 at 8:10 am

    This issue occurs when you use “attribute” type output-mappings in your result set. Here is the Jira created for it.

    As a workaround, you can use columns as elements rather than as attributes, it can deal with null values properly.

    i.e in above provided dbs file, use the result set as follows.

    <result element="ContactDetails" rowName="ContactDetail" 
       defaultNamespace="urn:customeraddress.database.mycompany.org/1" outputType="xml">
      <element name="firstName" column="first_name" query-param="" requiredRoles="" xsdType="xs:string"/>
      <element name="lastName" column="last_business_name" query-param="" requiredRoles="" xsdType="xs:string"/>
      <element name="locality" column="city" query-param="" requiredRoles="" xsdType="xs:string"/>
      <element name="postcode" column="zipcode" query-param="" requiredRoles="" xsdType="xs:string"/>
      <element name="country" column="country" query-param="" requiredRoles="" xsdType="xs:string"/>      
    </result>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple query in php on oracle: $query='select u.username,u.lastname,u.firstname,c.event,c.reason from users u,
I have this simple query: SELECT xObjectID, xObjectName FROM dbo.xObject where CONTAINS( xObjectRef, '1838
I have following rather simple query select count(*) from tbl t1, tbl t2 For
I have a simple SQL query: Select ID, COUNT(ID) as Selections, OptionName, SUM(Units) as
I have a very simple query $this->db->select('id, title'); $this->db->order_by('id', 'DESC'); $query = $this->db->get('journal'); foreach($query->result()
Does DISTINCT in a simple query with an aggregate function have any effect? select
I have a very simply query like this: SELECT users.id, COUNT(others.id) as c FROM
I have this query: SELECT * FROM sample INNER JOIN test ON sample.sample_number =
I have a simple query: $query = new WP_Query('showposts=5'); that will obviously display 5
I have a simple query which is returning records based on the field status

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.