• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why do I see different wsdl and xsd generated for webservice through wsgen.

 
Ranch Hand
Posts: 558
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

First of all I apologize for a vague subject line, but I could not think any better


I have several questions related to the WSDL, XSD generated and the SOAP request/response which I would try to put as clear as possible.

I wrote a very simple webservice as below with default settings.



As evident from the above code, the messaging is "DOCUMENT/LITERAL/WRAPPED" mode. I ran wsgen and wsdl and xsd are generated.

CalculatorWSService_schema1.xsd


Question 1) Why the arg0 is having minOccurs="0" where I have not mentioned this anywhere in my code. Does it mean that I can ignore this argument all together as min = 0. Why this setting is not applied for arg1 and arg2. But why again for return.

Snippet from wsdl generated



But when I try to look for wsdl in a browser http://localhost:8080/CalculatorWS/CalculatorWSService?wsdl, I see the below


Question 2) Why there is an extra content in browser view "wsam:Action="http://ws.learning.org/CalculatorWS/calculateRequest" and why not in my generated WSDL. At what point this extra content would be induced and why is it needed. By the way the namespace for this content is

I also see differences in namespace declarations in both the cases

In my generated WSDL,


When browsed in browser


Question 3) Why and how the new additional namespaces were included and again at what point?


In eclipse, using the WebservicExplorer, I tried to test my service and captured the below response



But I try to test my another webservice, which is technically same as my CalculatorWS, the way the response is displayed is different. I see below response.


Question 4) Why there is difference in my response (Please look for <return> element). Why type declaration came into picture. This is not ENCODING format.

The service is defined as below, which is not different from CalculatorWS.


Question 5) Last but not the least, can some body explain me the differences of parameter style WRAPPED and BARE. In the page, it is mentioned as
Parameter Style
Decides whether operation name needs to be part of the SOAP body
Possible values: BARE or WRAPPED
Default: WRAPPED

but I did not understand this.
Could you please clarify me these questions?
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I only have time for one answer right now, so I'll make an attempt at your first question:

Kumar Raja wrote:
Question 1) Why the arg0 is having minOccurs="0" where I have not mentioned this anywhere in my code. Does it mean that I can ignore this argument all together as min = 0. Why this setting is not applied for arg1 and arg2.


The first argument of the method is a String, which is an object. It can contain a string, which is not a surprise, but it may also contain null. The latter accounts for the case where it is omitted in the XML.
The other parameters are primitive types and thus can only have values and can never be null, so they have the default minOccurs="1".
Whether you can ignore the argument or not depends on the implementation of the web service operation - can it handle a null value for the first parameter?
Best wishes!
 
Kumar Raja
Ranch Hand
Posts: 558
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Ivan for your response to my first question and would be thankful for responses to my other questions.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
...and now for the other questions:

Kumar Raja wrote:
Question 2) Why there is an extra content in browser view "wsam:Action="http://ws.learning.org/CalculatorWS/calculateRequest" and why not in my generated WSDL. At what point this extra content would be induced and why is it needed.


The wsam:Action attribute is added on the fly when the WSDL is fed back to the browser, I suspect.
This is WS-Addressing metadata, about which you can read here: http://www.w3.org/TR/ws-addr-metadata/




Question 3) Why and how the new additional namespaces were included and again at what point?


Again, this is additional data inserted into the WSDL on the fly. Such additional data may also be stored separately from the WSDL and, when the WSDL is requested, inserted into the WSDL. The different namespaces are used for:
wsu: Related to WS-Security. For more info see: http://en.wikipedia.org/wiki/WS-Security
wsp and wsp1_2: Related to WS-Policy. For more info see: http://en.wikipedia.org/wiki/Ws-policy
wsam: Related to WS-Addressing. For more info see: http://en.wikipedia.org/wiki/WS-Addressing


Question 4) Why there is difference in my response (Please look for <return> element). Why type declaration came into picture. This is not ENCODING format.


What webservice stack are you using?
Are you using different web service stack for the different examples?


Question 5) Last but not the least, can some body explain me the differences of parameter style WRAPPED and BARE. In the page, it is mentioned as
Parameter Style
Decides whether operation name needs to be part of the SOAP body
Possible values: BARE or WRAPPED
Default: WRAPPED


This has recently been discussed in this very forum: https://coderanch.com/t/514679/java-Web-Services-SCDJWS/certification/Document-Literal-versus-Document-literal
Best wishes!
 
Kumar Raja
Ranch Hand
Posts: 558
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, I thank you for all the responses and clarifications provided for my questions.

Ivan Krizsan wrote:
Question 4) Why there is difference in my response (Please look for <return> element). Why type declaration came into picture. This is not ENCODING format.

What webservice stack are you using?
Are you using different web service stack for the different examples?



In both the examples, I'm using GlassFish server and its associated Metro stack (Same RI in both the cases).

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again!

Kumar Raja wrote:First of all, I thank you for all the responses and clarifications provided for my questions.

Ivan Krizsan wrote:
Question 4) Why there is difference in my response (Please look for <return> element). Why type declaration came into picture. This is not ENCODING format.
What webservice stack are you using?
Are you using different web service stack for the different examples?


In both the examples, I'm using GlassFish server and its associated Metro stack (Same RI in both the cases).


I have never seen a xsi:type attribute in a web service deployed to GlassFish. If you care to, please tell me how you managed to create one!
Best wishes!
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kumar,

About question #1 - to supplement Ivan's answer please look at minOccurs="0" on required parameters in WSDL on ASP.NET web service.

Regards,
Dan

 
Ranch Hand
Posts: 75
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
duplicate reply
 
Leon Omk
Ranch Hand
Posts: 75
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Question 2) Why there is an extra content in browser view "wsam:Action="http://ws.learning.org/CalculatorWS/calculateRequest" and why not in my generated WSDL. At what point this extra content would be induced and why is it needed. By the way the namespace for this content is

I also see differences in namespace declarations in both the cases

In my generated WSDL,
view plaincopy to clipboardprint?

<definitions targetNamespace="http://ws.learning.org/" name="CalculatorWSService"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ws.learning.org/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">


When browsed in browser
view plaincopy to clipboardprint?

<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.learning.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.learning.org/" name="CalculatorWSService">




Enterprise Application Server provide features like Qof (Quality of Service), which include add ws-addressing, ws-security, ws-transaction, etc on the fly, depending on the policy (configuration of ws_* features) you set on the webservice deployed in your application server.
 
Leon Omk
Ranch Hand
Posts: 75
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Question 5) Last but not the least, can some body explain me the differences of parameter style WRAPPED and BARE. In the page, it is mentioned as
Parameter Style
Decides whether operation name needs to be part of the SOAP body
Possible values: BARE or WRAPPED
Default: WRAPPED



For a good article about WSDL styles:
https://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/

It tells the story before WS-I Basic Profile got involved in WebService world.

After combining WS-I Basic Profile 1.0, 1.1, 2.0 + wsdl1.1, we got something quite close to wsdl2.0. And benefits of document/literal bare, rpc/literal , rpc/encoding no longer exist.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic