Go Back   DocuSign Forums > DocuSign Developer Community > DocuSign API Integration (Java)

Reply
 
Thread Tools Display Modes
  #1  
Old 10-27-2009, 09:35 AM
idc idc is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default Request PDF Problem

Hello,

I am using Docusign API 3.0 with Production account. I am facing a problem when I try to download the document. While debugging I found that the input stream ends (terminates) after it read 8745 bytes.

Below is the code :

Code:
	
public File downloadSignedDocument(String envelopeId, String path)
	throws ServiceException 
	{
		File f = null;
				
		RequestPDF requestPdf = new RequestPDF();
		requestPdf.setEnvelopeID(envelopeId);
		
		try 
		{
			RequestPDFResponse requestPDFResponse = wsApi.RequestPDF(requestPdf);
			DataHandler dataHandler = requestPDFResponse.getRequestPDFResult().getPDFBytes();
			File dir = new File(path);
			FileUtils.forceMkdir(dir);
			
			f = new File(dir, MiscUtil.generateTimeBasedUUID()+ ".pdf");
			FileOutputStream out = new FileOutputStream(f);
			IOUtils.copyLarge(dataHandler.getInputStream(),out,true);
			out.close();
			
		} catch (Exception e) {
			e.printStackTrace();
			throw new ServiceException("Failed to download pdf for envelopeId :" + envelopeId, e);
		}
		
		return f;
	}
I tried using different envelope id but it failed for all after reading 8745 bytes. Please help.

Thanks

Swapnil
Reply With Quote
  #2  
Old 10-27-2009, 10:10 AM
mikeb mikeb is offline
Manager of Professional Services
 
Join Date: Aug 2008
Location: Seattle, WA
Posts: 185
Default

Hi Swapnil!

There is no such limitation on our service. Are you sure your client side config doesn't limit the size of the stream?

Do you have axis config files or CXF config that you might be able to alter?
__________________
--
Mike Borozdin / DocuSign Professional Services
Reply With Quote
  #3  
Old 10-27-2009, 01:09 PM
idc idc is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default

Mike,

This is the config file (axis2.xml) I am using :
Code:
<?xml version="1.0" encoding="UTF-8"?>

<axisconfig name="AxisJava2.0">

	<module ref="addressing" />
	<module ref="rampart" />

	<parameter name="OutflowSecurity">
		<action>
			<items>UsernameToken</items>
			
			<!-- Do not modify these values as they are replaced by the 'ant configure' command. -->
			<user>4b88101e-dbe9-4e12-bc33-f26ea637dc84</user>
			
			<passwordCallbackClass>net.docusign.wsclient.Authenticator</passwordCallbackClass>
			<passwordType>PasswordText</passwordType>
		</action>
	</parameter>

	<!-- ================================================= -->
	<!-- Message Receivers -->
	<!-- ================================================= -->
	<!--This is the Default Message Receiver for the system , if you want to have MessageReceivers for -->
	<!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
	<!--any operation -->
	<!--Note : You can override this for particular service by adding the same element with your requirement-->
	<messageReceivers>
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
			class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver" />
		<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
			class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
	</messageReceivers>

	<!-- ================================================= -->
	<!-- Transport Outs -->
	<!-- ================================================= -->

	<transportSender name="http"
		class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
		<parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
		<parameter name="Transfer-Encoding" locked="false">
			chunked
		</parameter>
	</transportSender>
	<transportSender name="https"
		class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
		<parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
		<parameter name="Transfer-Encoding" locked="false">
			chunked
		</parameter>
	</transportSender>

	<phaseOrder type="InFlow">
		<!--  System predefined phases       -->
		<phase name="Transport">
			<handler name="RequestURIBasedDispatcher"
				class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
				<order phase="Transport" />
			</handler>
			<handler name="SOAPActionBasedDispatcher"
				class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
				<order phase="Transport" />
			</handler>
		</phase>
		<phase name="Addressing">
			<handler name="AddressingBasedDispatcher"
				class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
				<order phase="Addressing" />
			</handler>
		</phase>
		<phase name="Security" />
		<phase name="PreDispatch" />
		<phase name="Dispatch"
			class="org.apache.axis2.engine.DispatchPhase">
			<handler name="RequestURIBasedDispatcher"
				class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher" />
			<handler name="SOAPActionBasedDispatcher"
				class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher" />
			<handler name="RequestURIOperationDispatcher"
				class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher" />
			<handler name="SOAPMessageBodyBasedDispatcher"
				class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher" />
			<handler name="HTTPLocationBasedDispatcher"
				class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher" />
			<handler name="GenericProviderDispatcher"
				class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher" />
			<handler name="MustUnderstandValidationDispatcher"
				class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher" />
		</phase>
		<phase name="RMPhase" />
		<!--  System predefined phases       -->
		<!--   After Postdispatch phase module author or service author can add any phase he want      -->
		<phase name="OperationInPhase">
			<handler name="MustUnderstandChecker"
				class="org.apache.axis2.jaxws.dispatchers.MustUnderstandChecker">
				<order phase="OperationInPhase" />
			</handler>
		</phase>
		<phase name="soapmonitorPhase" />
	</phaseOrder>
	<phaseOrder type="OutFlow">
		<!--      user can add his own phases to this area  -->
		<phase name="soapmonitorPhase" />
		<phase name="OperationOutPhase" />
		<!--system predefined phase-->
		<!--these phase will run irrespective of the service-->
		<phase name="RMPhase" />
		<phase name="PolicyDetermination" />
		<phase name="MessageOut" />
		<phase name="Security" />
	</phaseOrder>
	<phaseOrder type="InFaultFlow">
		<phase name="Addressing">
			<handler name="AddressingBasedDispatcher"
				class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
				<order phase="Addressing" />
			</handler>
		</phase>
		<phase name="Security" />
		<phase name="PreDispatch" />
		<phase name="Dispatch"
			class="org.apache.axis2.engine.DispatchPhase">
			<handler name="RequestURIBasedDispatcher"
				class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher" />
			<handler name="SOAPActionBasedDispatcher"
				class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher" />
			<handler name="RequestURIOperationDispatcher"
				class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher" />
			<handler name="SOAPMessageBodyBasedDispatcher"
				class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher" />
			<handler name="HTTPLocationBasedDispatcher"
				class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher" />
			<handler name="GenericProviderDispatcher"
				class="org.apache.axis2.jaxws.dispatchers.GenericProviderDispatcher" />
			<handler name="MustUnderstandValidationDispatcher"
				class="org.apache.axis2.jaxws.dispatchers.MustUnderstandValidationDispatcher" />
		</phase>
		<phase name="RMPhase" />
		<!--      user can add his own phases to this area  -->
		<phase name="OperationInFaultPhase" />
		<phase name="soapmonitorPhase" />
	</phaseOrder>
	<phaseOrder type="OutFaultFlow">
		<!--      user can add his own phases to this area  -->
		<phase name="soapmonitorPhase" />
		<phase name="OperationOutFaultPhase" />
		<phase name="RMPhase" />
		<phase name="PolicyDetermination" />
		<phase name="MessageOut" />
		<phase name="Security" />
	</phaseOrder>
</axisconfig>
Thank you.
Reply With Quote
  #4  
Old 10-28-2009, 06:28 PM
mikeb mikeb is offline
Manager of Professional Services
 
Join Date: Aug 2008
Location: Seattle, WA
Posts: 185
Red face

Hi there! I looked around the web and I have not seen a way to set the response size... that setting is available in WCF (.NET) but of course that doesn't help right now.

There is another issue that could be affecting your situation. Are you behind some sophisticated firewall like F5? That can terminate your stream.

-mb
__________________
--
Mike Borozdin / DocuSign Professional Services
Reply With Quote
  #5  
Old 10-29-2009, 09:57 AM
idc idc is offline
Member
 
Join Date: Oct 2009
Posts: 7
Default

Hello Mike,

I am not using any firewall while testing this. BTW, let me give you more details.

I used axis2-1.4.1 to generate java proxy. While creating java proxy from the WSDL, I had selected "Generate a synchronous client". Is this okay?

Thanks

Swapnil
Reply With Quote
  #6  
Old 10-29-2009, 10:38 AM
mikeb mikeb is offline
Manager of Professional Services
 
Join Date: Aug 2008
Location: Seattle, WA
Posts: 185
Red face

Hi!

I think this calls for a live debugging session. Why don't you contact your account manager and we will set up some live debugging.

Thanks!
__________________
--
Mike Borozdin / DocuSign Professional Services
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 08:38 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
DocuSign, Inc. 2003-2009