2012-05-15 128 views
1

我想通過JaxWsProxyFactoryBean調用Web服務。我在tomcat 6中測試過,一切正常,但是當我部署在WAS 7上時,它並沒有工作。與websphere問題cxf

我的問題是: 當我把這個代碼的factory.create()方法:

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); 
     factory.setServiceClass(CustomerServices.class); 
     factory.setAddress("http://host:port/MyServices"); 
     factory.getInInterceptors().add(new LoggingInInterceptor()); 
     factory.getOutInterceptors().add(new LoggingOutInterceptor()); 
     CustomerServices client = (CustomerServices) factory.create(); 

我得到這個異常:ServiceConstructionException 還告訴我, 'e.getMessage()= NULL'

我的pom與WAS 7之間有沒有不兼容?

--pom.xml--

<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>${junit.version}</version> 
     <scope>test</scope> 
    </dependency> 

    <!--log--> 
    <dependency> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>${log4j.version}</version> 
    </dependency> 

    <!--commons--> 
    <dependency> 
     <groupId>commons-logging</groupId> 
     <artifactId>commons-logging</artifactId> 
     <version>1.1.1</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-lang</groupId> 
     <artifactId>commons-lang</artifactId> 
     <version>2.4</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-collections</groupId> 
     <artifactId>commons-collections</artifactId> 
     <version>3.2.1</version> 
    </dependency> 

    <!--Spring--> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context-support</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-jdbc</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 
    <!-- Spring AOP + AspectJ --> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-aop</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.aspectj</groupId> 
     <artifactId>aspectjtools</artifactId> 
     <version>1.6.2</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-asm</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-core</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-expression</artifactId> 
     <version>${org.springframework.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-test</artifactId> 
     <version>${org.springframework.version}</version> 
     <scope>test</scope> 
    </dependency> 

    <dependency> 
     <groupId>asm</groupId> 
     <artifactId>asm</artifactId> 
     <version>3.3</version> 
    </dependency> 
    <dependency> 
     <groupId>cglib</groupId> 
     <artifactId>cglib-nodep</artifactId> 
     <version>2.2</version> 
    </dependency> 

    <!-- AOP --> 
    <dependency> 
     <groupId>org.aspectj</groupId> 
     <artifactId>aspectjrt</artifactId> 
     <version>1.6.2</version> 
    </dependency> 
    <dependency> 
     <groupId>org.aspectj</groupId> 
     <artifactId>aspectjweaver</artifactId> 
     <version>1.6.2</version> 
    </dependency> 

    <!-- db connection and pooling --> 
    <dependency> 
     <groupId>com.ibm.db2</groupId> 
     <artifactId>db2jcc</artifactId> 
     <version>9.1.0</version> 
    </dependency> 
    <dependency> 
     <groupId>com.ibm.db2</groupId> 
     <artifactId>db2jcc-license-cisuz</artifactId> 
     <version>9.1.0</version> 
    </dependency> 
    <dependency> 
     <groupId>com.jolbox</groupId> 
     <artifactId>bonecp</artifactId> 
     <version>0.6.7.2</version> 
    </dependency> 
    <dependency> 
     <groupId>commons-dbcp</groupId> 
     <artifactId>commons-dbcp</artifactId> 
     <version>1.2.2</version> 
    </dependency> 

    <!-- Servlet --> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.5</version> 
     <scope>provided</scope> 
    </dependency> 

    <!-- Apache CXF dependencies --> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-frontend-jaxws</artifactId> 
     <version>${cxf.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-transports-http</artifactId> 
     <version>${cxf.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-databinding-aegis</artifactId> 
     <version>${cxf.version}</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.cxf</groupId> 
     <artifactId>cxf-rt-bindings-soap</artifactId> 
     <version>${cxf.version}</version> 
    </dependency> 

    <dependency> 
     <groupId>quartz</groupId> 
     <artifactId>quartz</artifactId> 
     <version>1.5.2</version> 
    </dependency> 

    <!--date & time--> 

    <dependency> 
     <groupId>joda-time</groupId> 
     <artifactId>joda-time</artifactId> 
     <version>1.6.2</version> 
    </dependency> 

    <dependency> 
     <groupId>com.persianCalender</groupId> 
     <artifactId>simpleCalender</artifactId> 
     <version>1.4.0</version> 
    </dependency> 

    <dependency> 
     <groupId>javax.xml.soap</groupId> 
     <artifactId>saaj-api</artifactId> 
     <version>1.3.1</version> 
    </dependency> 

    <dependency> 
     <groupId>com.sun.xml.messaging.saaj</groupId> 
     <artifactId>saaj-impl</artifactId> 
     <version>1.3.2</version> 
    </dependency> 

    <dependency> 
     <groupId>wsdl4j</groupId> 
     <artifactId>wsdl4j</artifactId> 
     <version>1.6.2</version> 
    </dependency> 

    <dependency> 
     <groupId>org.codehaus.woodstox</groupId> 
     <artifactId>wstx-asl</artifactId> 
     <version>3.2.9</version> 
    </dependency> 

    <dependency> 
     <groupId>org.codehaus.woodstox</groupId> 
     <artifactId>woodstox-core-asl</artifactId> 
     <version>4.1.1</version> 
    </dependency> 

    <dependency> 
     <groupId>org.codehaus.woodstox</groupId> 
     <artifactId>stax2-api</artifactId> 
     <version>3.1.1</version> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.ws.xmlschema</groupId> 
     <artifactId>xmlschema-core</artifactId> 
     <version>2.0</version> 
    </dependency> 

    <dependency> 
     <groupId>xml-resolver</groupId> 
     <artifactId>xml-resolver</artifactId> 
     <version>1.2</version> 
    </dependency> 

</dependencies> 
+0

UTF8 4.8.2 1.2.16 3.0.5.RELEASE 2.2.9 farhad

回答

0

最後,我發現了另一個解決方案,而不是將JaxWsProxyFactoryBean用作客戶端。 我們應該使用另一個客戶端;

public final static QName SERVICE_NAME = new QName("URL", "MyServiceImplService"); 


     MyServiceImplService ss = new MyServiceImplService (wsdlURL, SERVICE_NAME); 
     CustomerServices port = ss.getMyServiceImplPort(); 
     port.myMethod(input); 
0

我不得不使用CXF的WS和Maven爲構建在WebSphere 7或多或少相同的問題,部署JAX-WS Web服務。

您可以在網上找到許多信息;我試圖收集它們,併發布了一篇博文http://bit.ly/1wCyjfx

在這裏,您可以找到正在爲我工​​作的依賴項和WAR包裝部分(在我的應用程序中,我發佈了一些服務並使用其他一些服務),以及對WAS 7配置的特定引用。

+0

難道是博客文章不再可用? –

+0

之前提供的鏈接不再可用。我更新了鏈接。謝謝。 –