You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Lucas Theisen <lt...@us.ibm.com> on 2007/01/31 01:59:46 UTC

Broken StAXOMBuilder

Hi,

I have been debugging some code that was generated by the Axis2 code 
generator.  The code appears to be working except that the namespace 
settings for the attributes are getting stripped off by the 
StAXOMBuilder.  Here is what I have done to narrow this down.  I added 
some print statements to the generated toOM method of the ServiceStub class:

     private org.apache.axiom.om.OMElement toOM(
 
com.ibm.specializedsolutions.onecontact.generated.SendMessagesDocument 
param,
             boolean optimizeContent ) {

System.out.println( "before - '" + param.toString( ) + "'" );
         org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new 
org.apache.axiom.om.impl.builder.StAXOMBuilder(
                 org.apache.axiom.om.OMAbstractFactory.getOMFactory( ),
                 new org.apache.axis2.util.StreamWrapper( param
                         .newXMLStreamReader( ) ) );
         org.apache.axiom.om.OMElement documentElement = builder
                 .getDocumentElement( );

         ((org.apache.axiom.om.impl.OMNodeEx) 
documentElement).setParent( null );
System.out.println( "after - '" + documentElement.toString( ) + "'" );
         return documentElement;
     }

The two print statements give this output:

before - '<sendMessages 
xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi">
   <client pag:id="foo" 
xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
   <transaction>
     <message>
       <content pag:type="text/plain" 
xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi">Test 
message</content>
       <from>ltheisen@us.ibm.com</from>
       <subject>URGENT: Testing</subject>
       <recipients>
         <profileRecipient pag:id="100000" 
xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
       </recipients>
     </message>
   </transaction>
</sendMessages>'
after - '<sendMessages 
xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi"><client 
xmlns:axis2ns1="http://specializedsolutions.boulder.ibm.com/pagerapi" 
id="foo" /><transaction><message><content 
xmlns:axis2ns2="http://specializedsolutions.boulder.ibm.com/pagerapi" 
type="text/plain">Test 
message</content><from>ltheisen@us.ibm.com</from><subject>URGENT: 
Testing</subject><recipients><profileRecipient 
xmlns:axis2ns3="http://specializedsolutions.boulder.ibm.com/pagerapi" 
id="100000" /></recipients></message></transaction></sendMessages>'

As you can see from this output, the xml initially had the "pag:" 
namespace qualification on the attributes, but after running through the 
StAXOMBuilder, the namespace settings are missing.  Also, there are 
additional namespace definitions that are never used.  Please help.

Thank you,
Lucas

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Broken StAXOMBuilder

Posted by Lucas Theisen <lt...@us.ibm.com>.
Dims,

After fixing the previous issue we ran into one more.  It turns out that 
our test case was creating a more complete xml to start from than the 
generated code (the generated code is not setting the prefix initially 
where as if you call .parse and pass in a string it did) so they 
resulted in hitting different cases in the code.  So we wrote another 
patch for the second issue we ran into.  We wrote it up and attached it 
to the previous issue WSCOMMONS-160, and reopened the issue.  Hopefully 
you can add this one to the source tree as well.  Now our generated 
client can communicate with our service :-).

Thank you for all your help,
Lucas

