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 8523779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:30:26+00:00 2026-06-11T07:30:26+00:00

So I have mapped a WSO2 DSS service through WSO2 ESB. I have generated

  • 0

So I have mapped a WSO2 DSS service through WSO2 ESB. I have generated a jax-ws client and I am using it successfully to get some data.

The problem is that sometimes when I call the client it throws a

Exception in thread "main" java.lang.NullPointerException
at com.sirmaitt.egov.codelist.client.Client.main(Client.java:77)

At that line of the source code I am trying to print the response data in the console.

Here’s the code I’m using to call the service

    // Initialize service
        Codelists_Service service = new Codelists_Service();

        // Adds custom handler so we can add custom SOAP security header.
        service.setHandlerResolver(new HandlerResolver() {
            @SuppressWarnings("rawtypes")
            public List<Handler> getHandlerChain(PortInfo portInfo) {
                List<Handler> handlers = new ArrayList<Handler>();
                handlers.add(new SecuritySOAPHandler());
                return handlers;
            }
        });

        CodelistsPortType port = service.getCodelistsHttpsSoap11Endpoint();

        Codelists codelists = null;
        try {
            codelists = port.getcodelists();
        } catch (DataServiceFault e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        // Prints the response.
        for (Codelist cList : codelists.getCodelist()) {
}

Rest of the project are mainly jax-ws generated classes and one custom SOAPHandler, which I use to add a security header.

The issue is that this same client actually starts working when I log in the WSO2 ESB and click on the service I’ve mapped there. And it throws exception when I don’t use the service for some time.

This issue really puzzles me. What can be the cause of it?

EDIT: Clarification, the code on line 77 is the for loop. It seems the codelists object is null.

EDIT: Here’s the method that adds the security header to the request.

public boolean handleMessage(SOAPMessageContext messageContext) {
    Boolean isOutboundMessage = (Boolean) messageContext
            .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

    if (isOutboundMessage) {
        SOAPPart messageSoapPart = messageContext.getMessage()
                .getSOAPPart();

        WSSecHeader securityHeader = new WSSecHeader();
        securityHeader.insertSecurityHeader(messageSoapPart);

        WSSecUsernameToken usernameToken = new WSSecUsernameToken();

        usernameToken.setPasswordType(WSConstants.PASSWORD_TEXT);
        usernameToken.setUserInfo(USER_NAME, PASSWORD);

        WSSecTimestamp timestamp = new WSSecTimestamp();

        usernameToken.build(messageSoapPart, securityHeader);
        timestamp.build(messageSoapPart, securityHeader);
    }

    return true;
}

And here is what the request looks like (taken from console)

    ---[HTTP request]---
SOAPAction: "urn:_getcodelists"
Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Type: text/xml;charset="utf-8"
<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" S:mustUnderstand="1"><wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-11800260"><wsu:Created>2012-09-18T13:17:56.707Z</wsu:Created><wsu:Expires>2012-09-18T13:22:56.707Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-9299042"><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password></wsse:UsernameToken></wsse:Security></S:Header><S:Body></S:Body></S:Envelope>--------------------
---[HTTP response 202]---
Transfer-encoding: chunked
null: HTTP/1.1 202 Accepted
Connection: keep-alive
Server: Synapse-HttpComponents-NIO
Date: Tue, 18 Sep 2012 13:19:57 GMT
  • 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-11T07:30:28+00:00Added an answer on June 11, 2026 at 7:30 am

    I think it is because your session timed out and you needed to log in again to authenticate the service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m able to get values using JPA when i have only mapped one
I'm using Coldfusion ORM (Hibernate), and have a cfc mapped to a database table.
I have mapped a simple entity, let's say an invoice using Fluent NHibernate, everything
I have a requirement where some data has to be obtained by connecting to
I have mapped classes with custom sql (insert, delete, update) through procedure calls. But,
I am trying to get the data from input xml message using functoids. But
I am using Windows 2003. I have mapped a web application into a virtual
How do you pass data to layers in an n-tier application? I have mapped
I have mapped my inheritance hierarchy in Hibernate using InheritanceType.Single_Table and discriminator columns to
I have mapped a file into memory using mmap . Now I would like

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.