我正在使用 Maven 3.0.3 和 Spring 3.1.1.RELEASE。我想自动装配一个 Web 服务客户端,我正在使用 jaxws-maven-plugin 生成其类...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlUrls>
<wsdlUrl>${wsdl.url}</wsdlUrl>
</wsdlUrls>
<sourceDestDir>${basedir}/src/main/java</sourceDestDir>
<packageName>org.myco.myws</packageName>
</configuration>
</execution>
</executions>
</plugin>
但是,我对如何设置我的 Spring 应用程序上下文感到困惑。我有
<bean id="organizationWebService" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="org.myco.myws.OrganizationWebService" />
<property name="namespaceUri" value="http://myco.org/myws/" />
<property name="serviceName" value="api" />
<property name="endpointAddress" value="http://hbs-01.qa2.myco.cb:8443/bsg/myws/OrganizationService?WSDL" />
</bean>
但我得到这个错误。请注意“相关原因:WSDL 元数据不可用于创建代理”。我该如何正确配置这个东西?
java.lang.IllegalStateException: Failed to load ApplicationContext^M
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)^M
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)^M
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)^M
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)^M
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)^M
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)^M
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)^M
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290)^M
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)^M
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)^M
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)^M
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)^M
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)^M
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)^M
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)^M
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)^M
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)^M
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)^M
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)^M
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)^M
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)^M
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)^M
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)^M
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)^M
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)^M
at java.lang.reflect.Method.invoke(Method.java:597)^M
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)^M
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)^M
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)^M
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)^M
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)^
...
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'organizationWebService' defined in class path resource [testAppContextHSQL.xml]: Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: WSDL Metadata not available to create the proxy, either Service instance or ServiceEndpointInterface org.myco.myws.OrganizationWebService should have WSDL information