File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes How to remove prefix from target namespace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to remove prefix from target namespace" Watch "How to remove prefix from target namespace" New topic
Author

How to remove prefix from target namespace

Hemant Aggarwal
Greenhorn

Joined: Nov 02, 2011
Posts: 2


Hi All,

I am new to this forum.
I am working on java web services. I am using "wsdl2java" tool to create a java stub file.
In my wsdl file value of targetnamespace is "urn:HPD_IncidentInterface_Create_WS" but i want to remove this urn prefix from java stub file.
I can't change wsdl file as it is application generated so is there any way to do this.


Thanks
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
First of all, why do you want to remove the namespace prefix?
Second, in JAX-WS, there is the concept of handlers. A handler can be used to process requests and responses going in and/or out of a web service or a web service client.
Note that handlers do introduce a certain overhead.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Hemant Aggarwal
Greenhorn

Joined: Nov 02, 2011
Posts: 2

I want to remove prefixes because when server is sending response, its without "urn" prefix but when it matches this response with namespace with "urn" prefix in java stub file using "getreadername()" function and at that time it gives me error "unexpected subelement"
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I would suspect that there is some problem with the API you use for XML binding, assuming you are generating these classes from the WSDL. What is the API you are using?
Anyway, if you are not at liberty to swap the API out, then a handler may be your solution (as in previous post).
Best wishes!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to remove prefix from target namespace
 
Similar Threads
How to access Secure web method
where to download wscompile?
how to redirect the linux terminal contents to a textpane
How to ignore or remove comments from a java file with the help of another java file.
currency converter webclient sourcecode..