Discussions

XML & Web services: WebServices Design: XML Parameter - String vs SOAP Attachment

  1. I am trying to design Java WebServices using Apache Axis which will be accessed from Oracle BPEL.

    Each Web Service takes different XMLs. I would like to know which of the following options is better:

           - Passing XML to Services as SOAP Attachments
                           OR
           - Passing XML to Services as String

    The size of XMLs ranges from 50KBs to 100 KBs. The number of concurrent transactions will be probably around 100.

    I would like to get your ideas on which is better.

    Thanks in advance for any help.

    Venky.
  2. If the payload that u are sending to the webservice is as high as 50-100K it maybe better off to just send them as attachments. Axis 2 has good support for MTOM attachments. I have had good response with this approach. I even expose 2 methods on the service - one accepts zipped attachments and the other accepts plain xml attachments. The zipped version seems to perform much better. Either case, the problem is - u will not be able to auto validate xml that is being sent to the service... (unless u have control over the sending clients too). Another limitation that I came across with large xml files is that if u dont send them as attachments, then the java serialization itself has problems and u will get a StackOverflowError. So, I would say just use attachments rather than String types. With Axis 1.1 you may have to just use the String method...Axis 2 has good support for various message exchange patterns and u can really have async web services with one or 2 comm channels. So, if u are using axis 1.1 consider moving up to Axis 2.
  3. Thank you Sowmya Sridhar!

    This application needs to run in Weblogic 6.1. So, I think we can't use Axis2, as this is compatible with JDK 1.5.
    We are planning to use Axis 1.2.1. Do you see any issues with using this version of Axis for XML Attachments?

    Thanks again.
  4. Axis 2 does not need 1.5. We have it deployed on WLS 8.1 which uses 1.4.2. I have not used Axis 1.2.1 with attachments - but it should work fairly well. Axis 2 is just a war file... just deploy it and try running some sample apps. My guess is it should just work.
  5. Thank you again.