You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by surfercherokee <wg...@hotmail.com> on 2012/08/06 23:31:51 UTC

Unmarshal error

Hello all,

I'm getting an unmarshalling  error.  I am trying to use a web service where
the top level xml node is ReceiveXml  which contains a Transmission node. 
The transmission node will have a different namespace.

WSDL:

    <s:schema elementFormDefault="qualified"
targetNamespace="urn:SpotBuySpot:InboundOrders-to-Reps">
      <s:element name="ReceiveXml">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="xmlDoc">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any/>
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>


My java class ReceiveXml has a class for XmlDoc which is supposed to hold
the Transmission node.  I tried to change the namespace to correspond the
the soap call:  

public static class XmlDoc {
@XmlElement(name="org.aaaa.schemas.spotradioorder.Transmission",
namespace="uri:http://www.AAAA.org/schemas/spotRadioOrder")    
    	protected List content;



When I use the SoapUI, I get the following error message:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>Unmarshalling Error: unexpected element  
(uri:"http://www.AAAA.org/schemas/spotRadioOrder", local:"Transmission").
         Expected elements are
&lt;{uri:http://www.AAAA.org/schemas/spotRadioOrder}org.aaaa.schemas.spotradioorder.Transmission></faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>


Any help will be appreciated.

Thanks.



--
View this message in context: http://cxf.547215.n5.nabble.com/Unmarshal-error-tp5712088.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unmarshal error

Posted by surfercherokee <wg...@hotmail.com>.
Think I fixed it.

Don't really want it to unmarshal.  Just put it into an element node and I
will get it myself by getting the child nodes.

My workaround:  

  @XmlMixed
  @XmlAnyElement(lax = false)  
  protected List content;
  public List getContent() {
     if (content == null) {
            content = new ArrayList();
     }
     return this.content;
  }


lax = false seems to be key, otherwise it tries to marshal it into.



--
View this message in context: http://cxf.547215.n5.nabble.com/Unmarshal-error-tp5712088p5712134.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unmarshal error

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

It's not the namespace mismatch, it's the localname mismatch.
Per the annotation here
@XmlElement(name="org.aaaa.schemas.spotradioorder.Transmission",
namespace="uri:http://www.AAAA.org/schemas/spotRadioOrder")    
you really should send an xml using org.aaaa.schemas.spotradioorder.Transmission but not Transmission  as element name

Freeman
-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-7, at 上午5:31, surfercherokee wrote:

> Hello all,
> 
> I'm getting an unmarshalling  error.  I am trying to use a web service where
> the top level xml node is ReceiveXml  which contains a Transmission node. 
> The transmission node will have a different namespace.
> 
> WSDL:
> 
>    <s:schema elementFormDefault="qualified"
> targetNamespace="urn:SpotBuySpot:InboundOrders-to-Reps">
>      <s:element name="ReceiveXml">
>        <s:complexType>
>          <s:sequence>
>            <s:element minOccurs="0" maxOccurs="1" name="xmlDoc">
>              <s:complexType mixed="true">
>                <s:sequence>
>                  <s:any/>
>                </s:sequence>
>              </s:complexType>
>            </s:element>
>          </s:sequence>
>        </s:complexType>
>      </s:element>
> 
> 
> My java class ReceiveXml has a class for XmlDoc which is supposed to hold
> the Transmission node.  I tried to change the namespace to correspond the
> the soap call:  
> 
> public static class XmlDoc {
> @XmlElement(name="org.aaaa.schemas.spotradioorder.Transmission",
> namespace="uri:http://www.AAAA.org/schemas/spotRadioOrder")    
>    	protected List content;
> 
> 
> 
> When I use the SoapUI, I get the following error message:
> 
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>      <soap:Fault>
>         <faultcode>soap:Client</faultcode>
>         <faultstring>Unmarshalling Error: unexpected element  
> (uri:"http://www.AAAA.org/schemas/spotRadioOrder", local:"Transmission").
>         Expected elements are
> &lt;{uri:http://www.AAAA.org/schemas/spotRadioOrder}org.aaaa.schemas.spotradioorder.Transmission></faultstring>
>      </soap:Fault>
>   </soap:Body>
> </soap:Envelope>
> 
> 
> Any help will be appreciated.
> 
> Thanks.
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Unmarshal-error-tp5712088.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Re: Unmarshal error

Posted by surfercherokee <wg...@hotmail.com>.
I can't change the XML which is sent.  Can I change my annotation to resolve
the local mismatch?



--
View this message in context: http://cxf.547215.n5.nabble.com/Unmarshal-error-tp5712088p5712133.html
Sent from the cxf-user mailing list archive at Nabble.com.