1

Spring-WS 2.0.4.RELEASE、SOAP-1.2、JAXB-2.1、Spring 3.1.0.RELEASE で Web サービス クライアントを作成しようとしています。

Spring Bean から Web サービスにリクエストを送信すると、以下の例外トレースが表示されます。

org.springframework.ws.client.WebServiceTransportException:  [500]
                at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:663)
                at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:587)
                at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:537)
                at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:384)
                at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:378)
                at com.comp.proj.services.common.impl.MailClientImpl.postMail(MailClientImpl.java:66)

私のSpring Beanの定義は次のとおりです。

<bean id="mailServiceClient" class="org.springframework.ws.client.core.WebServiceTemplate" >
        <constructor-arg ref="emailSoapMsgFactory" type="org.springframework.ws.WebServiceMessageFactory" />
        <property name="defaultUri" value="http://server:8080/Process/EmailNotifyService"/>
        <property name="marshaller" ref="emailJAXBBMarshaller"></property>
        <property name="unmarshaller" ref="emailJAXBBMarshaller"></property>
    </bean>

    <bean id="emailJAXBBMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
       <property name="classesToBeBound">
            <list>
                <value>com.comp.proj.common.dto.EMailInputType</value>
                <value>com.comp.proj.common.dto.EMailOutputType</value>                
            </list>
        </property>
    </bean>

     <!-- Message factory for the service template. -->
     <bean id="emailSoapMsgFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
        <property name="soapVersion">
            <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" />
        </property>
    </bean>

混乱は、SoapUI で同じメッセージ (デバッグ ログから抽出) を投稿しようとすると、完全に機能することです。 この問題の原因についてはわかりません (スタック トレースから)。

ライブラリの問題でしょうか?どんな助けでも大歓迎です。

リクエストに応じてログを追加:

SOAP UI RAW-Tab data:
---------------------
POST http://server:8080/Process/EmailNotifyService HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/soap+xml;charset=UTF-8;action="/ActionURL"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: server:8080
Content-Length: 11117

SOAP UI ログ:

------------
1:49:34,627 DEBUG [HttpConnection] Open connection to server:8080
1:49:34,630 DEBUG [header] >> "POST /Process/EmailNotifyService HTTP/1.1[\r][\n]"
1:49:34,631 DEBUG [HttpMethodBase] Adding Host request header
1:49:34,639 DEBUG [header] >> "Accept-Encoding: gzip,deflate[\r][\n]"
1:49:34,639 DEBUG [header] >> "Content-Type: application/soap+xml;charset=UTF-8;action="/ActionURL"[\r][\n]"
1:49:34,639 DEBUG [header] >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
1:49:34,640 DEBUG [header] >> "Host: server:8080[\r][\n]"
1:49:34,640 DEBUG [header] >> "Content-Length: 11117[\r][\n]"
1:49:34,640 DEBUG [header] >> "[\r][\n]"
1:49:34,643 DEBUG [EntityEnclosingMethod] Request body sent
1:49:34,767 DEBUG [header] << "HTTP/1.1 200 OK[\r][\n]"
1:49:34,768 DEBUG [header] << "HTTP/1.1 200 OK[\r][\n]"
1:49:34,770 DEBUG [header] << "Server: Apache-Coyote/1.1[\r][\n]"
1:49:34,771 DEBUG [header] << "Content-Type: application/soap+xml;charset=utf-8[\r][\n]"
1:49:34,772 DEBUG [header] << "Content-Length: 437[\r][\n]"
1:49:34,774 DEBUG [header] << "Date: Wed, 20 Jun 2012 07:49:34 GMT[\r][\n]"
1:49:34,776 DEBUG [header] << "[\r][\n]"
1:49:34,785 DEBUG [HttpMethodBase] Resorting to protocol version default close connection policy
1:49:34,785 DEBUG [HttpMethodBase] Should NOT close connection, using HTTP/1.1
1:49:34,786 DEBUG [HttpConnection] Releasing connection back to connection manager.
1:49:34,788 DEBUG [IdleConnectionHandler] Adding connection at: 1340178574788
1:49:34,825 INFO  [AbstractHttpRequestDesktopPanel] Got response for [MailNotifyEventSourceBinding.NotifyEmail:Request 1] in 168ms (437 bytes)

