QUSIR / staff

Automatically exported from code.google.com/p/staff
Apache License 2.0
0 stars 0 forks source link

Problem with namespaces #219

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile and run, with a soapUI server

What is the expected output? What do you see instead?
The expected request should look like this

<ns0:fooRequest xmlns:ns0="http://ns/v1" xmlns:ns1="http://common/v1">
    <ns0:fooRequest>
       <ns0:attr1/>
    </ns0:fooRequest>
</ns0:fooRequest>

instead it has the wrong namespace

<ns0:fooRequest xmlns:ns0="http://ns/v1" xmlns:ns1="http://common/v1">
    <ns0:fooRequest>
       <ns1:attr1/>
    </ns0:fooRequest>
</ns0:fooRequest>

Please use labels and text to provide additional information.

This used to work in earlier revisions, I think some fix related to the 
namespaces broke it... 

I don't know how to fix this but I think I should develop some unit tests for 
the codegen specially for this part, because there are namespace combinations 
that have to be taken into account.

Original issue reported on code.google.com by alexmantaut on 13 Sep 2013 at 7:41

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by alexmantaut on 13 Sep 2013 at 8:01

GoogleCodeExporter commented 9 years ago
Added a test for this issue in r794

Original comment by alexmantaut on 16 Sep 2013 at 5:56

GoogleCodeExporter commented 9 years ago
This may occur when using imported types (Complex or Simple) without elements.

To fix this issue need to add a flag to define is this C++ type (struct or 
typedef) a type (Complex or Simple) or element. Then set interface's namespace 
if it is an element, else don't set it.

P.S.: you don't need to set me in CC list. I will receive a mail on any new 
issue.

Original comment by loentar on 17 Sep 2013 at 8:21

GoogleCodeExporter commented 9 years ago
I found a few more problems with namespaces too, I attach test cases:

What is the expected output? What do you see instead?

Request 1
The expected request should look like this:

<ns0:fooMethod1Request xmlns:ns0="http://namespace1" 
xmlns:ns1="http://namespace2">
 <ns0:param1/>
 <ns0:param2>0</ns0:param2>
</ns0:fooMethod1Request>

but it looks like this
(param1 is in the wrong namespace)

<ns0:fooMethod1Request xmlns:ns0="http://namespace1" 
xmlns:ns1="http://namespace2">
 <ns1:param1/>
 <ns0:param2>0</ns0:param2>
</ns0:fooMethod1Request>

Request 2
The expected request should look like this:

<ns0:fooMethod2Request xmlns:ns0="http://namespace1">
  <ns0:param1>
     <ns0:attr1>users</ns0:attr1>
  </ns0:param1>
  <ns0:param2>false</ns0:param2>
</ns0:fooMethod2Request>

but it looks like this:

(param1 doesn't have a namespace)

<ns0:fooMethod2Request xmlns:ns0="http://namespace1">
 <param1>
   <ns0:attr1>users</ns0:attr1>
 </param1>
 <ns0:param2>false</ns0:param2>
</ns0:fooMethod2Request>

Original comment by alexmantaut on 18 Sep 2013 at 4:02

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by alexmantaut on 18 Sep 2013 at 4:03

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was one of hardest to fix.

Regress tests results on qualified types and namespaces shows that fix works 
and does not break tests.

I made some modifications in your test to be sure namespace is written 
correctly for all situations described here.

Original comment by loentar on 16 Nov 2013 at 10:38

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r802.

Original comment by loentar on 16 Nov 2013 at 10:39

GoogleCodeExporter commented 9 years ago
I finally was able to test the issue, it worked like a charm! Thanks a lot for 
the fix Dmitry!

Original comment by alexmantaut on 4 Feb 2014 at 5:53