Interactive Address Validation with Web Services (java)

First, obtain a developer login and password from DuoShare and then get the PostML wsdl. The WSDL has embedded api documentation.
https://duoshare.com/dsWS/services/PostML/wsdl

To validate an address you will need to download JDaqi (DuoShare Address Quality Integrator in Java), available here.

Now, you will need to create a class file that uses the PostMLService class inside the JDAQI jar file. Remember, customerpk (your DuoShare customer primary key), is a required field.

import com.ds.web.services.PostMLService;
import com.ds.web.services.ejbr.WsPostalinputRecord;
import com.ds.web.services.ejbr.WsPostaloutputRecord;

public class PostMLDemo {

	public static void main(String[] args) throws Exception {
		
		String user = "";
		String pass = "";
		long customerpk = -1; //REQUIRED
		
		String endpoint = "https://duoshare.com/dsWS/services/PostML";
		PostMLService postML = new PostMLService(user, pass, endpoint);
		
		WsPostalinputRecord input = new WsPostalinputRecord();
		
		input.setCustomerpk(customerpk);
		input.setUnparsednameinput("John \"Hello World\" Doe");
		input.setFirmorrecipientinput("DuoShare");
		input.setDeliveryaddressline1Input("10401 Miller Rd #150");
		input.setLastlineinput("Dallas TX 75238");
		
		WsPostaloutputRecord output = postML.validateInteractive(input);
		
		System.out.println(output.getUnparsednameanswer());
		System.out.println(output.getFirmorrecipientanswer());
		System.out.println(output.getDeliveryaddressline1Answer());
		System.out.println(output.getLastlineanswer());
	}
}

When you run the demo class, put the JDAQI jar on the classpath:

java -classpath .;JDaqi.jar PostMLDemo

  Register   |    Company   |   Contact   |   Legal   |    Site Map   |    ©2000-2008 DuoShare. All rights reserved