Doing simple things to make great life

Exchange Server 2007 Web service, SOAP

Posted by kalaimaan on January 29, 2009


I like the share my Exchanges web service knowledge. Check the steps to generate the webservice package, installation of Exchanges server and prerequisite details

Prerequisite installation

Installation Steps for Exchange Server 2007:

Step1: Install windows 2003 x64 Standard Edition with service pack 2.

Step2: Install IIS service using windows component.

Step3: Install Active directory with DNS configuration.

Step4: Install .Net Frame work 2.0 x64 with latest service pack.

Step5: Install Power Management shell x64

Step6: Install MMC Controller x64

Step7: Installing required windows patch

Step8: Setting required properties for install MS Exchange server 2007

Step9: Install Ms Exchange server 2007 standard Edition.

To install Active directory with Domain control.

  1. Click Start, click Run, type dcpromo, and then click OK.
  2. On the first page of the Active Directory Installation Wizard, click Next.
  3. On the next page of the Active Directory Installation Wizard, click Next.
  4. On the Domain Controller Type page, click Domain Controller for a new domain, and then click Next.
  5. On the Create New Domain page, click Domain in a new forest, and then click Next.
  6. On the New Domain Name page, in the Full DNS name for new domain box, type NewDomain.local, and then click Next.
  7. On the Database and Log Folders page, accept the defaults in the Database folder box and the Log folder box, and then click Next.
  8. On the Shared System Volume page, accept the default in the Folder location box, and then click Next.
  9. On the DNS Registration Diagnostics page, click Install and configure the DNS server on this computer and set this computer to use this DNS server as its preferred DNS Server, and then click Next.
  10. On the Permissions page, click Permissions compatible only with Windows 2000 or Windows Server 2003 operating systems, and then click Next.
  11. On the Directory Services Restore Mode Administrator Password page, enter a password in the Restore Mode Password box, retype the password to confirm it in the Confirm password box, and then click Next.
  12. On the Summary page, confirm the information is correct, and then click Next.
  13. When prompted to restart the computer, click Restart now.
  14. After the computer restarts, log on to Administrator.

To install IIS on Windows Server 2003

  1. Click Start, point to Control Panel, and then click Add or Remove Programs.
  2. In Add or Remove Programs, click Add/Remove Windows Components.
  3. In the Windows Components Wizard, under Components, select Application Server.


    Selecting Application Server performs a default installation of Internet Information Services (IIS) and includes components that are not necessary for Certificate Services. In most cases, this installation is acceptable for an isolated test environment. However, if you plan to connect your test environment to your production network, consult your organization’s security policy to determine which components to install.
  4. Click Next.
  5. After the wizard completes the installation, click Finish

To Install Exchange server 2007 in windows 2003

Reference : Exchange Server 2007 Guide.odt

How to create Exchange server stub to access.

Step 1:

Download Axis2 1.3 version from Apache axis tomcat

Step 2:

Place the folder axis2-1.3 in c drive

Step 3:

We have to set the following path in Enviorenment variable and the below is the sample

Please set the correct path for the corresponding “Variable Name”

1. AXIS_HOME – C:\axis2-1.3

2. JAVA_HOME – C:\Program Files\Java\jdk1.5.0_05

3. TOMCAT_HOME – C:\Program Files\Apache Software Foundation\Tomcat 5.0

4. JWSDP_SHARED – C:\Program Files\Apache Software Foundation\Tomcat 5.0\jwsdp-shared;

5. ANT_HOME – D:\MsExchangeServer-WorkFolder\Axis – Java\apache-ant-1.7.0-bin\apache-ant-1.7.0

6. PATH – %AXIS2_HOME%\bin;%AXIS_HOME%\webapp; %ANT_HOME%\bin;%TOMCAT_HOME%\common\lib; %JWSDP_SHARED%\bin;%JWSDP_SHARED%\lib; %JWSDP_SHARED%\webapps\jwsdp-callback\WEB-INF\classes

Step 4:

In the folder axis2-1.3 we have a bin folder. Open the cmd window and enter into

the path “C:\axis2-1.3\bin.”

<wsdl:service name=”ExchangeService”>

<wsdl:port name=”ExchangeServicePort” binding=”tns:ExchangeServiceBinding”>

<soap:address location=”<ExchangeServer>”/>



Place the Excahange server Wsdl and XSd file under bin folder and run the below command using “cmd prompt”

