0

シンプルな Spring-ws サーバーをコーディングしようとしています。何が間違っているのかわかりませんが、SoapUI から初期化したリクエストがサーバーに到達しません。デバッガーの下で実行すると、サーバーで制御できなくなります。エラーは無効なコンテンツ タイプを示していますが、これが応答によるものかどうかはわかりません。返される応答は、アプリケーションの JSP エラー ページです。
サーブレットが正しく構成されていると思います。偽の test.wsdl をセットアップし、以下のように構成します。これは正しく機能しました。SoapUI からサーバー コードへのリクエストを取得できません。

私のサーバーのコードは次の
とおりです。package com.tester;

import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import org.starstandard.star.x5.ItemIdDescriptionDocument;

@Endpoint   
public class EndpointTest {


@PayloadRoot(localPart="ItemIdDescription", namespace = "http://www.starstandard.org/STAR/5")
@ResponsePayload
public ItemIdDescriptionDocument handleItemIdDescription(@RequestPayload  ItemIdDescriptionDocument request){

    String description = request.getItemIdDescription().getStringValue();

    return request;
}

}

これが私のサーブレットの構成です。このファイルは WEB-INF/spring-ws-servlet.xml です。

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sws="http://www.springframework.org/schema/web-services"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">

<context:component-scan base-package="com.tester" />
<sws:annotation-driven />
<bean
  class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
  <property name="marshaller" ref="marshaller" />
  <property name="unmarshaller" ref="marshaller" />
</bean>
<bean id="marshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller"></bean>
<sws:static-wsdl id="test" location="/WEB-INF/test.wsdl"/>
</beans>

これは SoapUI からの生のリクエストです。私はこれを得るためにフィドラーを使用しました:

POST http://localhost:8080/webroot/eservices HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/xml
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8080
Connection: Keep-Alive
Content-Length: 146

<ItemIdDescription xmlns:oagis="http://www.openapplications.org/oagis/9"
 xmlns="http://www.starstandard.org/STAR/5">Test</ItemIdDescription>

ログからのエラー スタックは次のとおりです。

Oct 3, 2013 4:54:55 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet spring-ws threw exception
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-    Type:application/xml. Is this an error message instead of a SOAP response?
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:602)
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:275)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Message1_1Impl.<init>(Message1_1Impl.java:67)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(SOAPMessageFactory1_1Impl.java:61)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:184)
at org.springframework.ws.soap.saaj.SaajSoapMessageFactory.createWebServiceMessage(SaajSoapMessageFactory.java:60)
at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:90)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:59)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:239)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)

SOAP 1.2 をサポートするようにサーバーを切り替えた後のエラー スタックは次のとおりです。SOAP のバージョンの問題ではないと思います。

SEVERE: Servlet.service() for servlet spring-ws threw exception
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:application/xml. Is this an error message instead of a SOAP response
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.identifyContentType(MessageImpl.java:602)
at com.sun.xml.internal.messaging.saaj.soap.MessageImpl.<init>(MessageImpl.java:275)
at com.sun.xml.internal.messaging.saaj.soap.ver1_2.Message1_2Impl.<init>(Message1_2Impl.java:60)
at com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl.createMessage(SOAPMessageFactory1_2Impl.java:61)
... the rest of the stack is the same.

これをデバッグする方法について誰か提案がありますか? どうもありがとう!

4

2 に答える 2

1

Web サービスは SOAP 1.1 のように見えますが、SoapUI リクエストは SOAP 1.2 であるため、この競合のためにエラーが発生しています。このスレッドは、この問題に関してあなたを助けるかもしれません。SOAP 1.2 では、MIME タイプは「application/soap+xml」です。だから私はそれがSOAP 1.2だと思った(純粋に憶測)

于 2013-10-04T06:23:31.083 に答える