jBoss 7.1.1中的org.springeframework.ws.soap.client.SoapFaultClientException

时间:2015-01-28 12:36:35

标签: spring web-services jboss client spring-ws

我正在创建一个Spring Web应用程序(实际上是Liferay的一个portlet),我必须与Web服务进行通信。我们的webapplication在JBoss 7.1.1上运行。我之前没有遇到太多麻烦,唯一的区别是那时应用程序在Tomcat服务器上运行。

我用soap插件测试了web服务,我可以得出结论,webservice运行正常。

我做了什么:

我使用maven-jaxb2-plugin从提供的.wsdl文件创建了pojo文件(DTO的?)。那些课程很好。然后我定义了我的编组bean:

@Configuration
public class WebServiceConfiguration {


   @Bean
   public Jaxb2Marshaller persoonServiceMarshaller() {
       Jaxb2Marshaller m = new Jaxb2Marshaller();
       m.setMtomEnabled(true);
       m.setContextPath("services");
       return m;
   }

   @Bean
   public WebServiceTemplate persoonTemplate(Jaxb2Marshaller persoonServiceMarshaller) {
       WebServiceTemplate w = new WebServiceTemplate();
       w.setMarshaller(persoonServiceMarshaller);
       w.setUnmarshaller(persoonServiceMarshaller);

       w.setDefaultUri("my hardcoded webservice location URI...");
       return w;
   }

然后我写了一个测试这个东西的方法:

@Autowired
    WebServiceTemplate persoonTemplate;

    public int getPersonCount(String lastName, String firstName, int birthYear,
            int birthMonth, String postalCode) {
        System.out.println("Getting PersonCount");

        ZoekPersonen zp = new ObjectFactory().createZoekPersonen();
        PersoonZoekCriteria criteria = new ObjectFactory()
                .createPersoonZoekCriteria();
        if (lastName != null && !lastName.equals("")) {
            criteria.setNaam(new ObjectFactory().createPersoonDTONaam(lastName));
        }
        if (firstName != null && !firstName.equals("")) {
            criteria.setVoornaam(new ObjectFactory()
                    .createPersoonDTONaam(firstName));
        }
        if (birthYear != 0) {
            criteria.setGeboorteJaar(new ObjectFactory()
                    .createPersoonZoekCriteriaGeboorteJaar(birthYear));

        }
        if(birthYear != 0) {
            criteria.setGeboorteMaand(new ObjectFactory()
            .createPersoonZoekCriteriaGeboorteMaand(birthMonth));

        }
        if(postalCode != null && !postalCode.equals("")) {
            criteria.setPostCode(new ObjectFactory()
            .createPersoonZoekCriteriaPostCode(postalCode));
        }


        @SuppressWarnings("unchecked")
        JAXBElement<ZoekPersonenResponse> jaxBResponse = (JAXBElement<ZoekPersonenResponse>) persoonTemplate
                .marshalSendAndReceive(new ObjectFactory()
                        .createZoekPersonen(zp));

        return jaxBResponse.getValue().getReturn().getGevondenPersonen()
                .getValue().getPersoonDTO().size();
    }

当我测试此方法时,抛出此异常:

13:12:54,278 INFO  [stdout] (http--0.0.0.0-443-6) 13:12:54,275 ERROR [http--0.0.0.0-443-6][render_portlet_jsp:132] null
13:12:54,279 INFO  [stdout] (http--0.0.0.0-443-6) org.springframework.ws.soap.client.SoapFaultClientException: Fault occurred while processing.
13:12:54,281 INFO  [stdout] (http--0.0.0.0-443-6)   at BLL.PersoonBLL.getPersonCount(PersoonBLL.java:53)
13:12:54,283 INFO  [stdout] (http--0.0.0.0-443-6)   at controllers.MyController.renderView(MyController.java:44)
13:12:54,284 INFO  [stdout] (http--0.0.0.0-443-6)   at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
13:12:54,285 INFO  [stdout] (http--0.0.0.0-443-6)   at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
13:12:54,286 INFO  [stdout] (http--0.0.0.0-443-6)   at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
13:12:54,290 INFO  [stdout] (http--0.0.0.0-443-6)   at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
13:12:54,294 INFO  [stdout] (http--0.0.0.0-443-6)   at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)

我很无能,我认为它与JBoss有关,谷歌搜索,但没有找到有用的信息。

仅供参考:我的Maven POM中的依赖项和插件:

<plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <configuration>
            <schemaDirectory>src\main\resources</schemaDirectory>
            <schemaIncludes>
                <include>PersoonWebService.wsdl</include>
            </schemaIncludes>
            <generatePackage>services</generatePackage>
            <generateDirectory>src\main\java</generateDirectory>
            <verbose>true</verbose>
        </configuration>
        <executions>
            <execution>
                <phase>generate-resources</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
            </execution>
        </executions>
</plugin>


<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws-core</artifactId>
    <version>${spring-ws.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-oxm</artifactId>
    <version>${spring.suite.version}</version>
</dependency>

Spring WS版本= 2.1.4-RELEASE Spring suite version = 3.2.4-RELEASE

升级spring版本或JBoss版本很遗憾没有选择。这必须在现有的生产环境中运行。

非常欢迎提示和提示!

1 个答案:

答案 0 :(得分:1)

我自己解决了这个问题:

SoapFaultClientException:WebService抛出异常!我的要求缺少一些有义务的参数。即便如此,wsdl也没有按要求提及它们。

==&GT;问题不是JBoss特有的,我最初的想法。 (抱歉羞辱Jboss,但我仍然不喜欢你;-))。