• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why is the relation of QName with wsdl

 
onisha jain
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the purpose of using QName while writing a client.
We are not using that link/URL to call web service.


I could not understand why we use this QName and why we need to use this combination with wsdl file
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the WSDL is generated, open it or the schema it is referring to and see.
Do you see the target name space xml:tns="http://www.myyong.com" ?
Target name space is the fully qualified name of some elements in the WSDL. A name space is used to avoid element's name conflict.

Analogy:
In Java, the fully qualified name of a class is package.className, such as java.util.List and java.awt.List. The fully qualified name is to distinguish different classes of the same name from different packages.
In this case, the classes List and List are two different things under java.util package and java.awt package.

In XML, the target name space is used to distinguish different elements of the same name.
 
onisha jain
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Himai
My qsn is :
I am using QName at client side.
At this time I already have the WSDL generated.
So now what is the purpose of using QName.
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the client application needs to know the fully qualified name of the elements inside the <soap:body> element in the response. That is why the client application needs the QName to create the Service instance.
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I came across an example WSDL here https://community.oracle.com/thread/1584721
The service has a binding to tns:SynchronousSampleBinding. So, the service on the client side has to know the target name space so that it knows which <binding> to bind.
 
onisha jain
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Himai
I am still confused on the concept behind the QName.
lets take for example (I have taken these examples from http://www.mkyong.com/):


And without QName :


Now my question is :
1) Is there any concepts based on which we have to decide which type of client we can write
2) What is the purpose or additional benefits in using QName because all I can see here is that it increases complexity as compared to simple client.
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer both of your questions, consider a web service with @WebServiceProvider. It is not based on WSDL. When a web service annotated with @WebServiceProvider, it is not SOAP based, but it is XML based. That means the payload is in XML , not in SOAP.

For details, you can read Java Web Service Up and Running, Ivan's notes and Enthuware mock exam.

I think creating a service using QName is for SOAP-based web services. However, for XML based web services, WSDL is not even present and we don't even need to create the QName object to create the Service instance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic