Jump to content
Farid

WSDL & XSD

Recommended Posts

Hello everybody! :) I'm actually trying to develop a Webservices using WSDL and XSD files. But I don't really know about this. I rode some tutorials (w3cschools one included, and a pretty good one) but I have still some questions. I hope someone could help me.So, actually I started to do the JAVA code but I need to respect some laws and so I cannot generate the files from Eclipse. So, here are my questions:- what is the Vector type in a XSD file?- with

<xsd:sequence minOccurs="0" maxOccurs="unbounded">

can we do a list of any type? I mean does it correspond to String[] in JAVA for example?- do every attributes put in the XSD files have to be entered by the client or I can put some others used in the functions (so in the JAVA code) but dont entered by the client?- is there someone who can explain me how the actor attribute of the header in SOAP works?- does anybody have an example of WSDL code and the JAVA code associated?Thanks in advance. :)

Share this post


Link to post
Share on other sites

I think you've got Schema totally wrong. It's not at all about declaring sequences. It's about declaring what can appear in another XML document.The sample you've shown allows the elements that are childs of this element to appear in the order they appear in the schema. And the min and max occurs specify how many times this sequence can appear. In this case, the sequence is optional and can go up to any number. For example:

	<xs:element name="SCAMA">		<xs:complexType>			<xs:sequence minOccurs="0" maxOccurs="unbounded">				<xs:element ref="USERS"/>				<xs:element ref="GROUPS"/>			</xs:sequence>		</xs:complexType>	</xs:element>

Would mean that the XML

<SCAMA/>

is valid, and so are the following two

<SCAMA><USERS/><GROUPS/></SCAMA>

<SCAMA><USERS/><GROUPS/><USERS/><GROUPS/><USERS/><GROUPS/></SCAMA>

but this one won't be valid, because GROUPS has switched places with USERS:

<SCAMA><GROUPS/><USERS/></SCAMA>

This is what Schema is all about. Having that said, what do you mean by this "Vector type" thingy? Also, what do you mean by having clients enter attributes in XSD? You should have your own XSD file, not adjustable by third parties, and verify inputted XML data by using it. Allowing clients to adjust it is like allowing them to define what is your application capable of, which is ridicilous.The exact JAVA code you'd use to verify an XML against its schema varies depending on the validator you'll be using. JAVA has a built in validator, but I'm not experienced in JAVA, so I don't know how you can call it.The same goes for SOAP, but I don't think JAVA has a SOAP API built in. You need to find one yourself. By using this API, JAVA will automatically generate a SOAP request and receive a response based on the descriptions in WSDL. You don't need to know the syntax of WSDL to do that. A good JAVA API is also going to allow you to generate WSDL files for a SOAP server you have, so that others can easily opt in.

Share this post


Link to post
Share on other sites

Thanks boen_robot!Ok, sorry, I just needed more time to understand well! I've done some exercises and now, it's clear!Actually, I did the "code-first" and it's not what I have to do. I mean, to get a better interoperability, I have to start with the WSDl & XSD files. By the way, as I didn't do a WS from my JAVA code, I don't know what is the file in JAVA (I think it's called the endpoint URL) I have to put in:

<soap:address location="[...]"/>

. Do you (or someone else)?Is it the index.jsp file?

Share this post


Link to post
Share on other sites

The SOAP API, whichever one you choose, will generate the SOAP request for you. You don't need to know the syntax of SOAP for this. You just need to know how to get the WSDL file and invoke a request via the API. Again, the code you'd use depends on the API itself.All in all, I'd say W3Schools' SOAP tutorial is one of the worse tutorials on the site, as it only illustrates ASP as an example on creating a SOAP request and doesn't really explain what the ASP file does - instead focuses on the syntax of SOAP, which in the end is not needed for a web serivice prodider or consumer. It is instead only needed for implementers (i.e. SOAP API vendors).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×