Lucas J Theisen wrote:
> Dims,
> 
> I looked into this issue myself, and fixed the source code.  It is 
> actually in the axiom package.  It is a problem with OMSerializerUtil. I 
> added the svn patch file to the ticket I created in JIRA.  You can 
> review it and hopefully add it to your source tree.  For now I will have 
> to use the copy I edited.
> 
> Thank you,
> Lucas
> 
> Lucas J Theisen wrote:
>> Dims,
>>
>> AXIS2-2068 was created with a small code example that demonstrates 
>> this issue.  I appreciate your help with this issue.
>>
>> Thanks,
>> Lucas
>>
>> Davanum Srinivas wrote:
>>> Lucas,
>>>
>>> Please create a JIRA issue and upload a complete test that can be used
>>> to diagnose/fix the problem. That will help speed things up.
>>>
>>> thanks,
>>> dims
>>>
>>> On 1/30/07, Lucas Theisen <lt...@us.ibm.com> wrote:
>>>> Hi,
>>>>
>>>> I have been debugging some code that was generated by the Axis2 code
>>>> generator.  The code appears to be working except that the namespace
>>>> settings for the attributes are getting stripped off by the
>>>> StAXOMBuilder.  Here is what I have done to narrow this down.  I added
>>>> some print statements to the generated toOM method of the 
>>>> ServiceStub class:
>>>>
>>>>      private org.apache.axiom.om.OMElement toOM(
>>>>
>>>> com.ibm.specializedsolutions.onecontact.generated.SendMessagesDocument
>>>> param,
>>>>              boolean optimizeContent ) {
>>>>
>>>> System.out.println( "before - '" + param.toString( ) + "'" );
>>>>          org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new
>>>> org.apache.axiom.om.impl.builder.StAXOMBuilder(
>>>>                  org.apache.axiom.om.OMAbstractFactory.getOMFactory( ),
>>>>                  new org.apache.axis2.util.StreamWrapper( param
>>>>                          .newXMLStreamReader( ) ) );
>>>>          org.apache.axiom.om.OMElement documentElement = builder
>>>>                  .getDocumentElement( );
>>>>
>>>>          ((org.apache.axiom.om.impl.OMNodeEx)
>>>> documentElement).setParent( null );
>>>> System.out.println( "after - '" + documentElement.toString( ) + "'" );
>>>>          return documentElement;
>>>>      }
>>>>
>>>> The two print statements give this output:
>>>>
>>>> before - '<sendMessages
>>>> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi">
>>>>    <client pag:id="foo"
>>>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>>>>    <transaction>
>>>>      <message>
>>>>        <content pag:type="text/plain"
>>>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi">Test
>>>> message</content>
>>>>        <from>ltheisen@us.ibm.com</from>
>>>>        <subject>URGENT: Testing</subject>
>>>>        <recipients>
>>>>          <profileRecipient pag:id="100000"
>>>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>>>>        </recipients>
>>>>      </message>
>>>>    </transaction>
>>>> </sendMessages>'
>>>> after - '<sendMessages
>>>> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi"><client
>>>> xmlns:axis2ns1="http://specializedsolutions.boulder.ibm.com/pagerapi"
>>>> id="foo" /><transaction><message><content
>>>> xmlns:axis2ns2="http://specializedsolutions.boulder.ibm.com/pagerapi"
>>>> type="text/plain">Test
>>>> message</content><from>ltheisen@us.ibm.com</from><subject>URGENT:
>>>> Testing</subject><recipients><profileRecipient
>>>> xmlns:axis2ns3="http://specializedsolutions.boulder.ibm.com/pagerapi"
>>>> id="100000" /></recipients></message></transaction></sendMessages>'
>>>>
>>>> As you can see from this output, the xml initially had the "pag:"
>>>> namespace qualification on the attributes, but after running through 
>>>> the
>>>> StAXOMBuilder, the namespace settings are missing.  Also, there are
>>>> additional namespace definitions that are never used.  Please help.
>>>>
>>>> Thank you,
>>>> Lucas
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>
>>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Broken StAXOMBuilder

Posted by Lucas Theisen <lt...@us.ibm.com>.
Dims,

I looked into this issue myself, and fixed the source code.  It is 
actually in the axiom package.  It is a problem with OMSerializerUtil. 
I added the svn patch file to the ticket I created in JIRA.  You can 
review it and hopefully add it to your source tree.  For now I will have 
to use the copy I edited.

Thank you,
Lucas

