Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 198390

Summary: [hotbug][model] extensibility element resolution fails
Product: [WebTools] WTP Webservices Reporter: Marco Hala genannt Kahle <marco.hala.genannt.kahle>
Component: wst.wsdlAssignee: Valentin Baciu <valentinbaciu>
Status: CLOSED FIXED QA Contact: Valentin Baciu <valentinbaciu>
Severity: normal    
Priority: P3 CC: for.work.things, hjzhang, hristo.sabev, joerg.dehmel
Version: 2.0Flags: joerg.dehmel: review?
joerg.dehmel: review?
Target Milestone: 2.0.2 M202   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 215227    
Attachments:
Description Flags
Test Project
none
Tentative model patch
none
Updated model patch
none
New JUnit test none

Description Marco Hala genannt Kahle CLA 2007-07-31 09:10:40 EDT
Build ID: 200706212235

Steps To Reproduce:
Using org.eclipse.wst.wsdl API and a WSDL document with namespace scope on Binding element level like
<wsdl:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="XYBinding" type="tns:myns">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="op1">
      <soap:operation/>
      <wsdl:input>
        <soap:body namespace="http://www.sap.com/test" use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body namespace="http://www.sap.com/test" use="literal"/>
      </wsdl:output>
    </wsdl:operation>
the sub element <soap:binding> is not mapped to SOAPBinding.

More information:
Comment 1 Valentin Baciu CLA 2007-07-31 09:42:19 EDT
Please attach a small working JUnit or code snippet showing how you are loading the model.
Comment 2 Marco Hala genannt Kahle CLA 2007-08-07 11:35:38 EDT
Created attachment 75547 [details]
Test Project
Comment 3 Marco Hala genannt Kahle CLA 2007-08-07 11:40:41 EDT
The code snipped from the attached test:
final WSDLFactory factory = WSDLPlugin.INSTANCE.createWSDL4JFactory();
final Definition definition = factory.newWSDLReader().readWSDL(uri);
			
for (Binding binding : (Collection<Binding>)definition.getBindings().values()) {
   for (ExtensibilityElement element : (List<ExtensibilityElement>)binding.getExtensibilityElements()) {
      final QName elementType = element.getElementType();
      final String localPart = elementType.getLocalPart(); 
      Assert.assertNotNull("local part is null" , localPart);
      Assert.assertTrue("local part is empty", localPart.length() > 0);
					
      final String namespaceURI = elementType.getNamespaceURI(); 
      Assert.assertNotNull("namespace URI is null" , namespaceURI);
      Assert.assertTrue("namespace URI is empty", namespaceURI.length() > 0);
   }
}

The result is an empty namepsace URI. 
Comment 4 Valentin Baciu CLA 2007-08-07 13:06:41 EDT
It seems you've run into a limitation of the WSDL model code: when it tries to find the namespace URI for the prefix "soap" it fails to locate it because the namespace prefix is defined locally and not globally. This leads to the extensibility element being created as an unknown extensibility element instead of the expected type.

