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>[EMAIL PROTECTED]</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>[EMAIL PROTECTED]</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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to