2015-05-27 54 views
1

我建立一个Web服务,并在Tomcat中部署它。我已经有这方面的WSDL,我想要发布的,我已经试图与WebServiceProvider此类注释的wsdlLocation属性指定的,但Tomcat的(?)刚刚生成自己的。 编辑:没有,它只是抛出异常,它生成了自己的WSDL,因为我还没有重新启动Tomcat的呢。如何发布我自己的类型化WSDL?

事情你应该知道 -

  1. 的WSDL本身是有效的(格式明智的),我设法从它创建客户存根。
  2. 我使用的JAX-WS提供接口,该接口仅具有一种方法-invoke。
  3. 但是我不希望客户端看到这个方法,而不是让它看,说另一种方法说的getFirstName这需要一个刺,而不是一个SOAPMessage.Later也许我想补充两个或三个以上的方法,但在服务器端处理它在XML级别。

提供者接收机类

package impl; 

import java.io.FileOutputStream; 
import java.io.IOException; 
import java.io.OutputStream; 

import javax.xml.soap.SOAPException; 
import javax.xml.soap.SOAPMessage; 
import javax.xml.ws.ServiceMode; 
import javax.xml.ws.WebServiceProvider; 
import javax.xml.ws.BindingType; 
import javax.xml.ws.Provider; 
import javax.xml.ws.Service; 

@WebServiceProvider(portName="ClassRegisterBoyPort",wsdlLocation="/home/aneeshb/serverandclients/providerdeploy/ClassRegister/WebContent/WEB-INF/wsdl/stock.wsdl") 
@ServiceMode(value=Service.Mode.MESSAGE) 
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) 
public class ClassRegisterBoyPort implements Provider<SOAPMessage>{ 

    @Override 
    public SOAPMessage invoke(SOAPMessage msg) { 

     try { 
      OutputStream os = new FileOutputStream("testingboy.xml"); 
      msg.writeTo(os); 
     } catch (SOAPException | IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 


     return null; 
    } 

} 

的WSDL我试图使用 -

<?xml version='1.0' encoding='UTF-8'?> 
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://impl/" 
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" 
    name="ClassRegisterService" targetNamespace="http://impl/"> 
    <wsdl:types> 
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
      xmlns:tns="http://impl/" attributeFormDefault="unqualified" 
      elementFormDefault="qualified" targetNamespace="http://impl/"> 
      <xsd:element name="GetFirstNameInput" nillable="true" /> 
      <xsd:complexType name="input"> 
       <xsd:all> 
        <xsd:element name="firstName" type="xsd:string" /> 
        <xsd:element name="lastName" type="xsd:string" /> 
       </xsd:all> 
      </xsd:complexType> 
      <xsd:element name="GetFirstNameOutput" type="xsd:anyType" /> 
      <xsd:complexType name="output"> 
       <xsd:all> 
        <xsd:element name="firstName" type="xsd:string" /> 
        <xsd:element name="lastName" type="xsd:string" /> 
       </xsd:all> 
      </xsd:complexType> 
     </xsd:schema> 
    </wsdl:types> 

    <wsdl:message name="GetFirstNameInput"> 
     <wsdl:part element="tns:GetFirstNameInput" name="GetFirstNameInput"> 
     </wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="GetFirstNameOutput"> 
     <wsdl:part element="tns:GetFirstNameOutput" name="GetFirstNameOutput"> 
     </wsdl:part> 
    </wsdl:message> 

