Jump to content
Stadiumite

Baffled by WSDL

Recommended Posts

For the last 18 months or so, I've been creating services from a Rational Rose UML object model. The model is set up sothat operations can be defined on interface classes. This definition includes input and output parameters.I have a generator tool that exports these operations to DTD, XSD, or WSDL. In the case of schema, the operation becomes two complexTypes; one for the request and one for the response. Each input parameter is an element within the request. Each output parm is an element within the response. Classes that those parameters are dependent on also become complexTypes.With DTD or Schema, I can use XMLSpy to "Generate Sample XML", and choose the Request type (or the response type) as theroot. Then I can fill in the contents of my message, and validate it against the schema. So I can produce a sample requestmessage and a sample reponse message.Then I pass the sample messages and schema on to developers who develop code that produces messages that adhere to the schema, and to architects who publish that schema as a contract with our consumers. Make sense?In today's world our services are queue-based. So it's just fine to represent them with a schema.But soon, we'll want to be doing web services. So I want to use a WSDL.I've been playing around with WSDL for the last several days to figure out how to do this, and I am baffled.There seems to be no tool that lets me generate a sample message against a WSDL, in the sense that I could with DTDor XSD. The best I can do is "Create SOAP Request" from the SOAP menu in XMLSpy Enterprise Edition. But that only generatesa request, not a response. And (annoyingly) it creates a tag for every possible element in the message, so the message is sohuge that you can't work with it.Also there's no mechanism to validate messages. So when my customer asks me, "What will our messages look likewhen we're using web services", I can't really answer them. Even though I've declared types in my WSDL, there's no mechanism to actually link the instance documents that represent the request and response to that WSDL. Why did I bother to definemy types at all?I've actually used two different approaches. In the first case, my types are defined within the WSDL itself. In thesecond case, I've imported a schema, and the types of my messages are defined by it. Like this: <xsd:complexType name="serviceXYZRequest"> <xsd:complexContent> <xsd:extension base="importXSD:serviceXYZRequest"/> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="serviceXYZReresponse"> <xsd:complexContent> <xsd:extension base="importXSD:serviceXYZResponse"/> </xsd:complexContent> </xsd:complexType> <message name="ServiceXYZRequest"> <part name="serviceXYZ" type="myWSDL:ServiceXYZRequest"/> </message> <message name="serviceXYZReponse"> <part name="serviceXYZ" type="myWSDL:ServiceXYZRequest"/> </message>Then in my request and response instance documents, I can validate the contents of the message against importXSD. But thisis still only part of what I want to do. If I were to declare attributes or additional elements on the type declaration in the WSDL, there's no way to validate them.

Share this post


Link to post
Share on other sites

I'm not sure if this will help you, but I use ColdFusion to create web services, it does all the work regarding the construction of the WSDL - all I have to do is write my queries or code that gets executed. I've made some pretty complicated web services without know really anything about them - sad, true, and I know not the best place to be in, but it works beautifully.

Share this post


Link to post
Share on other sites

hi, nice to hear from you.. hope I will get chance to learn from you about rational rose..Well, I can try to solve your problem... but I am not getting what exactly you want to know.. please explain me clearly..regards,ashvini

Share this post


Link to post
Share on other sites

You can use WSDL's schema to validate WSDL files. WSDL files themselves are NOT for validation of web serivices or SOAP messages. They describe to WS clients what operations (messages) the WS can perform, and what arguments does each operation take. From then on, the application reading the WSDL file can generate desired SOAP messages with a few lines from the WS client's author, like a simple call to a specified operation, intead of forcing the user to use DOM (which can get quite verbose), or worse yet, use a static file containing the SOAP message.Perhaps it's best I just give an example. Here's An article by Zend describing the PHP SOAP extension. As you'll see, when in WSDL mode, PHP accepts all functions described in the WSDL, generates the proper request and fetches the proper response, storing the real result at that point.... like calling a PHP class from a remote location and not neccesarly written in PHP. That's the beauty of it all.@Skemcin, can CF open an existing WSDL file and edit it with that same API it generates WSDL files on-the-fly? If so, then I don't think the way you generate WSDL files is bad in any way. Infact, opening WSDL files and editing them like that is the whole point of using XML as the description language to begin with. Allow any editor to edit the file and allow vendors to create authoring tools that will reduce the hand work and learning of a new spec to writing a couple of lines in their own API.

Share this post


Link to post
Share on other sites

In an XML instance based on a schema, I can have something like this:<Message xmlns="http://www.whatever.com/xxxx/myXML"'>http://www.whatever.com/xxxx/myXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.whatever.com/xxxx/myXML {path}/ServiceXYZ.xsd">I'm declaring that this message is based on a particular namespace, which is defined in my schema, and I declare where that schema can be found.Am I correct that I can't do something similar if my Message is defined by a WSDL instead of an XSD? I can declare a namespace for a WSDL, and I can declare in my instance document that it complies with constraints of that namespace. But I can't mechanical verify that Message is really valid? This seems like something that's very natural to do. I'm really surprised that it's not there.

Share this post


Link to post
Share on other sites

For the last time: WSDL files themselves are NOT for validation of web serivices or SOAP messages.Look at the example I gave you in my last post. And read the whole post too.WSDL is not an alternative for XML Schema. It does a completely different thing.

Share this post


Link to post
Share on other sites
In an XML instance based on a schema, I can have something like this:<Message xmlns="http://www.whatever.com/xxxx/myXML"'>http://www.whatever.com/xxxx/myXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.whatever.com/xxxx/myXML {path}/ServiceXYZ.xsd">I'm declaring that this message is based on a particular namespace, which is defined in my schema, and I declare where that schema can be found.Am I correct that I can't do something similar if my Message is defined by a WSDL instead of an XSD? I can declare a namespace for a WSDL, and I can declare in my instance document that it complies with constraints of that namespace. But I can't mechanical verify that Message is really valid? This seems like something that's very natural to do. I'm really surprised that it's not there.
Hi, As far as I get your question.No, you can specify WSDL in place of XSD, if your message is define in WSDL. yes, you can declare a namespace for WSDL.But when you talked about XML instance that becomes completely different thing. which nor related to web-services, in exact meaning.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...