Lucas J Theisen wrote:
> Dims,
> 
> AXIS2-2068 was created with a small code example that demonstrates this 
> issue.  I appreciate your help with this issue.
> 
> Thanks,
> Lucas
> 
> Davanum Srinivas wrote:
>> Lucas,
>>
>> Please create a JIRA issue and upload a complete test that can be used
>> to diagnose/fix the problem. That will help speed things up.
>>
>> thanks,
>> dims
>>
>> On 1/30/07, Lucas Theisen <lt...@us.ibm.com> wrote:
>>> Hi,
>>>
>>> I have been debugging some code that was generated by the Axis2 code
>>> generator.  The code appears to be working except that the namespace
>>> settings for the attributes are getting stripped off by the
>>> StAXOMBuilder.  Here is what I have done to narrow this down.  I added
>>> some print statements to the generated toOM method of the ServiceStub 
>>> class:
>>>
>>>      private org.apache.axiom.om.OMElement toOM(
>>>
>>> com.ibm.specializedsolutions.onecontact.generated.SendMessagesDocument
>>> param,
>>>              boolean optimizeContent ) {
>>>
>>> System.out.println( "before - '" + param.toString( ) + "'" );
>>>          org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new
>>> org.apache.axiom.om.impl.builder.StAXOMBuilder(
>>>                  org.apache.axiom.om.OMAbstractFactory.getOMFactory( ),
>>>                  new org.apache.axis2.util.StreamWrapper( param
>>>                          .newXMLStreamReader( ) ) );
>>>          org.apache.axiom.om.OMElement documentElement = builder
>>>                  .getDocumentElement( );
>>>
>>>          ((org.apache.axiom.om.impl.OMNodeEx)
>>> documentElement).setParent( null );
>>> System.out.println( "after - '" + documentElement.toString( ) + "'" );
>>>          return documentElement;
>>>      }
>>>
>>> The two print statements give this output:
>>>
>>> before - '<sendMessages
>>> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi">
>>>    <client pag:id="foo"
>>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>>>    <transaction>
>>>      <message>
>>>        <content pag:type="text/plain"
>>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi">Test
>>> message</content>
>>>        <from>ltheisen@us.ibm.com</from>
>>>        <subject>URGENT: Testing</subject>
>>>        <recipients>
>>>          <profileRecipient pag:id="100000"
>>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>>>        </recipients>
>>>      </message>
>>>    </transaction>
>>> </sendMessages>'
>>> after - '<sendMessages
>>> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi"><client
>>> xmlns:axis2ns1="http://specializedsolutions.boulder.ibm.com/pagerapi"
>>> id="foo" /><transaction><message><content
>>> xmlns:axis2ns2="http://specializedsolutions.boulder.ibm.com/pagerapi"
>>> type="text/plain">Test
>>> message</content><from>ltheisen@us.ibm.com</from><subject>URGENT:
>>> Testing</subject><recipients><profileRecipient
>>> xmlns:axis2ns3="http://specializedsolutions.boulder.ibm.com/pagerapi"
>>> id="100000" /></recipients></message></transaction></sendMessages>'
>>>
>>> As you can see from this output, the xml initially had the "pag:"
>>> namespace qualification on the attributes, but after running through the
>>> StAXOMBuilder, the namespace settings are missing.  Also, there are
>>> additional namespace definitions that are never used.  Please help.
>>>
>>> Thank you,
>>> Lucas
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>>
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Broken StAXOMBuilder

Posted by Lucas Theisen <lt...@us.ibm.com>.
Dims,

AXIS2-2068 was created with a small code example that demonstrates this 
issue.  I appreciate your help with this issue.

Thanks,
Lucas

Davanum Srinivas wrote:
> Lucas,
> 
> Please create a JIRA issue and upload a complete test that can be used
> to diagnose/fix the problem. That will help speed things up.
> 
> thanks,
> dims
> 
> On 1/30/07, Lucas Theisen <lt...@us.ibm.com> wrote:
>> Hi,
>>
>> I have been debugging some code that was generated by the Axis2 code
>> generator.  The code appears to be working except that the namespace
>> settings for the attributes are getting stripped off by the
>> StAXOMBuilder.  Here is what I have done to narrow this down.  I added
>> some print statements to the generated toOM method of the ServiceStub 
>> class:
>>
>>      private org.apache.axiom.om.OMElement toOM(
>>
>> com.ibm.specializedsolutions.onecontact.generated.SendMessagesDocument
>> param,
>>              boolean optimizeContent ) {
>>
>> System.out.println( "before - '" + param.toString( ) + "'" );
>>          org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new
>> org.apache.axiom.om.impl.builder.StAXOMBuilder(
>>                  org.apache.axiom.om.OMAbstractFactory.getOMFactory( ),
>>                  new org.apache.axis2.util.StreamWrapper( param
>>                          .newXMLStreamReader( ) ) );
>>          org.apache.axiom.om.OMElement documentElement = builder
>>                  .getDocumentElement( );
>>
>>          ((org.apache.axiom.om.impl.OMNodeEx)
>> documentElement).setParent( null );
>> System.out.println( "after - '" + documentElement.toString( ) + "'" );
>>          return documentElement;
>>      }
>>
>> The two print statements give this output:
>>
>> before - '<sendMessages
>> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi">
>>    <client pag:id="foo"
>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>>    <transaction>
>>      <message>
>>        <content pag:type="text/plain"
>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi">Test
>> message</content>
>>        <from>ltheisen@us.ibm.com</from>
>>        <subject>URGENT: Testing</subject>
>>        <recipients>
>>          <profileRecipient pag:id="100000"
>> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>>        </recipients>
>>      </message>
>>    </transaction>
>> </sendMessages>'
>> after - '<sendMessages
>> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi"><client
>> xmlns:axis2ns1="http://specializedsolutions.boulder.ibm.com/pagerapi"
>> id="foo" /><transaction><message><content
>> xmlns:axis2ns2="http://specializedsolutions.boulder.ibm.com/pagerapi"
>> type="text/plain">Test
>> message</content><from>ltheisen@us.ibm.com</from><subject>URGENT:
>> Testing</subject><recipients><profileRecipient
>> xmlns:axis2ns3="http://specializedsolutions.boulder.ibm.com/pagerapi"
>> id="100000" /></recipients></message></transaction></sendMessages>'
>>
>> As you can see from this output, the xml initially had the "pag:"
>> namespace qualification on the attributes, but after running through the
>> StAXOMBuilder, the namespace settings are missing.  Also, there are
>> additional namespace definitions that are never used.  Please help.
>>
>> Thank you,
>> Lucas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Broken StAXOMBuilder

