aspose file tools*
The moose likes Web Services and the fly likes use of urn in soap service? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "use of urn in soap service?" Watch "use of urn in soap service?" New topic
Author

use of urn in soap service?

william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
When a urn is supposed to the a UNIQUE name for a resource how do i ensure that the urn i give when creating a webservice in my server is unique over the web?


Help me!Help you!!!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Well, you can't be 100% sure because you can't control what other people type into their WSDL files...
However, you can be somewhat certain about uniqueness if you follow some basic principles. One of them is to include the company's domain name in the URN (e.g. "urn:mycompany.com-webservices-stockquote"). I remember stumbling onto a longer list of these "principles" but I can't remember where...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
Originally posted by Lasse Koskela:
Well, you can't be 100% sure because you can't control what other people type into their WSDL files...

Hi koskela,
Is there a standard registry where i can register my urn and be rest assured that it cannot be duplicated?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I can't think of any standard registry for URNs except ICANN, which manages the URLs.
Ramesh Nagappan
Author
Ranch Hand

Joined: May 06, 2003
Posts: 159
Originally posted by william kane:
When a urn is supposed to the a UNIQUE name for a resource how do i ensure that the urn i give when creating a webservice in my server is unique over the web?

"urn:" is typically used to specify namespace URI of the service. If you use JAX-RPC, it clearly distinguishes where you use URL endpoint and Namespace URI. I did'nt find any confusion !
For example, To invoke a service using JAX-RPC Dynamic proxy, I set the following:
String UrlString = "http://localhost:80/MyHelloService/MyHelloService?WSDL";
String nameSpaceUri = "urn:MyHelloService/wsdl";
String serviceName = "MyHelloService";
String portName = "MyHelloServiceRPCPort";

URL helloWsdlUrl = new URL(UrlString);
ServiceFactory serviceFactory =
ServiceFactory.newInstance();
Service helloService = serviceFactory.createService(helloWsdlUrl, new QName(nameSpaceUri, serviceName));

MyHelloServiceRPC myProxy = (MyHelloServiceRPC) helloService.getPort(new QName(nameSpaceUri, portName), MyHelloServiceRPC.class);
System.out.println(myProxy.sayHello("Buzz"));
You may take a look at:
http://java.sun.com/j2ee/1.3/docs/tutorial/doc/JAXRPC4.html
- Ramesh


Ramesh Nagappan CISSP<br />Co-Author of "Core Security Patterns"<br />nramesh@post.harvard.edu<br /><a href="http://www.coresecuritypatterns.com" target="_blank" rel="nofollow">www.coresecuritypatterns.com</a>
Ramesh Nagappan
Author
Ranch Hand

Joined: May 06, 2003
Posts: 159
Originally posted by william kane:

Hi koskela,
Is there a standard registry where i can register my urn and be rest assured that it cannot be duplicated?

If you are trying registering the service using its WSDL, you may think of registering the service using ebXMLRR (which compliments UDDI) and use JAXR API to register and find services.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: use of urn in soap service?