[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-user
Subject:    RE: Question about element/attributeFormDefault and xmlbeans output
From:       "Radu Preotiuc-Pietro" <radup () bea ! com>
Date:       2008-05-28 23:45:44
Message-ID: BF6B6CA032BA0A429BD924F96765147DCC6466 () repbex02 ! amer ! bea ! com
[Download RAW message or body]

With the exception of the fact that your second document has a
ns2:version="4.0" attribute on the <MessageHeader> element that the
first document doesn't seem to have, the two documents are equivalent as
far as I can see. I am surprised that the web service would accept one
but not the other (again, modulo that missing "version" attribute). It
would be interesting to see what the error message is.

When you say "that's not what is used when actually generating the SOAP
message", who is using toString() instead of xmlText()? XMLBeans offers
toString() as a quick way to dump the XmlObject to XML and xmlText() as
a configurable way to serialize to XML. So I would use toString() if I
want to look at the XML and xmlText() if generating XML to send out.

Radu

> -----Original Message-----
> From: chrisneal [mailto:chris.neal@pegs.com] 
> Sent: Wednesday, May 28, 2008 8:54 AM
> To: user@xmlbeans.apache.org
> Subject: Re: Question about element/attributeFormDefault and 
> xmlbeans output
> 
> 
> Ok, I found this as interesting.  I was dumping the XML with 
> the toString() method.  If I dump the XML with the xmlText() 
> (without passing any XMLOptions to it) method, all the 
> namespace prefixes show up.  Apparently that's not what is 
> used when actually generating the SOAP message to send to the 
> web service.
> 
> chris
> 
> 
> 
> chrisneal wrote:
> > 
> > Hi all.
> > 
> > I have a schema file where the xmlbeans generated XML doc 
> doesn't seem 
> > to match it with regards to namespace prefixes.  If I understand 
> > correctly, when elementFormDefault or attributeFormDefault 
> is set to 
> > "qualified", then elements from the targetNameSpace must be 
> qualified 
> > with the namespace prefix.  If they are set to "unqualified", then 
> > they do not need to be.
> > 
> > My xsd file looks like this:
> > 
> > <schema
> > 
> targetNamespace="http://www.oasis-open.org/committees/ebxml-ms
> g/schema/msg-header-2_0.xsd"
> > 
> xmlns:tns="http://www.oasis-open.org/committees/ebxml-msg/sche
> ma/msg-header-2_0.xsd" 
> > xmlns:ds="http://www.w3.org/2000/09/xmldsig#" 
> > xmlns:xlink="http://www.w3.org/1999/xlink" 
> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
> > xmlns="http://www.w3.org/2001/XMLSchema" 
> > elementFormDefault="qualified" 
> > attributeFormDefault="qualified"
> > version="2.0c">
> > 
> > That's obviously just the <schema> element, not the entire 
> doc :)  The 
> > rest of the document does not define any other form="unqualified"
> > attributes on any child elements, so again, if I understand 
> correctly, 
> > the "qualified" definitions from the <schema> element should be 
> > inherited by its children.
> > 
> > The XML doc that is generated looks like this:
> > 
> > <MessageHeader
> > 
> xmlns="http://www.oasis-open.org/committees/ebxml-msg/schema/m
> sg-header-2_0.xsd"
> > soapenv:mustUnderstand="0">
> > 	<From>
> > 		<PartyId>data</PartyId>
> > 	</From>
> > 	<To>
> > 		<PartyId>data</PartyId>
> > 	</To>
> > 	<CPAId>data</CPAId>
> > 	<ConversationId>data</ConversationId>
> > 	<Service
> > 
> xmlns:axis2ns2="http://www.oasis-open.org/committees/ebxml-msg
> /schema/msg-header-2_0.xsd"
> > axis2ns2:type="4.0">data</Service>
> > 	<Action>data</Action>
> > 	<MessageData>
> > 		<MessageId>1</MessageId>
> > 		<Timestamp>2008-05-22T15:33:02.576-05:00</Timestamp>
> > 	</MessageData>
> > </MessageHeader>
> > 
> > Which produces errors from the web service.  When I 
> manually change it 
> > to look like this:
> > 
> > <ns2:MessageHeader 
> xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
> > 
> xmlns:ns2="http://www.oasis-open.org/committees/ebxml-msg/sche
> ma/msg-header-2_0.xsd"
> > ns1:mustUnderstand="false" ns2:version="4.0">
> > <ns2:From>
> > <ns2:PartyId>data</ns2:PartyId>
> > </ns2:From>
> > <ns2:To>
> > <ns2:PartyId>data</ns2:PartyId>
> > </ns2:To>
> > <ns2:CPAId>data</ns2:CPAId>
> > <ns2:ConversationId>data</ns2:ConversationId>
> > <ns2:Service ns2:type="4.0">data</ns2:Service>
> > <ns2:Action>data</ns2:Action>
> > <ns2:MessageData>
> > <ns2:MessageId>1</ns2:MessageId>
> > <ns2:Timestamp>2008-05-22T15:33:02.576-05:00</ns2:Timestamp>
> > </ns2:MessageData>
> > </ns2:MessageHeader>
> > 
> > Then everything works great.
> > 
> > Shouldn't my XMLBeans output look like the element that 
> works, and not 
> > the one it is actually producing, based on the schema 
> definition?  Or 
> > am I missing something?
> > 
> > Thanks so much!
> > chris
> > 
> > 
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/Question-about-element-attributeFormDefa
> ult-and-xmlbeans-output-tp17514490p17515908.html
> Sent from the Xml Beans - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 

Notice:  This email message, together with any attachments, may contain information  \
of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be \
confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended \
solely for the use of the individual or entity named in this message. If you are not \
the intended recipient, and have received this message in error, please immediately \
return this by email and then delete it.

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic