Skip to content
This repository

Here are the simple steps. First we are going to start out with a simple Java project. If you already have a project, you do not need to set one up. Step 1

We are going to bypass creating any GUI here and just create a simple JUnit test. This will get us right to the web service call. NetBeans 7.0 allows you to create a JUnit test really easily and will import the correct libraries. Step 2

I tried importing the web service directly from the ASMX endpoint or the ASMX?WSDL url, but that didn’t work so well. What did work well was downloading the WSDL onto my desktop by going to this URL https://demo.docusign.net/api/3.0/dsapi.asmx. Note that unlike our WS-Security endpoint, which ends with api.asmx, the dsapi.asmx uses the DocuSign HTTP security header. Step 3

Click on the Service Description and save the WSDL file somewhere on your hard drive.

Next step is creating a web service client. This functionality is built into NetBeans as well. Step 4

You will need to navigate to the downloaded WSDL file and specify the package as dsAPI to copy and paste my unit test code below. Step 5

Once you got the web service client set up you can go and fill out the test setup and create a simple test. For this you will need to get your developer account on www.docusign.com/devcenter

Copy this test setup function:

@Before

public void setUp() {

String auth = new String("<DocuSignCredentials><Username>mikeb@docusign.com</Username><Password>*****</Password><IntegratorKey>B111-c81ec71a-cba7-4aa1-b1aa-9513115caf02</IntegratorKey></DocuSignCredentials>");

net.docusign.api._3.DSAPIService service = new net.docusign.api._3.DSAPIService();

port = service.getDSAPIServiceSoap();

((BindingProvider)port).getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS,

Collections.singletonMap("X-DocuSign-Authentication",Collections.singletonList(auth)));

}

Now create a simple test. You will need to plug in your account id here to make it work right away.

@Test

public void requestStatusChanges() throws DatatypeConfigurationException {

EnvelopeStatusChangeFilter filter = new EnvelopeStatusChangeFilter();

GregorianCalendar cal = new GregorianCalendar(2011, Calendar.APRIL, 1);

filter.setStatusChangedSince(DatatypeFactory.newInstance().newXMLGregorianCalendar(cal));

filter.setAccountId("766e7948-6866-4ee3-9ea1-4153613dc14f");

FilteredEnvelopeStatusChanges changes = port.requestStatusChanges(filter);

System.out.println( "Changed envelopes: " + changes.getEnvelopeStatusChanges().getEnvelopeStatusChange().size() );

}

Fix the references and run the test -- it should pass. Now you are successfully getting statuses of everything that was changed since April Fools day in 2011.

Finally using DocuSign API is as easy from Java as it is from Visual Studio. Great work NetBeans team!

-mb

Something went wrong with that request. Please try again.