1 Reply Latest reply on Nov 14, 2006 10:11 AM by Romeu Figueira

    gSoap client with JBoss Ws. swa problem

    Billy Li Newbie

      Hi,
      I am working on a project to allow c++ client to communicate with JBoss WS server. Messages without multipart attachment works perfect. We are using JBoss-4.0.4 with JDK1.5.07. However, we got a problem with the attachment posting.
      The function is just sending a string message and an binary JPEG attachment.

      2006-08-31 13:50:08,705 DEBUG [org.jboss.ws.soap.MessageFactoryImpl] createMessage: [contentType=multipart/related; type="text/xml";
      start="<rootpart@ws.jboss.org>";
      boundary="----=_Part_0_31378924.1156126949748"]
      2006-08-31 13:50:08,726 DEBUG [org.jboss.ws.soap.attachment.SwapableMemoryDataSource] Using swap file, location = file:/usr/java/jboss-4.0.4.GA/server/all/tm
      p/jbossws/JBossWSsattachment37125.dat size = 242580
      2006-08-31 13:50:08,726 DEBUG [javax.xml.rpc.soap.SOAPFaultException] new SOAPFaultException [code={http://schemas.xmlsoap.org/soap/envelope/}Client,string=m
      ultipart/related stream invalid, no root part was found,actor=null,detail=null]
      2006-08-31 13:50:08,726 ERROR [org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper] SOAP request exception
      java.lang.IllegalArgumentException: multipart/related stream invalid, no root part was found
      at org.jboss.ws.soap.attachment.MultipartRelatedDecoder.decodeMultipartRelatedMessage(MultipartRelatedDecoder.java:153)
      at org.jboss.ws.soap.MessageFactoryImpl.createMessageInternal(MessageFactoryImpl.java:184)

      The actual data we send to server is:

      POST / HTTP/1.1
      Host: localhost:8080
      User-Agent: gSOAP/2.7
      Content-Type: multipart/related; boundary="----=_Part_0_31378924.1156126949748"; type="text/xml"; start="<rootpart@ws.jboss.org>"
      Content-Length: 243360
      Connection: keep-alive
      SOAPAction: ""

      ------=_Part_0_31378924.1156126949748
      Content-Type: text/xml; charset=utf-8
      Content-Transfer-Encoding: 8bit
      Content-ID: <rootpart@ws.jboss.org>

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://org.jboss.ws/trivialservice"><SOAP-ENV:Body><ns1:sendMimeImageJPEG>image/jpeg</ns1:sendMimeImageJPEG></SOAP-ENV:Body></SOAP-ENV:Envelope>
      ------=_Part_0_31378924.1156126949748
      Content-Type: image/jpeg
      Content-Transfer-Encoding: binary
      Content-ID: <multipart@schmap.com>

      ... Binary Data

      ------=_Part_0_31378924.1156126949748--


      I am really puzzled. Because I have another Java client sending similar type of message. It works fine.
      2006-08-31 14:28:06,212 DEBUG [org.jboss.ws.soap.MessageFactoryImpl] createMessage: [contentType=multipart/related; type="text/xml";
      boundary="----=_Part_0_31378924.1157005762808";
      start="<rootpart@ws.jboss.org>"]
      2006-08-31 14:28:06,519 DEBUG [org.jboss.ws.soap.attachment.SwapableMemoryDataSource] Using memory buffer, size = 240
      2006-08-31 14:28:07,776 DEBUG [org.jboss.ws.soap.attachment.SwapableMemoryDataSource] Using swap file, location = file:/usr/java/jboss-4.0.4.GA/server/all/tm
      p/jbossws/JBossWSsattachment37126.dat size = 277460
      2006-08-31 14:28:07,778 DEBUG [org.jboss.ws.soap.SOAPContentElement] setXMLFragment: LI NING1
      2006-08-31 14:28:07,779 DEBUG [jbossws.SOAPMessage] Incomming SOAPMessage
      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
      <env:Header/>
      <env:Body>
      <ns1:sendMimeImageJPEG xmlns:ns1='http://org.jboss.ws/trivialservice'>
      STRING
      </ns1:sendMimeImageJPEG>
      </env:Body>
      </env:Envelope>
      2006-08-31 14:28:07,780 DEBUG [org.jboss.ws.soap.SOAPMessageDispatcher] getDispatchDestination: {http://org.jboss.ws/trivialservice}sendMimeImageJPEG

      The data posted is:
      POST /schmap/trivialservice HTTP/1.1
      SOAPAction: ""
      Content-Type: multipart/related; type="text/xml"; start="<rootpart@ws.jboss.org>";
      boundary="----=_Part_0_31378924.1157005762808"
      User-Agent: Java/1.5.0_07
      Host: localhost:9999
      Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
      Connection: keep-alive
      Content-Length: 278054


      ------=_Part_0_31378924.1157005762808
      Content-Type: text/xml; charset=UTF-8
      Content-Transfer-Encoding: 8bit
      Content-ID: <rootpart@ws.jboss.org>

      <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
      <env:Body>
      <ns1:sendMimeImageJPEG xmlns:ns1='http://org.jboss.ws/trivialservice'>
      STRING
      </ns1:sendMimeImageJPEG>
      </env:Body>
      </env:Envelope>
      ------=_Part_0_31378924.1157005762808
      Content-Type: image/jpeg
      Content-Transfer-Encoding: binary
      Content-Id: <mimepart=3234287987979.24237@jboss.org>
      ,.... [Binary data]
      ------=_Part_0_31378924.1157005762808--


      Any help is highly appreciated.