在 CXF ServiceInfo 中更改 EndPoint 详细信息
Change EndPoint details in CXF ServiceInfo
环境CXF2.2.6和Spring2.5。在启动时 JBOSS 我需要阅读 CXF 属性并更改端点详细信息。从基本阅读中,它让我想到 CXF Service Info class (org.apache.cxf.service.model.ServiceInfo) 处理绑定、端点、消息、模式等。
我可以扩展 CXFServlet 并创建我自己的自定义 servlet。请告诉我如何在启动时将自己的详细信息提供给端点并覆盖 Spring.xml
中给出的内容
The below Spring bean should do what you wanted. Why do you want to override ServiceInfo class ? Any particular reason ?
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.ServletContextAware;
public class CXFConfig implements InitializingBean{
@Autowired
Bus cxfBus;
@Override
public void afterPropertiesSet() throws Exception {
EndpointImpl endpoint = new EndpointImpl(cxfBus, new GdsAutomationServiceProviderImpl());
endpoint.setAddress("/public/api/service/v1");//WSDL URL
endpoint.setPublishedEndpointUrl(getEndPointAddress());
endpoint.publish();
}
public Bus getCxfBus() {
return cxfBus;
}
public void setCxfBus(Bus cxfBus) {
this.cxfBus = cxfBus;
}
public String getEndPointAddress() {
// Soap address location you need to define here
return "address"
}
@Override
public void setServletContext(ServletContext context) {
context.getServerInfo();
}
}
环境CXF2.2.6和Spring2.5。在启动时 JBOSS 我需要阅读 CXF 属性并更改端点详细信息。从基本阅读中,它让我想到 CXF Service Info class (org.apache.cxf.service.model.ServiceInfo) 处理绑定、端点、消息、模式等。
我可以扩展 CXFServlet 并创建我自己的自定义 servlet。请告诉我如何在启动时将自己的详细信息提供给端点并覆盖 Spring.xml
中给出的内容The below Spring bean should do what you wanted. Why do you want to override ServiceInfo class ? Any particular reason ?
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.ServletContextAware;
public class CXFConfig implements InitializingBean{
@Autowired
Bus cxfBus;
@Override
public void afterPropertiesSet() throws Exception {
EndpointImpl endpoint = new EndpointImpl(cxfBus, new GdsAutomationServiceProviderImpl());
endpoint.setAddress("/public/api/service/v1");//WSDL URL
endpoint.setPublishedEndpointUrl(getEndPointAddress());
endpoint.publish();
}
public Bus getCxfBus() {
return cxfBus;
}
public void setCxfBus(Bus cxfBus) {
this.cxfBus = cxfBus;
}
public String getEndPointAddress() {
// Soap address location you need to define here
return "address"
}
@Override
public void setServletContext(ServletContext context) {
context.getServerInfo();
}
}