wsdl2java -d xmlbeans -s -ss -g -o ews -uri Services.wsdl

you can generate the set of java package for Exchange web service. Generate the Stub using the package

Have a Good Day 🙂


6 Responses to “Exchange Server 2007 Web service, SOAP”

  1. Adrien said

    Hi all!

    I am having some troubles to generate the pakages with axis2-1.3:

    i tryed with and without modified Services.wsdl and xsd files:

    wsdl2java -d xmlbeans -s -ss -g -o ews -uri Services.wsdl: gives me:

    C:\Documents and Settings\Adrien>wsdl2java -d xmlbeans -s -ss -g -o ews -uri Services.wsdl
    Using AXIS2_HOME: C:\java\axis2-1.3
    Using JAVA_HOME: C:\java\jdk1.6.0_01
    Retrieving schema at ‘messages.xsd’, relative to ‘file:/C:/Documents%20and%20Settings/Adrien/’.
    Retrieving schema at ‘types.xsd’, relative to ‘file:/C:/Documents%20and%20Settings/Adrien/messages.xsd’.
    [INFO] Resolving schema with publicId [http://schemas.microsoft.com/exchange/services/2006/messages] and systemId [messages.xsd]
    [INFO] Resolving schema with publicId [http://schemas.microsoft.com/exchange/services/2006/types] and systemId [types.xsd]
    Exception in thread “main” org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:265)
    at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
    at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
    Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:114)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:218)
    … 2 more
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension.engage(XMLBeansExtension.java:103)
    … 3 more
    Caused by: java.lang.RuntimeException: org.apache.xmlbeans.XmlException: project://local/types.xsd:51:1: error: cvc-enum
    eration-valid: string value ‘none’ is not a valid enumeration value for type of processContents attribute in xs:wildcard

    at org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:319)
    … 8 more
    Caused by: org.apache.xmlbeans.XmlException: project://local types.xsd:51:1: error: cvc-enumeration-valid: string value
    ‘none’ is not a valid enumeration value for type of processContents attribute in xs:wildcard
    at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:225)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667)
    at org.apache.axis2.xmlbeans.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:183)
    … 8 more

    i dont find that xs:wildcard on any my .xsd files…
    line 51 of types.xsd ?!? not found…

    When i tryed to generate with eclipse, some classes were missing like ExchangeWebServiceStub

    i read some HervĂ© posts and tryed a lot of stuff but no succes to comunicate with exchange 2007…

    somenone have any clue?



  2. dream said

    I followed you instructions, i used your classes…but i get this error:

    org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
    at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:298)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:192)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
    at com.microsoft.schemas.exchange.services._2006.messages.ExchangeServicesStub.GetFolder(ExchangeServicesStub.java:1002)
    at project1.Class1.getInboxId(Class1.java:102)
    at project1.Class1.main(Class1.java:63)

    Could you help me please?
    Maybe there is a problem in exchange configuration?
    Could you send me your configuration about authentication on MS Exchange?
    Thanks a lot…

  3. C McCormick said

    You’ll see that problem when the URL points to the WSDL directly. Use this WSDL instead:

  4. Hi All,

    I am using Exchange 2007 Web Services’s stub (Java Client) for communicating with Exchange 2007 server (with service pack 3). I create stub from WSDL file using Axis2 tool.

    I am able to make connection with Exchange 2007 stub but when we create new task item, it returns an error message. That is,

    Exception in thread “main” java.lang.IllegalArgumentException: Null OutputStream specified
    at org.apache.xmlbeans.impl.store.Cursor._save(Cursor.java:577)
    at org.apache.xmlbeans.impl.store.Cursor.save(Cursor.java:2544)
    at org.apache.xmlbeans.impl.values.XmlObjectBase.save(XmlObjectBase.java:209)
    at com.microsoft.schemas.exchange.services._2006.messages.ExchangeServicesStub$54.serialize(ExchangeServicesStub.java:13598)

    The code lines, which I am using for creating new task item, are,

    CreateItemResponseDocument response = m_EWSservice.CreateItem(createItemDocument,

    While debugging the code, error occurs at following line,


    Please give me your thought about this issue.

  5. apa benda said

    apa benda…

    […]Exchange Server 2007 Web service, SOAP « Kalaimaan[…]…

  6. Canon Xa10 Camcorder…

    […]Exchange Server 2007 Web service, SOAP « Kalaimaan[…]…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: