views:

46

answers:

2

I'm creating a web-service client. I used a WSDL file to generate the client side stubs. But now I have to authenticate to the web-service, and invoke methods. I've checked some tutorials on how this should be done, but they always explain generating the client code and server code then having them work together.

I was wondering if all the info needed to authenticate and invoke requests is contained within the WSDL file(and thus auto generated code)? Or do I have to also have knowledge of the web-service code?

Any help appreciated.

+1  A: 

A WSDL file does not contain information on the order of invoking certain functions (if any). So, in my opinion there should always be additional documentation.

pritaeas
@pritaeas - ohh k thanks alot, the generated code has some comments that serve as some kind of documentation at least. But I think I really need more documentation indeed, especially for authentication.
ghostlines
+1  A: 

Generally speaking, a WSDL should be all you need (assuming it's been written by someone who knows what they're doing).

A well-written WSDL should have sensible method and parameter names such that the generated client bindings are more or less self-explanatory. Through the <annotation><documentation></documentation></annotation> attribute, comments should be added to resolve any ambiguities. In other words, think about a WSDL just like a JavaDoc API page. You shouldn't need to care about what's inside the black box, just so long as you know what you need to put in and what you'll get out of it.

As for authentication mechanisms there are really two cases to consider: the web service level authentication and application server level authentication.

At an application server level (e.g. Tomcat or GlassFish), the WSDL won't give you indication of the authentication method used (because the WSDL is at a level above the application server). In this case, you can try debugging by accessing the WSDL file in a browser (or maybe try invoking the service in SoapUI) and seeing what you need to be authenticated.

At a web service level the security mechanism should be described in the WSDL. I'm not aware of any IDEs that can automatically recognise the authentication mechanism described in the WSDL and then prompt you to what you need to supply (although I only really use NetBeans). However, you should be able to work it out - either by examining the WSDL or by looking at the error messages your web service client spits out when you try and access a protected resource.

Catchwa