Bug 194096 - [model] Changing the targetnamespace breaks reference links between WSDL components in the model
Summary: [model] Changing the targetnamespace breaks reference links between WSDL comp...
Status: CLOSED FIXED
Alias: None
Product: WTP Webservices
Classification: WebTools
Component: wst.wsdl (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Valentin Baciu CLA
QA Contact: Valentin Baciu CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-23 11:56 EDT by Richard Mah CLA
Modified: 2008-04-23 13:33 EDT (History)
1 user (show)

See Also:


Attachments
Proposed patch and JUnit (9.98 KB, patch)
2008-04-16 16:25 EDT, Valentin Baciu CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Mah CLA 2007-06-23 11:56:06 EDT
When I'm editing the targetnamespace, the links between the wsdl components are broken (for example binding A references portype B).  I'm using the following to set the tns.  We need to investigate to determine what the proper way is to set the targetnamespace:

if (targetNamespacePrefix != null) {
    Element element = definition.getElement();
    // Remove the old prefix
    String oldPrefix = definition.getPrefix(definition.getTargetNamespace());
    element.removeAttribute("xmlns:"+oldPrefix); 

    // Set the new prefix
    element.setAttribute("xmlns:" + targetNamespacePrefix, definition.getTargetNamespace());
    }
    if (targetNamespace != null) {
	String newValue = targetNamespace;
	String prefix = definition.getPrefix(definition.getTargetNamespace());
				definition.setTargetNamespace(newValue);
				definition.getElement().setAttribute("xmlns:" + prefix, newValue);
    }
Comment 1 Valentin Baciu CLA 2007-09-13 23:28:36 EDT
*** Bug 203257 has been marked as a duplicate of this bug. ***
Comment 2 Valentin Baciu CLA 2008-04-16 16:25:01 EDT
Created attachment 96337 [details]
Proposed patch and JUnit
Comment 3 Valentin Baciu CLA 2008-04-16 16:31:22 EDT
Patch committed for WTP 3.0 builds > v200804161630.
Comment 4 Valentin Baciu CLA 2008-04-23 13:33:34 EDT
Verified with I20080423080648.
Comment 5 Valentin Baciu CLA 2008-04-23 13:33:49 EDT
Closing.