在Spring SOAP Tutorial中总是出现错误AbstractMethodError

时间:2016-02-01 04:18:48

标签: java spring web-services spring-mvc soap

我在这个URL中尝试过Spring中的SOAP教程。我确保完全遵循整个教程,但在测试SOAP时仍然会出现此错误。这是返回的错误:

{"timestamp":1454299828677,"status":500,"error":"Internal Server Error","exception":"java.lang.AbstractMethodError","message":"org.springframework.ws.
server.endpoint.mapping.AbstractMethodEndpointMapping.getLookupKeyForMessage(Lorg/springframework/ws/context/MessageContext;)Ljava/lang/Object;","path
":"/ws"}

我已确保JDK的版本为8,并且Web服务已成功运行。但是,它仍然会像那样回归。有人有解决方案吗?谢谢。

1 个答案:

答案 0 :(得分:0)

我已经尝试过这个教程,对我来说非常合适。

我使用maven创建了应用程序,并使用以下命令运行它。

    mvn spring-boot:run

现在我的SOAP Web服务正在运行,然后我在postman中运行SOAP请求xml,如下所示。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:gs="http://spring.io/guides/gs-producing-web-service">
   <soapenv:Header/>
   <soapenv:Body>
      <gs:getCountryRequest>
         <gs:name>Poland</gs:name>
      </gs:getCountryRequest>
   </soapenv:Body>
</soapenv:Envelope>

还有一件事,在邮递员请求中将正文类型设置为“text / xml”。

以下是我得到的结果

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <ns2:getCountryResponse xmlns:ns2="http://spring.io/guides/gs-producing-web-service">
            <ns2:country>
                <ns2:name>Poland</ns2:name>
                <ns2:population>38186860</ns2:population>
                <ns2:capital>Warsaw</ns2:capital>
                <ns2:currency>PLN</ns2:currency>
            </ns2:country>
        </ns2:getCountryResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>