As a workaround until this is fixed, you can move the soap namespace declaration to the root definition element.
Comment 5 Valentin Baciu CLA 2007-08-07 13:08:51 EDT
Created attachment 75557 [details]
Tentative model patch
Comment 6 Joerg Dehmel CLA 2007-11-28 03:52:29 EST
For SAP it would be very important to get this bug fixed in the near future. Do you already know what target milestone a fix is planned for?
Comment 7 Valentin Baciu CLA 2007-11-28 12:24:45 EST
(In reply to comment #6)
>...Do you already know what target milestone a fix is planned for?

I don't know the exact milestone yet but I'll try to get this fix in for WTP 3.0. Do you have time to give the patch a try?

Comment 8 Joerg Dehmel CLA 2007-11-28 14:37:00 EST
(In reply to comment #7)
> (In reply to comment #6)
> >...Do you already know what target milestone a fix is planned for?
> I don't know the exact milestone yet but I'll try to get this fix in for WTP
> 3.0. Do you have time to give the patch a try?

Yes, I have. At least I can check if it solves our concrete problem.

Comment 9 Joerg Dehmel CLA 2007-12-10 05:39:07 EST
Because the problem is quite critical for us wouldn't it be possible to provide the fix in maintenance release of WTP 2.0?
Comment 10 Valentin Baciu CLA 2007-12-10 07:36:39 EST
Hi Joerg, you can mark this bug as a hot bug request. See http://www.eclipse.org/webtools/adopters/hot_bug_process.html for instructions.

Were you able to verify that the patch I posted fixes the issue and has no adverse side effects? I will rely on you to help with testing this change.
Comment 11 Joerg Dehmel CLA 2007-12-10 08:46:18 EST
Hi Valentin, I will verify your fix with our use cases. What kind of help do you expect apart from this?

Please tell me the easiest way to install the fix in my IDE.
Comment 12 Valentin Baciu CLA 2007-12-11 00:33:30 EST
Verifying the fix with your test cases is what I'm looking for. I will write a new JUnit test and run the existing suite as well. 

To use the fix, you can get the org.eclipse.wst.wsdl plug-in source from CVS, apply the patch then run your tests. I am assuming that you know how to develop WTP plug-ins. If that's not the case you can have a look at this tutorial http://www.eclipse.org/webtools/community/tutorials/DevelopingWTP/DevelopingWTP.html to get started.

If you'd rather not deal with this at source level I could build a new version of the WSDL model plug-in and attach it here.
Comment 13 Joerg Dehmel CLA 2008-01-02 04:36:13 EST
Hi Valentin,
we were able to verify that your fix solves our problem. Furthermore we performed the tests for our functionality that deals with WSDL and didn't face any problem. So from our point of view the fix could be applied.

Comment 14 Joerg Dehmel CLA 2008-01-02 04:51:50 EST
Hi hjzhang,

could you please mark this issue as hotbug_request? It would be great if the bugfix could be provided with WTP 2.0.2. We are currently developing some functionality that uses the WTP WSDL api and waiting for WTP 3.0 would cause some trouble with our plannings.

Best regards,
Jörg
Comment 15 Valentin Baciu CLA 2008-01-08 11:09:52 EST
Marking as a hotbug request on behalf of SAP.
Comment 16 Valentin Baciu CLA 2008-01-08 11:10:26 EST
Accepting as a hotbug and targetting for 2.0.2.
Comment 17 Valentin Baciu CLA 2008-01-14 00:07:45 EST
Created attachment 86796 [details]
Updated model patch

Updated model patch. Handles both prefixed local namespace declaration as well as a local default namespace declaration.
Comment 18 Valentin Baciu CLA 2008-01-14 00:09:00 EST
Created attachment 86797 [details]
New JUnit test

Adds a new test document as well as the JUnit code testing for prefixed local namespaces and for a default local namespace.
Comment 19 Valentin Baciu CLA 2008-01-14 00:17:25 EST
Joerg, could you please verify the updated model patch? I'd like to make sure it still works for you. I realized that the previous patch was not handling the case where the SOAP namespace was locally declared as the default namespace (see the attached test case).

I'll keep testing too and if all is well I hope to have the fix in for this week's 2.0.2 build.
Comment 20 Joerg Dehmel CLA 2008-01-15 11:56:04 EST
Hi Valentin, I have repeated our tests with the new patch and they were successfull as before.
Comment 21 Valentin Baciu CLA 2008-01-15 21:35:59 EST
The patches are committed and released for WTP 2.0.2 builds > v200801152132
Comment 22 Kathy Chan CLA 2008-01-16 11:36:23 EST
*** Bug 175842 has been marked as a duplicate of this bug. ***
Comment 23 Valentin Baciu CLA 2008-01-22 00:35:11 EST
Joerg, the fix should be in the latest 2.0.2 build. Could you please install it, make sure the fix is in and if all is OK please mark the bug as verified.
Comment 24 Joerg Dehmel CLA 2008-01-22 04:23:36 EST
I installed the latest 2.0.2 build and our usecases were working as expected.
Comment 25 Joerg Dehmel CLA 2008-01-22 04:33:50 EST
Hi Valentin, can you guide me how to mark the bug as verified?
Comment 26 Valentin Baciu CLA 2008-01-22 07:25:08 EST
Typically the bug reporter does that: there is a group of radio buttons right under the additional comments text area. Select Mark bug as verified and click commit.
Comment 27 Amy Wu CLA 2008-02-21 19:47:54 EST
closing the bug since it's been verified.