首先贴上代码,这个是根据服务端生成的本地客户端代码接口
package com.pudding.tcs.ctrip.testservice;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.springframework.stereotype.Component;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.4-b01
* Generated source version: 2.2
*
*/
@WebService(name = "testService", targetNamespace = "http://testservice.ctrip.tcs.pudding.com/")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@XmlSeeAlso({
ObjectFactory.class
})
public interface TestService {
/**
*
* @param data
* @return
* returns int
*/
@WebMethod
@WebResult(name = "addResponse", targetNamespace = "http://testservice.ctrip.tcs.pudding.com/", partName = "addResponse")
public int add(
@WebParam(name = "data", targetNamespace = "http://testservice.ctrip.tcs.pudding.com/", partName = "data")
Data data);
}
下面是我自己写的一个controller,想在里面注入刚刚生成的接口去调用
package com.pudding.tcs.temp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.pudding.tcs.ctrip.testservice.Data;
import com.pudding.tcs.ctrip.testservice.TestService;
@Controller
public class WsClientController {
@Autowired
private TestService testService;
@RequestMapping(value="/wsclient")
public void wsClient(){
Data data = new Data();
data.setA(2);
data.setB(3);
int add = testService.add(data);
System.out.println(add);
}
}
没有引错包,但是服务器启动的时候就报错。说这个TestService无法被注入。百思不得七姐。我用的是springboot框架。希望大婶们给解答一下波
问题解决了,哈哈,忘记读取配置文件了。所以导致无法实例化这个接口