Java Web サービスから次の応答があります。
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 12:08:50 GMT
Server: Jetty/5.1.14 (Linux/2.6.18-274.17.1.el5xen x86 java/1.6.0
Content-Type: text/xml; charset=utf-8
Content-Length: 571
--MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335182931028
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:14B7343BF98675BB5D1335182931029@apache.org>
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:loginResponse xmlns:ns1="http://www.telelogic.com/change/types"><token>206398089429929753</token></ns1:loginResponse></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335182931028--
WCFからの例外は私に言っていますThe data at the root level is invalid. Line 1, position 1.
私の app.config は次のとおりです。
<customBinding>
<binding>
<!--<messageModifier />-->
<!--<mtomMessageEncoding messageVersion="Soap11" writeEncoding="utf-8" />-->
<textMessageEncoding writeEncoding="utf-8" messageVersion="Soap11" />
<httpsTransport
requireClientCertificate="false"
transferMode="Buffered" />
</binding>
</customBinding>
ご覧のとおり、mtom/text encodig、メッセージ バージョン用の soap11/soap12、transferMode 用の buffered および responseStreamed などのさまざまな設定を既に試しました。私はちょっと立ち往生しています。Fiddler で応答の一部を取り除くと、動作するようになりました。
HTTP/1.1 200 OK
Date: Mon, 23 Apr 2012 14:21:44 GMT
Server: Jetty/5.1.14 (Linux/2.6.18-274.17.1.el5xen x86 java/1.6.0
Content-Type: text/xml; charset=utf-8
Content-Length: 571
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:loginResponse xmlns:ns1="http://www.telelogic.com/change/types"><token>206398089429929753</token></ns1:loginResponse></soapenv:Body></soapenv:Envelope>
何か不足していますか?必要な構成設定の魔法の組み合わせはありますか?
IClientMessageFormatter と IClientMessageInspector のボットも試しましたが、WCF が既に ProtocolException の通知で失敗しているため、どちらもスタック内で高すぎるようですThe data at the root level is invalid. Line 1, position 1.
。
WCF サンプルから ChannelMessageInterceptor をフックしました。私はそれが機能していると思っていましたが、Javaサービスから例外が発生しています:
HTTP/1.1 500 Internal Server Error
Date: Mon, 23 Apr 2012 14:40:05 GMT
Server: Jetty/5.1.14 (Linux/2.6.18-274.17.1.el5xen x86 java/1.6.0
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335192006387; type="application/xop+xml"; start="<0.urn:uuid:14B7343BF98675BB5D1335192006388@apache.org>"; start-info="application/soap+xml"; action="http://www.telelogic.com/change/ChangeService/login/Fault/LoginFault";charset=UTF-8
Content-Length: 2853
--MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335192006387
Content-Type: application/xop+xml; charset=utf-8; type="application/soap+xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:14B7343BF98675BB5D1335192006388@apache.org>
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><soapenv:Fault xmlns:axis2ns15="http://www.w3.org/2003/05/soap-envelope"><soapenv:Code><soapenv:Value>axis2ns15:MustUnderstand</soapenv:Value></soapenv:Code><soapenv:Reason><soapenv:Text xml:lang="en-US">Must Understand check failed for header http://www.w3.org/2005/08/addressing : Action</soapenv:Text></soapenv:Reason><soapenv:Detail><Exception>org.apache.axis2.AxisFault: Must Understand check failed for header http://www.w3.org/2005/08/addressing : Action
at org.apache.axis2.engine.AxisEngine.checkMustUnderstand(AxisEngine.java:88)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:137)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:121)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:830)
at compressionFilters.CompressionFilter.doFilter(CompressionFilter.java:192)
at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at com.telelogic.cs.filters.StrutsCharsetFilter.doFilter(StrutsCharsetFilter.java:44)
at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
</Exception></soapenv:Detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335192006387--
少なくとも、彼らは Axis を使っているということですか? また、応答のコンテンツ タイプがバインディングのタイプと一致しないという例外メッセージも確認しましたが、現時点では再現できません。
この質問によく似ています。私もWCF Soap With Attachments Encoderを試しましたが、それもしつこく続けますData at the root level is invalid. Line 1, position 1.
(ただし、ProtocolException ではなく XmlException 内で直接)。
更新 WCF SWA が動作しています。
添付ファイルを含むメッセージの例:
HTTP/1.1 200 OK
Date: Tue, 24 Apr 2012 11:27:40 GMT
Server: Jetty/5.1.14 (Linux/2.6.18-274.17.1.el5xen x86 java/1.6.0
Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335266861287; type="application/xop+xml"; start="<0.urn:uuid:14B7343BF98675BB5D1335266861289@apache.org>"; start-info="text/xml";charset=UTF-8
Content-Length: 81847
--MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335266861287
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:14B7343BF98675BB5D1335266861289@apache.org>
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns1:downloadAttachmentResponse xmlns:ns1="http://www.telelogic.com/change/types"><attachmentContents><xop:Include href="cid:1.urn:uuid:14B7343BF98675BB5D1335266861290@apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"></xop:Include></attachmentContents></ns1:downloadAttachmentResponse></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335266861287
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <1.urn:uuid:14B7343BF98675BB5D1335266861290@apache.org>
��ࡱ�����������������>���� ����������������������������������������������������������������������������������������������������������������������������������������������
--MIMEBoundaryurn_uuid_14B7343BF98675BB5D1335266861287--
現時点では、解析でエラーが発生しにくいため、HttpWebRequest を使用してサービスを呼び出すことを考えています。
この特定のメッセージにデフォルトの MTOM エンコーダーを使用すると動作します:S 今、エンコーダーを動的に切り替える必要がありますか?!
私はついにそれを働かせました。WCF SWA サンプルに基づいて、TextMessageEncodingBindingElement をデフォルトとして使用し、メッセージを送信するためのバインド拡張機能と、マルチパート/関連メッセージを受信するときに MtomMessageEncodingBindingElement を使用するフォールバック メカニズムを作成しました。
皆さん、ありがとうございました。