On Sat, Nov 19, 2011 at 8:58 AM, Andreas Veithen
<[email protected]>wrote:
> Assuming that the namespace in question is not the SOAP envelope
> namespace, instead of hacking Axiom, wouldn't it be easier to remove
> the namespace declaration from the SOAP envelope (so that it will be
> serialized in the SOAP header block)?
>
How to do this?
In other words it is like this,
The following code gives an xml like this,
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement parentElement = omFactory.createOMElement(new QName("
http://test.com/parent", "parent"));
OMElement childElement = omFactory.createOMElement(new QName("
http://test.com/child","child"));
childElement.setText("child");
parentElement.addChild(childElement);
System.out.println("OMElement ==> " + parentElement.toString());
xml --> <axis2ns1:parent
xmlns:axis2ns1="http://test.com/parent"><axis2ns2:child
xmlns:axis2ns2="http://test.com/child
">child</axis2ns2:child></axis2ns1:parent>
if I change the code like this,
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement parentElement = omFactory.createOMElement(new QName("
http://test.com/parent", "parent"));
OMElement childElement = omFactory.createOMElement(new QName("
http://test.com/child","child"));
childElement.setText("child");
parentElement.addChild(childElement);
*parentElement.declareNamespace("http://test.com/child",
"axis2ns2");*
System.out.println("OMElement ==> " + parentElement.toString());
<axis2ns1:parent xmlns:axis2ns1="http://test.com/parent" xmlns:axis2ns2="
http://test.com/child
"><axis2ns2:child>child</axis2ns2:child></axis2ns1:parent>
How can I get the former serialization format by changing the OMElement at
the latter method. If possible this may solve the charithas' problem.
thanks,
Amila.
>
> Andreas
>
> On Sat, Nov 19, 2011 at 06:11, Charith Wickramarachchi
> <[email protected]> wrote:
> > Hi Andreas,
> >
> > Issue was this causes an Error in a 3rd party web-service engine when
> > processing some soap headers.
> >
> > Scenario is this. Synapse get a soap request which contains some
> redundant
> > namespace declarations at header level which are internally used inside
> the
> > headers. So when synapse forward them to the BE service they get
> omitted as
> > they are defined at SOAP Envelope level.
> >
> > BE services header processor incorrectly assumes that headers are self
> > contained so this causes an error.
> >
> > I was wondering it may make scene to make it configurable as if we think
> > of synapse point of view omitting redundant namespaces may not be a good
> > idea sometimes. Specially integrating with legacies like this. WDYT ? (
> I do
> > agree that this in pure AXIOM point of view its the correct thing to do
> as
> > it will reduce the data content that is written to the wire etc.. )
> >
> > Can please you point me to a place where this is done ? So that i can
> hack
> > the code for the time being for my self and later provide a patch if devs
> > are ok with my above idea.
> >
> > thanks,
> > Charith
> >
> >
> >
> >
> >
> > On Fri, Nov 18, 2011 at 3:55 PM, Andreas Veithen <
> [email protected]>
> > wrote:
> >>
> >> No, the namespace repairing performed by the serialize and
> >> serializeAndConsume methods is not configurable.
> >>
> >> What is the use case for preserving a redundant namespace declaration
> >> on a SOAP header?
> >>
> >> Andreas
> >>
> >> On Fri, Nov 18, 2011 at 03:23, Charith Wickramarachchi
> >> <[email protected]> wrote:
> >> > Hi devs ,
> >> >
> >> > When we serialize a OMElement axiom will omit redundant namesspace
> >> > declarations by default. Is it possible to disable this behavior ?
> >> > In my case i want to keep the redundant namesspace declarations in
> SOAP
> >> > headers.
> >> >
> >> >
> >> > thanks,
> >> > Charith
> >> >
> >> > --
> >> > Charith Dhanushka Wickramarachchi
> >> > http://charithwiki.blogspot.com/
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >
> >
> >
> > --
> > Charith Dhanushka Wickramarachchi
> > http://charithwiki.blogspot.com/
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/