gale320 / staff

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

Empty namespace problem #203

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There seems to be a bug in r772, this bug didn't exist in r766 and prior 
revisions...

1. Compile the sample, create a SoapUI mockService.
2. Run the sample

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

The method fails and shows

ERROR 22-05-2013 16:40:29.306 src/main.cpp[25] main: Exception: 
src/fooProxy.cpp[152] fooMethod: org.apache.xmlbeans.XmlException: error: The 
value of the attribute "prefix="xmlns",localpart="ns1",rawname="xmlns:ns1"" is 
invalid. 
Prefixed namespace bindings may not be empty.

Looking at a a capture of the request it seems that there are 2 namespaces, ns0 
is set correctly but ns1 is set empty...

Original issue reported on code.google.com by alexmantaut on 22 May 2013 at 7:47

Attachments:

GoogleCodeExporter commented 9 years ago
This issue with incorrect importing of interface namespace. To workaround add 
into interface file:

// *interface.targetNamespace: http://foons

Original comment by loentar on 23 May 2013 at 9:54

GoogleCodeExporter commented 9 years ago
Hi Dmitry,
         I've tried the workaround and it worked, but would it be possible to have a more permanent solution? I'm sorry to ask but this functionality didn't had bugs until recent versions, I'm close to releasing a new version of my app, and I would need to have a stable version of staff for it...

         If I can help in any way to fix the bug in staff I will gladly, the thing is I'm not very familiar with the codegen code...

          BTW, I'm interested in developing more UTs for staff in order to avoid issues from new code, is there some code you would like me to test first?

As always thanks for everything

Original comment by alexmantaut on 5 Jun 2013 at 5:37

GoogleCodeExporter commented 9 years ago
This issue is not so easy to fix as insert two lines of code :)
I started working on it, but didn't complete it in the same day.

I'll try to fix it asap for you.

Original comment by loentar on 6 Jun 2013 at 5:42

GoogleCodeExporter commented 9 years ago
I'm sorry, Alex, I was wrong. It's so easy as adding one line and removing one 
line.

Just looked into wrong direction caused by deep debugging.

Original comment by loentar on 6 Jun 2013 at 6:53

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

Original comment by loentar on 6 Jun 2013 at 6:56

GoogleCodeExporter commented 9 years ago
Hi Dmitry,
      Thanks for the fix! sorry to have insisted but I'm getting close to a release date... 
       Another thing, I've tried the code with my app but now there is a new error...
       If you try the code attached with a soapUI server, soapUI returns the following error:

ERROR 06-06-2013 19:23:05.815 src/main.cpp[28] main: Exception: 
src/fooProxy.cpp[153] fooMethod: Missing operation for soapAction [] and body 
element [{http://www.foo.com/cas/wsdl/subscription/v1}fooRequest] with SOAP 
Version [SOAP 1.1]

again, Thanks a lot for your patience...

Original comment by alexmantaut on 6 Jun 2013 at 10:29

Attachments:

GoogleCodeExporter commented 9 years ago
I only see one difference between requests of staff and soapui.

Staff defines `attr1` element within namespace 
"http://www.foo.com/cas/xsd/subscription/v1" (xsd)

SoapUI defines that element within namespace 
"http://www.foo.com/cas/wsdl/subscription/v1" (wsdl)

I don't have any idea why it must be in (wsdl) namespace, because it is 
declared in (xsd) namespace and imported into (xsd) namespace from wsdl.

Can't find any info about that.

Original comment by loentar on 7 Jun 2013 at 7:27

GoogleCodeExporter commented 9 years ago
Hi Dmitry,
         I've compared the request generated by the current staff revision with a request generated by r766...

The generated request looks something like this (SoapUI processes it correctly):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns0:fooRequest xmlns:ns0="http://www.foo.com/cas/xsd/subscription/v1">
         <ns0:attr1/>
      </ns0:fooRequest>
   </soapenv:Body>
</soapenv:Envelope>

By comparing it to a request from r775:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns1:fooRequest xmlns:ns1="http://www.foo.com/cas/wsdl/subscription/v1" xmlns:ns0="http://www.foo.com/cas/xsd/subscription/v1">
         <ns0:attr1/>
      </ns1:fooRequest>
   </soapenv:Body>
</soapenv:Envelope>

It seems that fooRequest is being set in 
"http://www.foo.com/cas/wsdl/subscription/v1" namespace when it should be set 
in xsd namespace... If the namespace is set to xsd the request works properly...

Original comment by alexmantaut on 7 Jun 2013 at 2:40

GoogleCodeExporter commented 9 years ago
For operation arguments namespace must not be taken from Interface.

There are multiple issues, hope it will not break something.

Original comment by loentar on 8 Jun 2013 at 7:31

GoogleCodeExporter commented 9 years ago
Fixed in r776

Original comment by loentar on 8 Jun 2013 at 7:34

GoogleCodeExporter commented 9 years ago
Hi Dmitry,
         Sorry for the delay, I've tried your code, it fixes the mentioned case but it seems to break some things that used to work...
         I attached you an example on one of the issues...

 - Create a SoapUI service for the wsdl, compile and run the code...
Staff throws an exception while deserializing the namespace, the following 
error is thrown:

src/DataObject.cpp[2817] GetNamespacePrefixByUri: Can't find prefix for uri: 
[http://www.w3.org/2001/XMLSchema-instance]

Original comment by alexmantaut on 19 Jun 2013 at 3:37

Attachments:

GoogleCodeExporter commented 9 years ago
Alex, I'm afraid SoapUI does not support generating of Abstract types.

Response should have instance info and should look like that:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="urn:foo">
   <soapenv:Header/>
   <soapenv:Body>
      <resp xsi:type="ns0:MyType2">
         <baseAttr>?</baseAttr>
      </resp>
   </soapenv:Body>
</soapenv:Envelope>

But response generated by SoapUI does not have instance info and looks like 
that:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <resp>
         <baseAttr>?</baseAttr>
      </resp>
   </soapenv:Body>
</soapenv:Envelope>

Original comment by loentar on 19 Jun 2013 at 6:49