Posted by Davanum Srinivas <da...@gmail.com>.
Lucas,

Please create a JIRA issue and upload a complete test that can be used
to diagnose/fix the problem. That will help speed things up.

thanks,
dims

On 1/30/07, Lucas Theisen <lt...@us.ibm.com> wrote:
> Hi,
>
> I have been debugging some code that was generated by the Axis2 code
> generator.  The code appears to be working except that the namespace
> settings for the attributes are getting stripped off by the
> StAXOMBuilder.  Here is what I have done to narrow this down.  I added
> some print statements to the generated toOM method of the ServiceStub class:
>
>      private org.apache.axiom.om.OMElement toOM(
>
> com.ibm.specializedsolutions.onecontact.generated.SendMessagesDocument
> param,
>              boolean optimizeContent ) {
>
> System.out.println( "before - '" + param.toString( ) + "'" );
>          org.apache.axiom.om.impl.builder.StAXOMBuilder builder = new
> org.apache.axiom.om.impl.builder.StAXOMBuilder(
>                  org.apache.axiom.om.OMAbstractFactory.getOMFactory( ),
>                  new org.apache.axis2.util.StreamWrapper( param
>                          .newXMLStreamReader( ) ) );
>          org.apache.axiom.om.OMElement documentElement = builder
>                  .getDocumentElement( );
>
>          ((org.apache.axiom.om.impl.OMNodeEx)
> documentElement).setParent( null );
> System.out.println( "after - '" + documentElement.toString( ) + "'" );
>          return documentElement;
>      }
>
> The two print statements give this output:
>
> before - '<sendMessages
> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi">
>    <client pag:id="foo"
> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>    <transaction>
>      <message>
>        <content pag:type="text/plain"
> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi">Test
> message</content>
>        <from>ltheisen@us.ibm.com</from>
>        <subject>URGENT: Testing</subject>
>        <recipients>
>          <profileRecipient pag:id="100000"
> xmlns:pag="http://specializedsolutions.boulder.ibm.com/pagerapi"/>
>        </recipients>
>      </message>
>    </transaction>
> </sendMessages>'
> after - '<sendMessages
> xmlns="http://specializedsolutions.boulder.ibm.com/pagerapi"><client
> xmlns:axis2ns1="http://specializedsolutions.boulder.ibm.com/pagerapi"
> id="foo" /><transaction><message><content
> xmlns:axis2ns2="http://specializedsolutions.boulder.ibm.com/pagerapi"
> type="text/plain">Test
> message</content><from>ltheisen@us.ibm.com</from><subject>URGENT:
> Testing</subject><recipients><profileRecipient
> xmlns:axis2ns3="http://specializedsolutions.boulder.ibm.com/pagerapi"
> id="100000" /></recipients></message></transaction></sendMessages>'
>
> As you can see from this output, the xml initially had the "pag:"
> namespace qualification on the attributes, but after running through the
> StAXOMBuilder, the namespace settings are missing.  Also, there are
> additional namespace definitions that are never used.  Please help.
>
> Thank you,
> Lucas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org