アプリケーション デバッグ ログ:

2012-06-20 11:42:27,975 DEBUG: org.springframework.ws.client.core.WebServiceTemplate - Opening [org.springframework.ws.transport.http.CommonsHttpConnection@19c5ce6] to [http://server:8080/Process/EmailNotifyService]
2012-06-20 11:42:28,032 DEBUG: org.springframework.ws.soap.saaj.support.SaajUtils - SOAPElement [com.sun.xml.messaging.saaj.soap.ver1_2.Envelope1_2Impl] implements SAAJ 1.3
2012-06-20 11:42:28,045 DEBUG: org.springframework.ws.soap.saaj.support.SaajUtils - SOAPElement [com.sun.xml.messaging.saaj.soap.ver1_2.Body1_2Impl] implements SAAJ 1.3
2012-06-20 11:42:28,083 DEBUG: org.springframework.ws.client.MessageTracing.sent - Sent request [<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header/><env:Body><ns2:input_Mail_Type xmlns:ns2="http://www.namespace.com/modified"><ns2:cc/><ns2:plainData>           
    &lt;!-- Outermost table --&gt;&#13;
                &lt;table cellspacing="0" border="0" cellpadding="0" width="700"&#13;
                    style="border:1px solid #c9c1b5; background:#f1eee7;"&gt;&#13;
                    &lt;tr&gt;&#13;
                        &lt;td&gt;&#13;
                        &lt;/td&gt;&#13;
                    &lt;/tr&gt;&#13;
                &lt;/table&gt;          &#13;
</ns2:plainData><ns2:subject>Test</ns2:subject><ns2:To>b@b.com</ns2:To><ns2:contentType>text/html</ns2:contentType><ns2:app_id>x01</ns2:app_id><ns2:username>x</ns2:username><ns2:password>x</ns2:password></ns2:input_Mail_Type></env:Body></env:Envelope>
2012-06-20 11:42:28,189 DEBUG: httpclient.wire.header - >> "Accept-Encoding: gzip[\r][\n]"
2012-06-20 11:42:28,190 DEBUG: httpclient.wire.header - >> "Accept: application/soap+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2[\r][\n]"
2012-06-20 11:42:28,191 DEBUG: httpclient.wire.header - >> "Content-Type: application/soap+xml; charset=utf-8[\r][\n]"
2012-06-20 11:42:28,192 DEBUG: httpclient.wire.header - >> "Content-Length: 11342[\r][\n]"
2012-06-20 11:42:28,192 DEBUG: httpclient.wire.header - >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
2012-06-20 11:42:28,193 DEBUG: httpclient.wire.header - >> "Host: server:8080[\r][\n]"
2012-06-20 11:42:28,292 DEBUG: org.apache.commons.httpclient.methods.EntityEnclosingMethod - Request body sent
2012-06-20 11:42:28,295 DEBUG: httpclient.wire.header - << "HTTP/1.1 500 [\r][\n]"
2012-06-20 11:42:28,295 DEBUG: httpclient.wire.header - << "HTTP/1.1 500 [\r][\n]"
2012-06-20 11:42:28,318 DEBUG: org.springframework.ws.client.core.WebServiceTemplate - Received error for request [SaajSoapMessage {http://www.namespace.com/modified}input_Mail_Type]
2012-06-20 11:42:28,320 DEBUG: httpclient.wire.content - << "<html><head><title>Apache Tomcat/5.5.25 - Error report</title> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.25</h3></body> </html>"
4

2 に答える 2

1

スタックトレースの詳細がほとんどない状態で、この問題に遭遇しました。クライアントを介してリクエストに送信していたデータの検証例外であることが判明しました。たとえば、SOAPUI では次のようになります。

..コードではnullを送信するとエラーになりますが、「」を送信するとこれは機能します。

于 2013-07-29T16:52:08.333 に答える