WSDL elements relationships - web-services

I am reading through the web to understand clearly the WSDL and the elements composing WSDL.
Is there a pictorial representation of how the WSDL elements namely
definitions, types, portTypes, port, message, operation, binding and services are related?
For example I understand that if I want to describe a service say calculator; it can do several operations say add, substract, divide and multiply.
So I define portType (calculator) abstract entity that identifies the operations it can perform (add, substract, divide and multiply).
I can then have a binding element that describes how this interface is implemented over different concrete protocols (HTTP, SMTP etc.)
1> So can I have 2 bindings that specify same "calculator" portTypes
one using HTTP and another using SMTP? Can a single WSDL define
multiple services (say calculator, unit converter etc)?
2> Is there a pictorial/descriptive representation of co-relationship
between the WSDL elements (definitions, types, portTypes, port,
message, operation, binding and services)?
3> If my portType describes the operations involved in a service; how
is it different then the service element?
Here are the web links I am trying to formulate my ideas from. These are very helpful but I am trying to get a clear picture of how the WSDL components are related.
References:
http://www.w3.org/TR/wsdl.html
http://msdn.microsoft.com/en-us/library/ms996486.aspx
http://khanna111.com/wordPressBlog/2013/11/21/248/
http://www.w3schools.com/webservices/ws_wsdl_documents.asp

1> So can I have 2 bindings that specify same "calculator" portTypes one using HTTP and another using SMTP?
Yes.
Can a single WSDL define multiple services (say calculator, unit converter etc)?
Yes you can. But both services will be published on different URL, so what will be the point?
2> Is there a pictorial/descriptive representation of co-relationship between the WSDL elements (definitions, types, portTypes, port, message, operation, binding and services)?
3> If my portType describes the operations involved in a service; how is it different then the service element?
I have described these in this post, you can refer
WSDL Details

Related

Connect several web services with same object type

I want to connect several webservices that share common object types. Using the internal tool from VS in the GUI: Add Service Reference… is not an option because it leads to several definitions of the same class types because of the different namespaces.
I tried the command line wsdl:
wsdl /sharetypes /language:CS /namespace:MyNameSpace /out:references.cs /protocol:SOAP http://AddressWS1?wsdl http://AddressWS2?wsdl http://AddressWS3?wsdl
this works, but I am a bit confused because I am used to work with the “app.config” file that does not exist here.
I also tried:
svcutil.exe /language:cs /out: references.cs /config:app.config http://AddressWS1?wsdl http://AddressWS2?wsdl http://AddressWS3?wsdl
it does not work as I get several errors of the type: “The global element xxx has already been declared.”
Is there a better solution?
Thanks for your help
Just because they appear to you (the developer) as the same shapes, the fact that they are in different namespaces, means that they ARE actually different and must be treated as such.
It's entirely possible that if you get your idea to work, one of the WebServices then decides to add another field to its response, but not the others, and then you have to split them again.

How to use IDL's in C++ to bridge system messages

I have essentially two groups of messages bubbling around in my enterprise (over DDS essentially). One group is raw system data and another group is complex visual data.
I have an application that can create publishers and subscribers for most of these messages.
How can I write an .idl file such that it can grab system data instances (multiple), aggregate them perhaps with a little math thrown in and then publish them out as a single visual data message?
It is expected that this application is recompiled with the addition of the generated .IDL.
What i'm looking for is examples of:
how do I write an .idl to handle this conversion
how do I expose the system message subscribers to be useable for the .idl's generated logic
similarly how do I expose the visual publishers to be accessible for the .idl's logic?
please help. Examples would be awesome and/or specific links would be welcome too.
The Interface Definition Language (IDL) is a language that describes data types and interfaces. It is not a 'programming' language in the sense that it does not describe executable code; and therefore, it does not provide a mechanism to operate on data. Specifically, it does not allow you to "grab system data ... and publish them out" -- those tasks are part of the application.
[There are many compilers available to 'compile' IDL defined types and interfaces into standard programming languages. Any available DDS or CORBA implementation will probably include such an IDL compiler.]
So, to accomplish your goal, you'll need to do something like this:
define the desired data type[s] in IDL and compile that to the target programming language
write code to collect the system data in some arbitrary format
write code to assign the system data to the IDL specified data type[s]
write code to publish the data type[s] via a middleware (such as the Data Distribution Service (DDS))

WSDL possible to transfer a FILE type?

A "checkResult" service deployed on a node machine is defined to return the result on the node to a cluster controller that sends the request.The result on node ,which is in the form of file, may vary drastically in length,as is often the case with daily log files.
At first,i thought it might be ok just using a single string to pack the whole content of the file,so i defined
checkResult(inType *in,OutType *out)
where the OutType* is char*. Then i realized that the string could be in KB length or even more. So i wonder whether it is proper to use string here.
I googled a lot and could not find the max length permitted in wsdl(maybe conflict with the local maxbuffer length as well) and did not find any information about transferring a file type parameter either.
Using struct type may be suggested ,but it could be so nested for the file and difficult to parse when some of the elements inside could be nil and absent.
What'd you do when you need to return a file type result or large amount of data in a webservice?
p.s the server and client both in C.
When transferring a large amount of data in a (SOAP) web service request or response, it is generally better practice to use an attachment mechanism versus including the data as part of the body. Probably the order for considering attachment mechanism (broadest to narrowest adoption):
Message Transmission Optimization Mechanism (MTOM) - The newest of these specifications (http://www.w3.org/TR/soap12-mtom/) which is supported in many of the mainstream languages.
SOAP with Attachments - This specification (http://www.w3.org/TR/SOAP-attachments) has been around for many years and is supported in several languages but notably not by Microsoft.
Direct Internet Message Encapsulation (DIME) - This specification (http://bgp.potaroo.net/ietf/all-ids/draft-nielsen-dime-02.txt) was pushed by Microsoft and support has been provided in multiple languages/frameworks including java and .NET.
Ideally, you would be able to work with a framework to give you code stub generation directly from a WSDL indicating MTOM-based web service.
The critical parts of such a WSDL document include:
MTOM policy declaration
Policy application in the binding
Placeholder for the reference to the attachment in the types (schema) section
If you are working contract-first and have a WSDL in hand, the example in section 1.2 of this site (http://www.w3.org/Submission/WS-MTOMPolicy/) shows the simple additions to be made to declare and apply the MTOM policy. Appendix I of the same site shows an example of a schema element which allows a web service client or server to identify a reference to the MTOM attachment.
I have not implemented a web service or client in C, but a brief scan of recently-updated packages revealed gSoap (http://www.cs.fsu.edu/~engelen/soap.html) as a possibility for helping in your endeavors.
Give those documents a look and see if they help to advance your project.

SharePoint: GetListItemChangesSinceToken vs GetListItemChangesWithKnowledge?

What is the difference between GetListItemChangesSinceToken and GetListItemChangesWithKnowledge?
Here is the awesome summary documentation, and about all that is said on the matter:
GetListItemChangesSinceToken: Returns changes made to the list since the date and time specified in the [change] token.
GetListItemChangesWithKnowledge: Returns all of the list items that meet specified criteria and that have changed since the date-time specified in the knowledge parameter for the specified list.
One takes a "change token" and the other takes "knowledge". However, I have not been able to find any documentation (or rationale) as to what advantage one has over the other, why they both exist, how they are fundamentally different, or which one is appropriate to use in protocol clients.
These SOAP services are formally defined in the [MS-LISTSWS]: Lists Web Service Protocol Specification protocol, but they seem identical, excepting the token they expect and emit. (Perhaps it is just the number of undocumented bugs?)
While GetListItemChangesWithKnowledge does have an additional syncScope parameter, MS-LISTWS says:
[syncScope] MUST be null or empty ... [syncScope] is reserved and MUST be ingored
Any input -- especially first-hand knowledge -- is greatly appreciated.
You're probably right about the number of bugs being the difference...
Here is what I could find about both methods:
GetListItemChangesWithKnowledge (different MSDN documentation)
SharePoint 2010: Lists.GetListItemChangesWithKnowledge Method suggests that this method was introduced with SharePoint 2010 and SharePoint Workspace synchronization - I couldn't verify this though
The important bit is "returns all of the list items that meet specified criteria and that have changed since the date-time specified in the knowledge parameter for the specified list"
Diving further in: The knowledge element contains "Microsoft Sync Framework knowledge data structure" (MSDN), which for example is explained here (Microsoft Sync Framework, Part 2: Sync Metadata).
GetListItemChangesSinceToken (different MSDN documentation)
Should be used instead of GetListItemChanges according to MSDN (see link above). I'm assuming it should be used because the Change element further specifies the list item to get, as it says "If Nothing is passed, all items in the list are returned."
The changeToken actually contains something from the Change Log, which in turn has information about Adds, Deletes, Renames etc. --> This is useful if you have in-depth synchronization in your application
On Synchronizing with Windows SharePoint Services, Part 1 the snychronization is explained, including a bit information on the changeToken.
Summary: It looks to me that the ...WithKnowledge method is a bit more complex as it is using the Microsoft Sync's Framework query syntax which includes a time constraint for changes. The ...SinceToken method only queries for all changes with specified action (e.g. Delete) without time constraint.
Ask yourself: Do you really want to implement such complicated methods with lacking documentation which are subject to change? I would suggest doing two things: Analyze (e.g. via Fiddler) the traffic Microsoft Workspace 2010 is generating (also check Word/Outlook). What methods is is using? Could you implement something similar? Isn't GetListItemChanges enough for most applications?

Web Service to return complex object with optional parts

I'm trying to think of the correct design for a web service. Essentially, this service is going to perform a client search in a number of disparate systems, and return the results.
Now, a client can have various pieces of information attached - e.g. various pieces of contact information, their address(es), personal information. Some of this information may be complex to retrieve from some systems, so if the consumer isn't going to use it, I'd like them to have some way of indicating that to the web service.
One obvious approach would be to have different methods for different combinations of wanted detail - but as the combinations grow, so too do the number of methods. Another approach I've looked at is to add two string array parameters to the method call, where one array is a list of required items (e.g. I require contact information), and the other is optional items (e.g. if you're going to pull in their names anyway, you might as well return that to me).
A third approach would be to add additional methods to retrieve the detail. But that's going to explode the number of round trips if I need all the details for potentially hundreds of clients who make up the result.
To be honest, I'm not sure I like any of the above approaches. So how would you design such a generic client search service?
(Considered CW since there might not be a single "right" answer, but I'll wait and see what sort of answers arrive)
Create a "criteria" object and use that as a parameter. Such an object should have a bunch of properties to indicate the information you want. For example "IncludeAddresses" or "IncludeFullContactInformation".
The consumer is then responsible to set the right properties to true, and all combinations are possible. This will also make the code in the service easier to do. You can simply write if(criteria.IncludeAddresses){response.Addresses = GetAddresses;}
Any non-structured or semi-structured data is best handled by XML. You might pass XML data via a string or wrap it up in a class adding some functionality to it. Use XPathNavigator to go through XML. You can also use XMLDocument class although it is not too friendly to use. Anyway, you will need some kind of class to handle XML content of course.
That's why XML was invented - to handle data which structure is not clearly defined.
Regards,
Maciej