You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Merritt, Norris" <no...@hp.com> on 2008/08/25 18:43:40 UTC

RE: wsdl2js source, serialization strategy, etc.

Thanks Benson, I located the source, I was momentarily confused because the source trees in the source distribution do not follow the package names as closely as I expected. I finally found the source under "frontend".

I wanted to look at the source to see about making some enhancements because I noticed that the serialization strategy seems to ignore attributes defined in the XML schema, and also seems to ignore elementFormDefault, i.e. there seems to be no provision for qualifying element names with prefixes during serialization.

All of the serialization routines seem to take the following general form:

    if (elementName != null) {

     xml = xml + '<';

     xml = xml + elementName;

     xml = xml + ' ';

     xml = xml + 'xmlns:jns0=\'http://xyz.com\';

     if (extraNamespaces) {

      xml = xml + ' ' + extraNamespaces;

     }

     xml = xml + '>';

    }

I don't see how attributes defined on the complex type for which "elementName" is being emitted are ever emitted, or how the serialized XML would survive validation if elementFormDefault="qualified" was specified in the XML schema.  Am I missing something?

Thanks,
Norris

-----Original Message-----
From: bimargulies@gmail.com [mailto:bimargulies@gmail.com] On Behalf Of Benson Margulies
Sent: Saturday, August 23, 2008 2:23 PM
To: Merritt, Norris; CXF Users
Subject: wsdl2js

Norris,

wsdl2js was subsumed into CXF. Most of the code is inside
rt/javascript, but the command-line interfaces are in the tools area.
There is documentation at
http://cwiki.apache.org/CXF20DOC/javascript-clients.html.

--benson

RE: wsdl2js source, serialization strategy, etc.

Posted by "Merritt, Norris" <no...@hp.com>.
Hmmm. The serialization code that I pasted in below was emitted for a web service that specifies elementFormDefault="qualified", yet as you can see, the generated JS code makes no provision for prefixing the element name:

>>     xml = xml + '<';
>>
>>     xml = xml + elementName;
>>
>>     xml = xml + ' ';


-----Original Message-----
From: bimargulies@gmail.com [mailto:bimargulies@gmail.com] On Behalf Of Benson Margulies
Sent: Monday, August 25, 2008 12:40 PM
To: Merritt, Norris; CXF Users
Subject: Re: wsdl2js source, serialization strategy, etc.

Here's the package-info for the 'fortest' package in the Javascript tests ...

@javax.xml.bind.annotation.XmlSchema(xmlns = {
                                     @javax.xml.bind.annotation.XmlNs(
                                       namespaceURI =
"uri:org.apache.cxf.javascript.testns3",
                                       prefix = "Plan3")
                                     }
                                    ,
                                     elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED
                                     )
package org.apache.cxf.javascript.fortest;

So, one would think that we're doing some qualified elephants. I'll
continue to dig.

On Mon, Aug 25, 2008 at 12:48 PM, Benson Margulies
<bi...@apache.org> wrote:
> There are unit tests for a lot of cases here, and I'm sure I've seen
> XML prefixes. I don't pretend to have the code generator memorized, so
> my approach in a case like this is to see if we've got the right test
> case, if not add it, and then watch for the fireworks when I run it.
> You are welcome to beat me to a check through the test cases. I don't
> have a strong prediction as to whether the code is right and you just
> haven't see why, or whether the code is wrong. I'll try to get into
> this tonight.
>
> On Mon, Aug 25, 2008 at 12:43 PM, Merritt, Norris <no...@hp.com> wrote:
>> Thanks Benson, I located the source, I was momentarily confused because the source trees in the source distribution do not follow the package names as closely as I expected. I finally found the source under "frontend".
>>
>> I wanted to look at the source to see about making some enhancements because I noticed that the serialization strategy seems to ignore attributes defined in the XML schema, and also seems to ignore elementFormDefault, i.e. there seems to be no provision for qualifying element names with prefixes during serialization.
>>
>> All of the serialization routines seem to take the following general form:
>>
>>    if (elementName != null) {
>>
>>     xml = xml + '<';
>>
>>     xml = xml + elementName;
>>
>>     xml = xml + ' ';
>>
>>     xml = xml + 'xmlns:jns0=\'http://xyz.com\';
>>
>>     if (extraNamespaces) {
>>
>>      xml = xml + ' ' + extraNamespaces;
>>
>>     }
>>
>>     xml = xml + '>';
>>
>>    }
>>
>> I don't see how attributes defined on the complex type for which "elementName" is being emitted are ever emitted, or how the serialized XML would survive validation if elementFormDefault="qualified" was specified in the XML schema.  Am I missing something?
>>
>> Thanks,
>> Norris
>>
>> -----Original Message-----
>> From: bimargulies@gmail.com [mailto:bimargulies@gmail.com] On Behalf Of Benson Margulies
>> Sent: Saturday, August 23, 2008 2:23 PM
>> To: Merritt, Norris; CXF Users
>> Subject: wsdl2js
>>
>> Norris,
>>
>> wsdl2js was subsumed into CXF. Most of the code is inside
>> rt/javascript, but the command-line interfaces are in the tools area.
>> There is documentation at
>> http://cwiki.apache.org/CXF20DOC/javascript-clients.html.
>>
>> --benson
>>
>

