Radu,

Thanks so much for the reply :)

The "version" attribute isn't required, just fyi ;)
I think the reason the web service is not accepting the xmlbeans message,
but is accepting the "manually generated" message is simply because of the
lack of namespace prefix.  Since the schema explicitly states them as
"qualified", the JAXB unmarshalling is expecting namespaces, not finding
them, then issuing these errors:

A required element or attribute is missing: Unexpected element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2
_0.xsd}:From
A required element or attribute is missing: Unexpected element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2
_0.xsd}:To
A required element or attribute is missing: Unexpected element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2
_0.xsd}:CPAId
A required element or attribute is missing: Unexpected element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2
_0.xsd}:ConversationId
A required element or attribute is missing: Unexpected element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2
_0.xsd}:Service
A required element or attribute is missing: Unexpected element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2
_0.xsd}:Action
A required element or attribute is missing: Unexpected element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2
_0.xsd}:MessageData
A required element or attribute is missing: Unexpected end of element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-h
eader-2_0.xsd}:MessageHeader
Error processing message header element: Unexpected end of element
{http://www.oasis-open.org/committees/ebxml-msg/schema/msg-head
er-2_0.xsd}:MessageHeader

I was using the toString() to see what the XML document looked like within
my client.  Then I noticed the xmlText() method and just tried it to see
what it would look like.  toString() was "pretty-printed", and did not
included any namespaces.  While xmlText() was one giant line, but *did*
include namespace prefixes for *every* element.

Here's an example of xmlText() (I pretty-printed it in xmlspy just for
readability):

<msg:MessageHeader soapenv:mustUnderstand="false" msg:version="4.0"
xmlns:msg="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd";
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
        <msg:From>
                <msg:PartyId>data</msg:PartyId>
        </msg:From>
        <msg:To>
                <msg:PartyId>data</msg:PartyId>
        </msg:To>
        <msg:CPAId>data</msg:CPAId>
        <msg:ConversationId>data</msg:ConversationId>
        <msg:Service msg:type="4.0">data</msg:Service>
        <msg:Action>data</msg:Action>
        <msg:MessageData>
                <msg:MessageId>1</msg:MessageId>
                <msg:Timestamp>2008-05-29T09:25:54.486-05:00</msg:Timestamp>
        </msg:MessageData>
</msg:MessageHeader>

But what the web service receives is:

<MessageHeader
xmlns="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-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-22T10:38:34.287-05:00</Timestamp>
        </MessageData>
</MessageHeader>


I don't specifically call any method to format the data objects to the SOAP
message to be sent to the web service, that's all handled (I believe) in the
guts of the:

_operationClient.execute(true);

method in the ServiceStub class.  I would think that the execute method
would use xmlText() though, or something else that arrived at the same
document.  That's part of the reason I'm confused here!

Any ideas?
Thanks again :)
chris



Radu Preotiuc-Pietro wrote:
> 
> 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:[EMAIL PROTECTED] 
>> Sent: Wednesday, May 28, 2008 8:54 AM
>> To: [email protected]
>> 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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
> 
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Question-about-element-attributeFormDefault-and-xmlbeans-output-tp17514490p17536242.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to