0

Maven 3.0.3 と Spring 3.1.1.RELEASE を使用しています。jaxws-maven-plugin でクラスを生成している Web サービスクライアントを自動配線したいと思います...

<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 &apos;organizationWebService&apos; 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
4

2 に答える 2

1

Spring 構成に WSDL ドキュメントの URL がありません。

<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" />
    <property name="wsdlDocumentUrl" value="classpath:org/myco/mywscampaignmonitor/mywscampaignmonitor.wsdl" />
</bean>

上記の構成を使用すると、動作するはずです。

于 2012-11-05T17:13:29.717 に答える