    <wsdl:portType name="ClassRegisterBoyPortType"> 
     <wsdl:operation name="GetFirstName"> 
      <wsdl:input message="tns:GetFirstNameInput" name="GetFirstNameInput"> 
      </wsdl:input> 
      <wsdl:output message="tns:GetFirstNameOutput" name="GetFirstNameOutput"> 
      </wsdl:output> 
     </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="ClassRegisterBoyBinding" type="tns:ClassRegisterBoyPortType"> 
     <soap12:binding style="document" 
      transport="http://schemas.xmlsoap.org/soap/http" /> 
     <wsdl:operation name="GetFirstName"> 
      <soap12:operation soapAction="" style="document" /> 
      <wsdl:input name="GetFirstNameInput"> 
       <soap12:body use="literal" /> 
      </wsdl:input> 
      <wsdl:output name="GetFirstNameOutput"> 
       <soap12:body use="literal" /> 
      </wsdl:output> 
     </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="ClassRegisterService"> 
     <wsdl:port binding="tns:ClassRegisterBoyBinding" name="ClassRegisterBoyPort"> 
      <soap12:address 
       location="http://localhost:8180/ClassRegister/services/ClassRegister/boys" /> 
     </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

它生成的WSDL -

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://impl/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="ClassRegisterBoyPortService" targetNamespace="http://impl/"> 
    <wsdl:types> 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://impl/" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://impl/"> 
    <xsd:element name="invoke" nillable="true" type="xsd:anyType"/> 
    <xsd:element name="invokeResponse" nillable="true" type="xsd:anyType"/> 
</xsd:schema> 
    </wsdl:types> 
    <wsdl:message name="invoke"> 
    <wsdl:part element="tns:invoke" name="invoke"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="invokeResponse"> 
    <wsdl:part element="tns:invokeResponse" name="invokeResponse"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:portType name="ClassRegisterBoyPort"> 
    <wsdl:operation name="invoke"> 
     <wsdl:input message="tns:invoke" name="invoke"> 
    </wsdl:input> 
     <wsdl:output message="tns:invokeResponse" name="invokeResponse"> 
    </wsdl:output> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="ClassRegisterBoyPortServiceSoapBinding" type="tns:ClassRegisterBoyPort"> 
    <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <wsdl:operation name="invoke"> 
     <soap12:operation soapAction="" style="document"/> 
     <wsdl:input name="invoke"> 
     <soap12:body use="literal"/> 
     </wsdl:input> 
     <wsdl:output name="invokeResponse"> 
     <soap12:body use="literal"/> 
     </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="ClassRegisterBoyPortService"> 
    <wsdl:port binding="tns:ClassRegisterBoyPortServiceSoapBinding" name="ClassRegisterBoyPort"> 
     <soap12:address location="http://localhost:8180/ClassRegister/services/ClassRegister/boys"/> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

编辑:

The Error-

WARNING: Exception encountered during context initialization - cancelling refresh attempt 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxwsService': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://impl/}ClassRegisterBoyPortService. 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) 
    at org.apache.cxf.transport.servlet.CXFServlet.createSpringContext(CXFServlet.java:151) 
    at org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:74) 
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:76) 
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) 
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) 
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:744) 
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://impl/}ClassRegisterBoyPortService. 
    at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:158) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:405) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:525) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261) 
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) 
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102) 
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) 
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) 
    at org.apache.cxf.jaxws.spring.NamespaceHandler$SpringServerFactoryBean.create(NamespaceHandler.java:60) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1696) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1635) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564) 
    ... 24 more 

May 27, 2015 4:41:42 PM org.apache.catalina.core.ApplicationContext log 
SEVERE: StandardWrapper.Throwable 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxwsService': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://impl/}ClassRegisterBoyPortService. 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) 
    at org.apache.cxf.transport.servlet.CXFServlet.createSpringContext(CXFServlet.java:151) 
    at org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:74) 
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:76) 
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) 
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) 
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:744) 
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://impl/}ClassRegisterBoyPortService. 
    at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:158) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:405) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:525) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261) 
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) 
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102) 
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) 
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) 
    at org.apache.cxf.jaxws.spring.NamespaceHandler$SpringServerFactoryBean.create(NamespaceHandler.java:60) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1696) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1635) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564) 
    ... 24 more 

May 27, 2015 4:41:42 PM org.apache.catalina.core.StandardContext loadOnStartup 
SEVERE: Servlet /ClassRegister threw load() exception 
org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://impl/}ClassRegisterBoyPortService. 
    at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:158) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:405) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:525) 
    at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261) 
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) 
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102) 
    at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) 
    at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) 
    at org.apache.cxf.jaxws.spring.NamespaceHandler$SpringServerFactoryBean.create(NamespaceHandler.java:60) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1696) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1635) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1564) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:540) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:229) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:725) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) 
    at org.apache.cxf.transport.servlet.CXFServlet.createSpringContext(CXFServlet.java:151) 
    at org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:74) 
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.init(CXFNonSpringServlet.java:76) 
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197) 
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) 
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) 
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:744) 

在此先感谢:P。

回答

0

好,看着错误信息我想这个问题是与CXF-servlet.xml文件。 最初,它是 -

<?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:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 
    <jaxws:server id="jaxwsService" serviceClass="impl.ClassRegisterBoyPort" address="/ClassRegister/boys"> 
     <jaxws:serviceBean> 
      <bean class="impl.ClassRegisterBoyPort"/> 
     </jaxws:serviceBean> 
    </jaxws:server> 
</beans> 

由于错误表明,它正在寻找,我没有在任何地方提到“ClassRegisterBoyPortService”,我想通了CXFServlet被配置在指定的WSDL来寻找在其配置中指定的服务文件 - 因为我没有指定它只是将“服务”附加到实现者并寻找它。因此,我在配置文件中指定了wsdlLocation,然后指定了serviceName,然后在找不到端口时 - portName。瞧!有效。

所得的cxf-servlet.xml中是 -

<?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:jaxws="http://cxf.apache.org/jaxws" xmlns:soap="http://cxf.apache.org/bindings/soap" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd" xmlns:tns="http://impl/"> 
    <jaxws:server id="jaxwsService" serviceClass="impl.ClassRegisterBoyPort" address="/ClassRegister/boys" wsdlLocation="serverandclients/providerdeploy/ClassRegister/WebContent/WEB-INF/wsdl/stock.wsdl" serviceName="tns:ClassRegisterService" endpointName="tns:ClassRegisterBoyPort"> 
     <jaxws:serviceBean> 
      <bean class="impl.ClassRegisterBoyPort"/> 
     </jaxws:serviceBean> 
    </jaxws:server> 
</beans> 
相关问题