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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:54:42+00:00 2026-05-24T19:54:42+00:00

HI ALL I am trying to expose spring webservice i am facing one problem

  • 0

HI ALL
I am trying to expose spring webservice i am facing one problem My Service Object is not getting initialized
—————End point Class————–

import org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint;

import com.mt.service.CalculatorService;

public abstract class AbstractCalculatorEndpoint  extends AbstractMarshallingPayloadEndpoint  {
    protected CalculatorService calculatorService;

    public void setCalcService(CalculatorService calculatorService) {
        this.calculatorService = calculatorService;
    }

    protected abstract Object invokeInternal(Object request) throws Exception;

}

———–AddNumberEndpoint Class————

    package com.mt.endpoint;

import com.mt.calculator.schema.AddNumberRequest;

public class AddNumberEndpoint extends AbstractCalculatorEndpoint {
    @Override
    protected Object invokeInternal(Object request) throws Exception {
        AddNumberRequest addNumberRequest = (AddNumberRequest) request;
        if( calculatorService==null )
            System.out.println("------------------- I AM NULL    -------    :(   ");
        return calculatorService.addTwoNumber(addNumberRequest.getFirstNumber(),
                addNumberRequest.getSecondNumber());
    }
}

My Servlet Configuration

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/oxm 
    http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd">

    <bean id="calculatorService" class="com.mt.service.CalculatorServiceImpl"
        init-method="initialize" />

    <bean id="Calculator"
        class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
        <property name="schema" ref="schema" />
        <property name="portTypeName" value="Calculator" />
        <property name="locationUri" value="/services" />
        <property name="targetNamespace" value="http://www.mt.com/calculator/schema" />
    </bean>

    <bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
        <property name="xsd" value="/WEB-INF/calculator.xsd" />
    </bean>

    <bean id="validatingInterceptor"
        class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
        <property name="xsdSchema" ref="schema" />
        <property name="validateRequest" value="true" />
        <property name="validateResponse" value="true" />
    </bean>

    <bean id="loggingInterceptor"
        class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />

    <oxm:jaxb2-marshaller id="marshaller"
        contextPath="com.mt.calculator.schema" />
    <oxm:jaxb2-marshaller id="unmarshaller"
        contextPath="com.mt.calculator.schema" />

    <bean id="addNumberEndpoint" class=" com.mt.endpoint.AddNumberEndpoint"
        autowire="byName" />


    <bean name="endpointMapping"
        class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
        <property name="interceptors">
            <list>
                <ref local="loggingInterceptor" />
                <ref local="validatingInterceptor" />
            </list>
        </property>
        <property name="mappings">
            <props>
                <prop key="{http://www.mt.com/calculator/schema}AddNumberRequest">
                    addNumberEndpoint</prop>
            </props>
        </property>
    </bean>

    <bean id="exceptionResolver"
        class="org.springframework.ws.soap.server.endpoint.SoapFaultMappingExceptionResolver">
        <property name="defaultFault" value="SERVER" />
        <property name="exceptionMappings">
            <props>
                <prop key="org.springframework.oxm.ValidationFailureException">CLIENT,Invalid request</prop>
                <prop key="com.mt.service.CalculatorException">SERVER</prop>
            </props>
        </property>
    </bean>
</beans>

Plese Let me know if you need any other information

Thanks A Lot

Thanks A Lot
Previous Exception gone Now I Am Getting
——–

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server</faultcode>
         <faultstring xml:lang="en">JAXB marshalling exception; nested exception is javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: unable to marshal type "java.lang.Integer" as an element because it is missing an @XmlRootElement annotation]</faultstring>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
  • 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-05-24T19:54:45+00:00Added an answer on May 24, 2026 at 7:54 pm

    You are autowiring addNumberEndpoint by name so Spring will look for calcService to bind to it (because of the setter name) but the id of CalculatorService is calculatorService.

    Change setCalcService(...) to setCalculatorService(...) in AbstractCalculatorEndpoint

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

Sidebar

Related Questions

Hey all i am trying to figiure out why my code is not triggering
I have a rather large spring application, and all I'm trying to share is
I'm trying to add a simple REST service to a default Spring MVC Template
I am trying to expose our WCF Web service to both out WPF client
I'm trying to expose a simple WCF REST service using data from Linq to
I am writing a web service to expose certain pieces of data to one
I'm trying to expose a WCF service through both http and net.tcp binding in
Trying to implement a domain service in a SL app and getting the following
I was trying all of yesterday to try and integrate a SQL Database with
I have been trying all afternoon to get the jQuery Sifr Plugin ( http://jquery.thewikies.com/sifr/

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.