Re: wsdl2js source, serialization strategy, etc.

Posted by Benson Margulies <bi...@apache.org>.
See org.apache.cxf.javascript.ParticleInfo.factoryCommon(XmlSchemaParticle,
XmlSchema, SchemaCollection, NamespacePrefixAccumulator,
ParticleInfo).


And here's some XML serialized ...

<testBean1 xmlns:jns0='uri:org.apache.cxf.javascript.testns'
xmlns:jns1='uri:org.apache.cxf.javascript.testns2'
><jns0:stringItem>bean1&lt;stringItem</jns0:stringItem><jns1:intItem>64</jns1:intItem><jns0:longItem>64000000</jns0:longItem><jns0:base64Item></jns0:base64Item><jns0:optionalIntItem>101</jns0:optionalIntItem><jns0:optionalIntArrayItem>543</jns0:optionalIntArrayItem><jns0:doubleItem>-1</jns0:doubleItem><jns0:beanTwoItem
xmlns:jns0='uri:org.apache.cxf.javascript.testns'
xmlns:jns1='uri:org.apache.cxf.javascript.testns2'
xmlns:jns2='uri:org.apache.cxf.javascript.fortest'
xmlns:jns3='uri:org.apache.cxf.javascript.testns3'
><jns3:stringItem>bleep</jns3:stringItem></jns0:beanTwoItem></testBean1>



On Mon, Aug 25, 2008 at 3:39 PM, Benson Margulies
<bi...@apache.org> wrote:
> Here's the package-info for the 'fortest' package in the Javascript tests ...
>
> @javax.xml.bind.annotation.XmlSchema(xmlns = {
>                                     @javax.xml.bind.annotation.XmlNs(
>                                       namespaceURI =
> "uri:org.apache.cxf.javascript.testns3",
>                                       prefix = "Plan3")
>                                     }
>                                    ,
>                                     elementFormDefault =
> javax.xml.bind.annotation.XmlNsForm.QUALIFIED
>                                     )
> package org.apache.cxf.javascript.fortest;
>
> So, one would think that we're doing some qualified elephants. I'll
> continue to dig.
>
> On Mon, Aug 25, 2008 at 12:48 PM, Benson Margulies
> <bi...@apache.org> wrote:
>> There are unit tests for a lot of cases here, and I'm sure I've seen
>> XML prefixes. I don't pretend to have the code generator memorized, so
>> my approach in a case like this is to see if we've got the right test
>> case, if not add it, and then watch for the fireworks when I run it.
>> You are welcome to beat me to a check through the test cases. I don't
>> have a strong prediction as to whether the code is right and you just
>> haven't see why, or whether the code is wrong. I'll try to get into
>> this tonight.
>>
>> On Mon, Aug 25, 2008 at 12:43 PM, Merritt, Norris <no...@hp.com> wrote:
>>> Thanks Benson, I located the source, I was momentarily confused because the source trees in the source distribution do not follow the package names as closely as I expected. I finally found the source under "frontend".
>>>
>>> I wanted to look at the source to see about making some enhancements because I noticed that the serialization strategy seems to ignore attributes defined in the XML schema, and also seems to ignore elementFormDefault, i.e. there seems to be no provision for qualifying element names with prefixes during serialization.
>>>
>>> All of the serialization routines seem to take the following general form:
>>>
>>>    if (elementName != null) {
>>>
>>>     xml = xml + '<';
>>>
>>>     xml = xml + elementName;
>>>
>>>     xml = xml + ' ';
>>>
>>>     xml = xml + 'xmlns:jns0=\'http://xyz.com\';
>>>
>>>     if (extraNamespaces) {
>>>
>>>      xml = xml + ' ' + extraNamespaces;
>>>
>>>     }
>>>
>>>     xml = xml + '>';
>>>
>>>    }
>>>
>>> I don't see how attributes defined on the complex type for which "elementName" is being emitted are ever emitted, or how the serialized XML would survive validation if elementFormDefault="qualified" was specified in the XML schema.  Am I missing something?
>>>
>>> Thanks,
>>> Norris
>>>
>>> -----Original Message-----
>>> From: bimargulies@gmail.com [mailto:bimargulies@gmail.com] On Behalf Of Benson Margulies
>>> Sent: Saturday, August 23, 2008 2:23 PM
>>> To: Merritt, Norris; CXF Users
>>> Subject: wsdl2js
>>>
>>> Norris,
>>>
>>> wsdl2js was subsumed into CXF. Most of the code is inside
>>> rt/javascript, but the command-line interfaces are in the tools area.
>>> There is documentation at
>>> http://cwiki.apache.org/CXF20DOC/javascript-clients.html.
>>>
>>> --benson
>>>
>>
>

Re: wsdl2js source, serialization strategy, etc.

Posted by Benson Margulies <bi...@apache.org>.
Here's the package-info for the 'fortest' package in the Javascript tests ...

