There is no <service> element in ews/services.wsdl. WHY?!
- Hi! When i recieved an error trying to generate client from ews/services.wsdl I inspected it's source and found that there is no <service> element at all! Why it is not there? And how can I fix it? Thanx!
All Replies
I manually added the following at the end of services.wsdl :-
...
Code Snippet<wsdl:service name="ExchangeWebService">
<wsdl:port name="ExchangeWebPort" binding="tns:ExchangeServiceBinding">
<soap:address
location="https://myserver/EWS/exchange.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Let me know if you make more progress.- Thanks a lot. Now everything seems fine. Stub classes are generated. But... In Exchange SDK tutorial for C# everything is working around ExchangeServiceBinding class. It is used to set login/pass, domain and endpoint.
ExchangeServiceBinding esb = new ExchangeServiceBinding();
esb.Credentials = new NetworkCredential("username", "password", "domain");
esb.Url = "https://CAS01.contoso.com/EWS/exchange.asmx";
But with jaxws (java toolkit for webservices development) there is no such class. When I should specify access parameters? I'm new to web services at all, so may be I don't understand something. Can you clearify situation for me? - Iam pretty much in the same boat. Could not get a web service client working. Will share as i make more progress.
- All right then... If I'll figure out something I'll share it too. Good luck!
We wrestled with this one for a while before we omitted the wsdl
ervice element. Some may disagree with our decision, but there were several complications/concerns that caused us to choose the path that we did.1. It is not always a good thing to expose machine names or vdir URLs within a WSDL file for security reasons. Although access to the WSDL file is limited to authenticated users in a standard EWS installation, it is easy enough to publish that WSDL file in a non secure place and forget that is contains URLs that you might not want to make public.
2. It is not easy to determine at install time if a given CAS box is actually behind an NLB. If this is the case, the URL in the service section should be the URL of the NLB instead of the URL of the vdir for that specific box. Of course, admins could simply go in and modify the <service> element to point to the external NLB URL, but then they could also just add the service section at that point too.
3. The various Visual Studio tools (and some non-VS ones too) are able to generate proxy classes from a WSDL file that doesn't have the <wsdl
ervice> section. For those that require it, it is simple to add the service element with the appropriate information, but that should be an explicit decision rather than the default one.Hope this helps.
- Hi David! Thast is what I did:
1. Download services.wsdl, messages.xsd and types.xsd to local hard drive.
2. Added following code to the services.wsdl:
<wsdl
ervice name="ExchangeWebService">
<wsdl
ort name="ExchangeWebPort" binding="tns:ExchangeServiceBinding">
<soap:address location="https://<server>/EWS/exchange.asmx" />
</wsdl
ort>
</wsdl
ervice>
3. Try to generate stub usnig JAX-WS toolset from SUN. There was an xml parse error "undefined attribute 'xml:lang' in this place in types.xsd:
<xs:complexType name="ReplyBody">
<xs
equence>
<xs:element minOccurs="0" maxOccurs="1" name="Message" type="xs
tring" />
</xs
equence>
<!-- here was an error --> <xs:attribute ref="xml:lang" use="optional" /> <!-- here was an error --></xs:complexType>
What was wrong with it?
As fast workaround I just deleted "<xs:attribute ref="xml:lang" use="optional" />"
Are all previous steps correct? Is https://<server>/EWS/exchange.asmx correct end-point link?
But then in stub I did not found any refference to the https://<server>/EWS/exchange.asmx. Why is that so? Probably it is questyion to JAXWS... But anyway, do you have any recommendations as to access exchange web services from java?
Please!!! Your workaround will work as long as you never need to set a language on the reply body. Since this is inbound only, it shouldnt' cause a problem. Notice that it is optional. The xml:lang reference comes from the following at the beginning of the types.xsd schema file
<
xs:import namespace="http://www.w3.org/XML/1998/namespace"/>Not exactly sure why JAXWS would complain about that (I am not a Java dev, so I can't help you much there). Is there a way to reference external namespaces when calling JAXWS?
Regarding the reference to the end point, the path looks correct to me. Whether or not a proxy generator emits the reference into the generated classes is really a function of the proxy generator. For instance with the Visual Studio generator, it does, but it also allows you to override it via the Uri property on the ExchangeServiceBinding. It could be that their proxy generator does some validation on the WSDL (and fails due to the missing service element), but once you add the service element, maybe it doesn't use it for anything - or maybe it sticks the information info a configuration file along side the proxy. This is just a guess. You might want to ping a JAXWS forum to figure out what is going on there.
Thanks
- David, that namespace import refers to an obsolete schema document. The document at that URL contains this warning:
!!!THIS SCHEMA DOCUMENT IS OUT OF DATE!!! It uses a preliminary W3C XML Schema syntax which has been superseded. The up-to-date version is at http://www.w3.org/2001/xml.xsd
I guess that the Java tools do not like the old schema syntax.
The correct import element would be:
<import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
This correction allows me to compile the WSDL with the Java "wsimport" tool in Metro
Good to know about the outdated namespace - I will make a note of it.So when I have generated the classes with jaxws, what is the equivalent code in Java for logging into the webservice:
C#:
ExchangeServiceBinding esb = new ExchangeServiceBinding();
esb.Credentials = new NetworkCredential("username", "password", "domain");
esb.Url = "https://myserver/EWS/exchange.asmx";
Java:
ExchangeServices exchangeServer = new ExchangeService();
???...
Where I have to put the login data (username, password, domain)?
- Any luck with this? Has anyone been able to successfully get the wsdl working in Java? If so, can you please post some sample code?
I've added the <wsdl
ervice> tag and generated the proxies just fine. The problem I have is, I think, with authentication. After I've created an ExchangeService and the service port, and set the user/password:ExchangeServices services =
new ExchangeServices();ExchangeServicePortType proxy = services.getExchangeServicePort();
// Set the user ID/password((BindingProvider) proxy).getRequestContext().put(BindingProvider.
USERNAME_PROPERTY, userID);((BindingProvider) proxy).getRequestContext().put(BindingProvider.
PASSWORD_PROPERTY, password);I get the following exception when making a method call on the proxy:
Failed to get valid Active Directory information for the calling account. Confirm that it is a valid Active Directory account.
I don't think it's an issue with the AD, but rather the user credentials are not being set properly.
Any suggestions on what I'm doing wrong? I've also tried implementing an Authenticator and setting it as the default, but it never gets called.
Thanks,
Karl.
Try adding the domain to the creds to make sure that it isn't resolving to an account that is local to the box instead of a domain account.


