wood burning stoves 2.0*
The moose likes Web Services and the fly likes WSDL 1.1: Two Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WSDL 1.1: Two "address"-elements within one "port"?" Watch "WSDL 1.1: Two "address"-elements within one "port"?" New topic
Author

WSDL 1.1: Two "address"-elements within one "port"?

Kai Wähner
Ranch Hand

Joined: Sep 16, 2009
Posts: 76
Hi there,

I have a WSDL 1.1 document. It has two "address"-elements within one "port"-element:



The binding contains two operations and this transport binding:



This validates within Eclipse WTP, I think because the WSDL Schema contains an "any"-element, right?:



But my question: Does it make any sense with two "address"-elements within one "port"-element - does it mean the endpoint can be accessed through two different way?
Or should I use two "port"-elements with different bindings?
Or should I add a second transport-binding with "soap over http" to the "binding"-element?

I hope you can help me out and explain if this solution is nonsense?!


Best regards,
Kai


My IT-blog about my experiences with: Java / JEE, IT Conferences and IT Certifications

R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Hi. Per Section 2.6 of the WSDL 1.1 Spec: "A port MUST NOT specify more than one address."
Kai Wähner
Ranch Hand

Joined: Sep 16, 2009
Posts: 76
Oh, thank you...

I only looked at the soap:address section in the spec :-(

Do you know, why this limitation is not specified within the WSDL Schema file, but only within the spec?
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Interesting. In the WSDL spec introduction (Section 1 in earlier link), it states "A port is defined by associating a network address with a reusable binding, and a collection of ports define a service." (The italics/colour are mine) So I guess the WSDL is not 1.1 compliant. Also, the statement implies that a port can have only one address. And yes, I see that the WSDL does validate in Eclipse with multiple address elements inside a port. No idea why.

Anyway, some questions:

1. What is the source of your WSDL? Is it being handed to you to develop against? Or are you creating one from scratch?
2. If you are creating it, what is your goal here?

My guess based on your example: If you are trying to trying to setup SOAP over JMS, then the SOAP over JMS spec has a nice example that you might find useful.
Kai Wähner
Ranch Hand

Joined: Sep 16, 2009
Posts: 76
Well, my WSDL is compliant to the WSDL 1.1 XSD, but not to the speficiation. It validates within Eclipse, because there is an any-element in the XSD:



So you can add whatever you want, also <test/> instead of <jms:address/>.


And your other question: I am the creator of this file (contract first). We offer the server side, other guys create the client side.
The messages are send via JMS, so I used the JMS transport. I have sent them the file, and they returned an updated version with the two address elements. Reason: They need this transport to create a working client...
We will have some discussions with these guys soon, because they probably do not really know what they wanna do :-)
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Update: Ouch, I made an error writing this post - see below for correction!

There is only one thing that I want to add/clarify to the detailed discussion above:
Within a <wsdl:service> element, you can have multiple <port> elements that refer to the same binding, but with each <port> element specifying a different address for the service.
Example:

This can be useful when (as in the example above) you want to define multiple endpoints for the same service, where one is used for, for instance, failover or load balancing.
You can also use this technique to make one and the same service available using, for instance, JMS and HTTP transport.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
This is very useful information. Thank you for sharing it!

Best regards.
Kai Wähner
Ranch Hand

Joined: Sep 16, 2009
Posts: 76
Hi Evan,

I think the following statement is not correct:

You can also use this technique to make one and the same service available using, for instance, JMS and HTTP transport.


If you want to use JMS and HTTP transport, you need two different bindings, because the HTTP transport needs another transport-binding than <soap11:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/> ???

Or maybe you can correct me?


Greetings Kai
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
You are absolutely correct and I was too quick and made an error!
The transport is indeed specified in the <binding> element and, if you want to expose a service using JMS and HTTP, you need two different <binding> elements.
However, both <binding> elements can, using the type attribute, refer to the same interface. Thus, you expose two identical services with different bindings.
Thanks for pointing this error out!
 
 
subject: WSDL 1.1: Two "address"-elements within one "port"?
 
Similar Threads
java.io.IOException: Type {http://lang.java}Exception is referenced but not defined.
WSDL query
Questions from RMH
Clarification sought on the Basic profile
ws-i compliance questions