hi All, I would like to share my experience to connecting ms crm with java code...
Its not difficult to connect ms crm 3.0 with java code using both
ntlm and
basic authentication..
First Step: download web service description files(CrmService.asmx, MetadataService.asmx) from Mircosoft Dynamics CRM
And convert to equivalent java classes
create a folder CrmService and execute this command
java -classpath C:\java\axis-1_4\lib\axis.jar;C:\java\axis-1_4\lib\activation.jar;C:\java\axis-1_4\lib\mail.jar;C:\java\axis-1_4\lib\axis-ant.jar;C:\java\axis-1_4\lib\commons-discovery-0.2.jar;C:\java\axis-1_4\lib\commons-logging-1.0.4.jar;C:\java\axis-1_4\lib\jaxrpc.jar;C:\java\axis-1_4\lib\log4j-1.2.8.jar;C:\java\axis-1_4\lib\saaj.jar;C:\java\axis-1_4\lib\wsdl4j-1.5.1.jar org.apache.axis.wsdl.WSDL2Java -v -a -O -1 CrmService.wsdl -o ./CrmService
pause
do the same for metadataservice to convert to java code.
combine both sources..
Create new project in your eclipse, and test login..
For basic authentication , we can use axis1.4 file
To connect with ntlm authentication, we have to edit the client-config.wsdd file in axis1.4 jar, Hope that you all know about this.. please comment if you need further help with this..
/*added on +20101220 */
easy way to edit is: open the axis.jar file with winrar application
go to the folder org->apache->axis->client and open the file client-config.wsdd and edit the following changes and save. check once again the changes are there.
/*********/
The following is the sample client-config.wsdd
<?xml version="1.0" encoding="UTF-8"?>
<deployment name="defaultClientConfig"
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalconfiguration>
<parameter name="disablePrettyXML" value="true">
</globalconfiguration>
<transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender">
<transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender">
<transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender">
</deployment>
Along with axis jar, we need these two(commons-httpclient-3.1.jar, commons-codec-1.3.jar) jar files in our class-path to get ntlm authentication
sample code to login
CrmServiceSoapStub stub = (CrmServiceSoapStub)
new CrmServiceLocator().getCrmServiceSoap(
new URL("http://###.###.#.###/MSCRMServices/2006/CrmService.asmx"));
stub.setUsername("crm\\user");
stub.setPassword("#######");
WhoAmIRequest request=new WhoAmIRequest();
WhoAmIResponse response=(WhoAmIResponse)stub.execute(Request);
System.out.println("----------getBusinessUnitId()--------->"+response.getBusinessUnitId());
System.out.println("----------getUserId()----------------->"+response.getUserId());
//can write on next post about
connecting mscrm 4.0 with java code