Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Massive payload coming as a JAXWS SOAP response  RSS feed

 
Rithanya Laxmi
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on JAXWS webservice which creates a SOAP request and response. There are cases the response which I get from a JAXWS is pretty heavy with a huge payload and it is taking lot of time to get the response where I am getting SocketTimeoutException quite regularly. Is there any possibility where we can improve the performance of the JAXWS by sending a payload data (response) in small chunks in an iterative manner rather than sending all of them at once? More over we are using the JAXB unmarshaller to parse the SOAP response that also takes lot of time? Could you please suggest how to resolve thgese problems? Whether REST WS helps in this scenario or is there any other alternative steps we can take it to make sure everything functions properly? Please clarify.

Thanks.
 
Vishwanathan Nagarajan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What is the size of the payload that is returned in the SOAP message.


-Vishwa
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand your situation, the problem is that SOAP clients completely parse the message into a DOM, taking a LOT of time - which is not what you want.

The problem of huge SOAP responses worried a lot of people when SOAP got started -the proposed solution was to attach the bulk as a separate part of the response, NOT parsed by the client - SAAJ

If you don't need all the bells and whistles of SOAP - such as authentication and encryption, a RESTfull design will be orders of magnitude faster.

Bill

 
Rithanya Laxmi
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys. The response from SOAP message is terms of more than 500 MB. Tell me using SAAJ and by passing the payload as an attachment we need to explictly create the SOAP message structure right using MessageFactory, SoapConnection, etc rather than we use the object oriented JAXB in JAXWS to create the SOAP request(marshalling) & response(unmarshalling)? Similarly parsing the SOAP response needs to be done through DOM/SAX? Any examples on these are highly appreciated. Is using SAAJ is the only way of handling SOAP response in a better way as it supports attachment? Is there any other alternative or a better way to do this? What is the maximum capacity of attachments SAAJ supports? Whether attaching a huge capacity of payload is accepted?Please clarify.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
500MB

How about you burn a CD and mail it to them?

I would set up an FTP server and have the SOAP response contain the information needed to access the file by FTP. Presumably with a version of FTP that can resume an interrupted transfer.

Parsing a SOAP response should be handled by SOAP client software toolkit, but no sane person expects to try to process a 500 mb content the same way a normal SOAP response is handled.

You are also way way outside the bounds of normal JAXB so I would think in terms of custom routines to write your XML payload.

Note that zip compression of the payload document will make a big difference.

Again - are you really attached to SOAP as an API? A RESTful architecture would be faster.

Bill
 
Rithanya Laxmi
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William. Tell me one thing , using SAAJ we need to create the SOAP request/response explictly using the SAAJ API like SoapConnectionFactory,MessageFactory,etc?Similarly to parse the SOAP response we need to use the XML parser like SAX/DOM? Please clarify.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would expect that you can find a SOAP client toolkit that will handle all of that. Sorry, I am not up to speed on SOAP toolkits these days so can't suggest any.

Unless you have some reason to avoid SOAP toolkits (or you want to learn more XML parsing) you should not have to do any XML parsing of the SOAP response.


Bill
 
Rithanya Laxmi
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Axis2 is what I am using , Whether Axis2 can be used to create a SOAP request/reponse using SAAJ ? Similarly to parse the SOAP message whether we can use AXIS2 ? Please clarify.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not look at the Axis documentation such as this SAAJ related API instead of asking me?

Bill
 
Rithanya Laxmi
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill. JAXWS supports Streaming API using "StreamingDataHandler" that can be used to stream the data which internally uses STAX API which can speed up the process? Zip the payload response and send as an attachment using MTOM/XOP which JAXWS uses by default. Whether the above gives better performance when dealing with massive payloads? Please clarify.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something about the questions in your last two posts sounds odd. The point of using SOAP toolkits is that they take care of the transport and message handling. Your code need not be concerned about SOAP or XML handling. If you find that you need to do that in order to get around around limitations of SOAP or the SOAP toolkits, it may well be that SOAP is not the best tool for the job. Given the amount of data involved, I think that may well be the case here. Have you considered an approach where the WS returns only the data needed for the client to retrieve the response data by some other means, like FTP or straight HTTP download?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rithanya Laxmi wrote:Thanks Bill. JAXWS supports Streaming API using "StreamingDataHandler" that can be used to stream the data which internally uses STAX API which can speed up the process? Zip the payload response and send as an attachment using MTOM/XOP which JAXWS uses by default. Whether the above gives better performance when dealing with massive payloads? Please clarify.


Like Ulf said, your questions are a bit worrying. If this 500mb of data is not already in XML format /or/ your client needs to be getting a specific XML format, why are you even thinking about STAX. Carefully consider what Ulf said about alternatives.

A zipped binary payload sent as an attachment - sure! Huge savings in bandwidth / transmission time are possible. In that case, the SOAP response should be a tiny portion of the response stream and only serve to report errors or success information not contained in the monster attachment.

If this was my problem I would seriously consider writing the monster data out as a zipped file and only using the SOAP response to send a URL for retrieving the file.

If this same data file would have more than two or three users I would consider sending it to a Cloud server and send the link URL in the SOAP response message.

Bill
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!