@javax.xml.bind.annotation.XmlSchema(xmlns = {
                                     @javax.xml.bind.annotation.XmlNs(
                                       namespaceURI =
"uri:org.apache.cxf.javascript.testns3",
                                       prefix = "Plan3")
                                     }
                                    ,
                                     elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED
                                     )
package org.apache.cxf.javascript.fortest;

So, one would think that we're doing some qualified elephants. I'll
continue to dig.

On Mon, Aug 25, 2008 at 12:48 PM, Benson Margulies
<bi...@apache.org> wrote:
> There are unit tests for a lot of cases here, and I'm sure I've seen
> XML prefixes. I don't pretend to have the code generator memorized, so
> my approach in a case like this is to see if we've got the right test
> case, if not add it, and then watch for the fireworks when I run it.
> You are welcome to beat me to a check through the test cases. I don't
> have a strong prediction as to whether the code is right and you just
> haven't see why, or whether the code is wrong. I'll try to get into
> this tonight.
>
> On Mon, Aug 25, 2008 at 12:43 PM, Merritt, Norris <no...@hp.com> wrote:
>> Thanks Benson, I located the source, I was momentarily confused because the source trees in the source distribution do not follow the package names as closely as I expected. I finally found the source under "frontend".
>>
>> I wanted to look at the source to see about making some enhancements because I noticed that the serialization strategy seems to ignore attributes defined in the XML schema, and also seems to ignore elementFormDefault, i.e. there seems to be no provision for qualifying element names with prefixes during serialization.
>>
>> All of the serialization routines seem to take the following general form:
>>
>>    if (elementName != null) {
>>
>>     xml = xml + '<';
>>
>>     xml = xml + elementName;
>>
>>     xml = xml + ' ';
>>
>>     xml = xml + 'xmlns:jns0=\'http://xyz.com\';
>>
>>     if (extraNamespaces) {
>>
>>      xml = xml + ' ' + extraNamespaces;
>>
>>     }
>>
>>     xml = xml + '>';
>>
>>    }
>>
>> I don't see how attributes defined on the complex type for which "elementName" is being emitted are ever emitted, or how the serialized XML would survive validation if elementFormDefault="qualified" was specified in the XML schema.  Am I missing something?
>>
>> Thanks,
>> Norris
>>
>> -----Original Message-----
>> From: bimargulies@gmail.com [mailto:bimargulies@gmail.com] On Behalf Of Benson Margulies
>> Sent: Saturday, August 23, 2008 2:23 PM
>> To: Merritt, Norris; CXF Users
>> Subject: wsdl2js
>>
>> Norris,
>>
>> wsdl2js was subsumed into CXF. Most of the code is inside
>> rt/javascript, but the command-line interfaces are in the tools area.
>> There is documentation at
>> http://cwiki.apache.org/CXF20DOC/javascript-clients.html.
>>
>> --benson
>>
>

Re: wsdl2js source, serialization strategy, etc.

Posted by Benson Margulies <bi...@apache.org>.
There are unit tests for a lot of cases here, and I'm sure I've seen
XML prefixes. I don't pretend to have the code generator memorized, so
my approach in a case like this is to see if we've got the right test
case, if not add it, and then watch for the fireworks when I run it.
You are welcome to beat me to a check through the test cases. I don't
have a strong prediction as to whether the code is right and you just
haven't see why, or whether the code is wrong. I'll try to get into
this tonight.

On Mon, Aug 25, 2008 at 12:43 PM, Merritt, Norris <no...@hp.com> wrote:
> Thanks Benson, I located the source, I was momentarily confused because the source trees in the source distribution do not follow the package names as closely as I expected. I finally found the source under "frontend".
>
> I wanted to look at the source to see about making some enhancements because I noticed that the serialization strategy seems to ignore attributes defined in the XML schema, and also seems to ignore elementFormDefault, i.e. there seems to be no provision for qualifying element names with prefixes during serialization.
>
> All of the serialization routines seem to take the following general form:
>
>    if (elementName != null) {
>
>     xml = xml + '<';
>
>     xml = xml + elementName;
>
>     xml = xml + ' ';
>
>     xml = xml + 'xmlns:jns0=\'http://xyz.com\';
>
>     if (extraNamespaces) {
>
>      xml = xml + ' ' + extraNamespaces;
>
>     }
>
>     xml = xml + '>';
>
>    }
>
> I don't see how attributes defined on the complex type for which "elementName" is being emitted are ever emitted, or how the serialized XML would survive validation if elementFormDefault="qualified" was specified in the XML schema.  Am I missing something?
>
> Thanks,
> Norris
>
> -----Original Message-----
> From: bimargulies@gmail.com [mailto:bimargulies@gmail.com] On Behalf Of Benson Margulies
> Sent: Saturday, August 23, 2008 2:23 PM
> To: Merritt, Norris; CXF Users
> Subject: wsdl2js
>
> Norris,
>
> wsdl2js was subsumed into CXF. Most of the code is inside
> rt/javascript, but the command-line interfaces are in the tools area.
> There is documentation at
> http://cwiki.apache.org/CXF20DOC/javascript-clients.html.
>
> --benson
>