Chuさん、
木村です。
ぱっと見た感じでは、以前のWSDD設定の問題と直接関係なさそうです。
まず、エラー種別は「java.io.IOException」ですし、詳細メッセージは "End of stream encountered before final boundary marker."となってい ます。これは、通信が完了する前にStreamが終了してしまった、という事 を示しています。 転送データサイズを示す「Content-length」というヘッダに指定された 値と、実際に受信したデータサイズが異なると発生します。英語になって しまいますが、下記の情報を参照ください。 # Chuさんは、英語でもぜんぜん問題ないと思いますから...
http://www.newsarch.com/archive/mailinglist/axis/user/msg05607.html
現在、ソースを読んで原因分析をしている時間を取れないので、上記の 情報から原因・対策を探っていただければと思います。
よろしくお願いします。 --- Toshi <[EMAIL PROTECTED]>
On Fri, 4 Mar 2005, chu wrote:
木村 様
いつもお世話になっております。
前の続きとも思われますが、
何故か理由は分からないですが、URN:FileDownloadService にしてやってみたらうまくいきました。 ........... 原因は環境なのか、自分が悪いなのかよく分かりませんが、とりあえず、 urnで解決しました。
やはり本当の解決ではないみたいです。
今回はattachmentsを使って、アップロード用にURN:SendFileServiceを作成 したのですが、やはり同じくDataHandlerの引受渡しのところで引っかかってい ます。
------------------ サービスのところで public class SendFileService { public DataHandler echo( DataHandler dh) { ...... } }
------------------ クライントのほうは”SOAP通信”で呼んでおります。 boolean echoUsingSAAJ(String address, String port, String filename) throws Exception { String endPointURLString = "http://"+address+":" +port + "/axis/services/urn:SendFileService"; SOAPConnectionFactory soapConnectionFactory = javax.xml.soap.SOAPConnectionFactory.newInstance(); SOAPConnection soapConnection = soapConnectionFactory.createConnection();
MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); SOAPEnvelope requestEnvelope = soapPart.getEnvelope(); SOAPBody body = requestEnvelope.getBody(); SOAPBodyElement operation = body.addBodyElement(requestEnvelope. createName("echo"));
Vector dataHandlersToAdd = new Vector(); dataHandlersToAdd.add(new DataHandler(new FileDataSource(new File(filename))));
if (dataHandlersToAdd != null) { ListIterator dataHandlerIterator = dataHandlersToAdd.listIterator();
while (dataHandlerIterator.hasNext()) { DataHandler dataHandler = (DataHandler)dataHandlerIterator.next(); javax.xml.soap.SOAPElement element = operation.addChildElement(requestEnvelope.createName("source")); javax.xml.soap.AttachmentPart attachment = soapMessage.createAttachmentPart(dataHandler); soapMessage.addAttachmentPart(attachment); element.addAttribute(requestEnvelope.createName("href"), "cid:" + attachment.getContentId()); } } System.out.println("2: getDataHandler"); Iterator iterator = null; DataHandler rdh =null; int count = 1; // org is 3 for(int i = 0; i < count; i++){ System.out.println("====== loop#" + i ); try { javax.xml.soap.SOAPMessage returnedSOAPMessage = soapConnection.call(soapMessage, endPointURLString); iterator = returnedSOAPMessage.getAttachments(); if (!iterator.hasNext()) { //The wrong type of object that what was expected. System.out.println("Received problem response from server"); throw new AxisFault("", "Received problem response from server", null, null); }
//Still here, so far so good. //Now lets brute force compare the source attachment // to the one we received. rdh = (DataHandler) ((AttachmentPart)iterator.next()).getDataHandler(); break; } catch (Exception e) { .... } } .... ------------------
deploy.wsddは下記のようにoperationも入れております。
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:ns1="urn:SendFileService" > <service name="urn:SendFileService" provider="java:RPC" > <parameter name="className" value="attachments.SendFileService"/> <parameter name="allowedMethods" value="echo echoDir"/> <operation name="echo" returnQName="echoResponse" returnType="ns1:DataHandler" > <parameter name="dh" type="ns1:DataHandler"/> </operation>
<typeMapping deserializer="org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFac tory" languageSpecificType="java:javax.activation.DataHandler" qname="ns1:DataHandler"
serializer="org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory "
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </service> </deployment>
------------------ 結果: Tomcatの画面では
- AxisFault: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.lang.RuntimeException: java.io.IOException: End of stream enc ountered before final boundary marker.AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.io.IOException: End of stream encountered before final bounda ry marker. faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:java.io.IOException: End of stre am encountered before final boundary marker. at org.apache.axis.attachments.BoundaryDelimitedStream.read(BoundaryDeli mitedStream.java:308) at org.apache.axis.attachments.BoundaryDelimitedStream.read(BoundaryDeli mitedStream.java:358) at org.apache.axis.attachments.ManagedMemoryDataSource.&lt;init& gt;(ManagedMemoryDataSource.java:146) .....
になってしまいました。logsにはなにも取れてません。ファイルすら存在しませ ん。
PS: 1.現に、URN:FileDownloadServiceは正しく動いております。URN: SendFileService も同じようにやっているつもりですが、。。。 2. public DataHandler echo( DataHandler dh) で DataHandlerを引き渡すときにとreturnにそれぞれエラーになる場合があっ て不安定 です。(これについては調べている途中です。)
なにか助言を宜しくお願い申し上げます。
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
