wsdl webservice from Outlook Web App

August 1, 2011 at 3:42 pm Leave a comment

I’m trying to figure out what the Webservice for an Outlook Web App (OWA) can provide me with.

So far, this doesn’t work but I hope I’ll manage to get it to work during this post.

I had the URL for webservice. It look something like this:

Then I wanted to create the client-class-stubs via wsimport . I tried running wsimport from the command line.

First problem: I have to use a proxy. As wsimport works from the console I tried setting the proxy there. As I use Windows 7 proxycfg wasn’t the correct command any more but I had to use

netsh winhttp set proxy

In case you have put explicity proxy information into the system settings of IE netsh winhttp import proxy source=ie might help. But I only have an automatic configuration there and that didn’t carry over to the command line proxy configuration.

Then I figured that wsimport had it’s own proxy argument and I could get the result via:


This got me the following error message:

[ERROR] Server returned HTTP response code: 401 for URL:,  "" needs authorization, please provide authorization file with read access at C:\Users\winusername\.metro\auth or use -Xauthfile to give the authorization file and on each  line provide authorization information using this format : http[s]://user:password@host:port//<url-path>

So I created a file myuni.txt with the line:

(At first I mistakenly thought that I was supposed to download the SSL certificate, but that wasn’t the case.)

I than ran:

wsimport -Xauthfile myuni.txt

However I ran into:

parsing WSDL...
[ERROR] Server redirected too many  times (20),  "" needs authorization, please provide authorization file with read access at C:\Users\winusername\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format: http[s]://user:password@host:port//<url-path>

I didn’t know how to solve this, so followed Ravi C Kota’s suggestion on Code Ranch to just download the wsdl-file.

However I than got:

 At least one WSDL with at least one service definition needs to be provided.
        Failed to parse the WSDL.

Maybe I have the same problem as Henning Mahlzahn over at

Unfortunately Henning Mahlzahn only links to the URL

saying it describes how to change the wsdl file. As this URL is down, I tried to figure out how to correct my wsdl by looking at the amazon.wsdl file at:

Infering from that file I added a service definition in my wsdl file before the last line and after the last </wsdl:binding>. Including the two surrunding lines I had:

    <wsdl:service name="ExchangeService">
        <wsdl:port name="ExchangeServicePortType" binding="tns:ExchangeServiceBinding">
            <soap:address location=""/>

Where I made up the name “ExchangeService”, an I got the names for port and binding from the lines:

   <wsdl:portType name="ExchangeServicePortType">


   <wsdl:binding name="ExchangeServiceBinding" type="tns:ExchangeServicePortType">

(On my first try I forgot the “wsdl:”-namespace in front of the port so I got the following error:

parsing WSDL…

Exception in thread “main” Encountered error in wsdl. Check namespace of element <port>

Now the parsing worked a little further and I got to the point where I need the file

parsing WSDL...
[ERROR] C:\cwd\messages.xsd (Das System kann die angegebene Datei nicht finden)

[WARNING] schema_reference.4: Failed to read schema document 'messages.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.  line 5 of file:/C:/crw/modified.Services.wsdl.xml#types?schema1

So I had to download all the files Henning Malzahn listed in his posting: : Services.wsdl, messages.xsd and types.xsd

Those files are located in the same directory on your exchange server as the wsdl. In my case:

Running wsimport now got me the new errors:

parsing WSDL...
[WARNING] src-resolve: Cannot resolve the name 'xml:lang' to a(n) 'attribute declaration' component.
  line 3921 of file:/C:/cwd/types.xsd
[WARNING] s4s-elt-invalid-content.1: The content of 'ReplyBody' is invalid.  Element 'attribute' is invalid, misplaced, or occurs too often.
  line 3921 of file:/C:/cwd/types.xsd
[ERROR] undefined attribute 'xml:lang'  line 3921 of file:/C:/cwd/types.xsd

Those errors all reference some line in types.xsd. As the line had a “use=\”optional\”” attribute, I thought I could just comment it out. So I had the following:

<xs:complexType name=”ReplyBody”>
<xs:element minOccurs=”0″ maxOccurs=”1″ name=”Message” type=”xs:string”/>
<!–    <xs:attribute ref=”xml:lang” use=”optional”/>–>

All these changes resulted in compiling code:

parsing WSDL…

generating code…

compiling code…

Note: C:\cwd\.\com\
microsoft\schemas\exchange\services\_2006\messages\ uses unche
cked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

Now I had to check whether I could use the Web Service features from within Java and I wasn’t too sure about it because I had come across a posting by cheeso on Connecting to Exchange using JAX-WS, part 1 – All About Interop – Site Home – MSDN Blogs where he lists these things he had to do before he was able to use the Web Service:

Let me summarize what I did to get Java to talk to Exchange:

  • Modified the exchange.wsdl to include a service definition, and to remove all occurrences of impersonation, S2SAuth, and MailboxCulture from each wsdl:message.
  • Modified the types.xsd to eliminate the ref=”t:Path”, and replace it with actual elements
  • Use Fiddler2 to trace and debug the SOAP messages.

I forgot to add the -keep option to my wsimport statement. I added it in order to get coding help from eclipse.

At this point I stopped trying for now. What I did was trying to use the amazon web service but it then I read that amazon’s webservice based on soap is not compatible with JAX-WS and that one should use JAX-RPC. Now I wonder whether exchange is compatible.


Entry filed under: Uncategorized.

Android ViewMap example – a beginner’s very basic observations Problem: maven error opening zip file Solution: delete .m2 for a fresh start

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Blog Stats

  • 16,203 hits

%d bloggers like this: