Spring WebService with Endpoint vs no Endpoint

ぃ、小莉子 提交于 2019-12-24 07:13:00

问题


I need to create a client application for consuming SOAP services. I need to create the client apps from 2 wsdl (from 2 different server applications too)

Here's the code for the first Web Service

EcommPromoWebService.java

package com.ptdam.promo.webservices;

import javax.jws.WebService;

@WebService
public interface EcommPromoWebService {
    String sayHi(String text);
    EcommPromoResponse inquiryPromo(EcommPromoRequest promoInquiryRequest);
}

EcommPromoWebServiceImpl.java

package com.ptdam.promo.webservices;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import javax.jws.WebService;

import com.ptdam.promo.utils.C3p0ConnectionPool;

@WebService(endpointInterface="com.ptdam.promo.webservices.EcommPromoWebService")
public class EcommPromoWebServiceImpl implements EcommPromoWebService {

    @Override
    public String sayHi(String text) {  
        System.out.println("sayHi called");
        return "Hello, " + text;
    }

    @Override
    public EcommPromoResponse inquiryPromo(EcommPromoRequest promoInquiryRequest) {
        EcommPromoResponse response = new EcommPromoResponse();
        Connection connInquiry = null;
// and any other stuffs
}

and here's the code for the second web service: TopupWebService.java

package ptdam.emoney.webservice.transactions;
@WebService
public interface TopupWebService {

    @Permission(ServiceOperation.MANAGE_MEMBERS)
    @WebMethod
    @WebResult(name = "echoTestResult")
    String echoTest(@WebParam(name = "tx") String tx);

    @Permission(ServiceOperation.MANAGE_MEMBERS)
    @WebMethod
    @WebResult(name = "inquiryResult")
    TopupInquiryResponse inquiry(@WebParam(name = "request") TopupInquiryRequest request);

// and any other stuffs

TopUpWebserviceImpl.java

package ptdam.emoney.webservice.transactions;
@WebService(name = "emoneytopup", serviceName = "emoneytopup")
public class TopupWebServiceImpl implements TopupWebService {

// and any other stuffs
}

I noticed that there are differences between them. One of it is the first webservice has endPointInterface on its implementation class, while the second hasn't.


when i generate the client code for both of them, using wsimport command, it will generate the different class too. The first web service will be generated along with the implementation class (EcommPromoWebServiceImplService class), while the second has no implementation class generated.


So, how to generate the classes for client apps correctly for the second webservice? because without implementation class generated, i keep getting NullPointerException on my client apps (kindly check my thread here: Spring @AutoWired always null)


the wsimport command i'm using to generate them is wsimport -keep -verbose <wsdladdress>

来源:https://stackoverflow.com/questions/44940462/spring-webservice-with-endpoint-vs-no-endpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!