Hi All,

I encountered this by accident. Here is the scenario:

expected payload:
<Account xmlns="http://some.namespace/";>
... more here

submitted payload:
<Account xmlns="http://accounts.some.namespace/";>
... more details here

On the server side, I see the error as:

javax.xml.bind.UnmarshalException: unexpected element (uri:"http://accounts.some.namespace/";, local:"Account"). Expected elements are <{http://some.namespace/}Account> at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603)

However, on the client-side (using http commons client) I receive this as response content: <ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat";><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat";>java.lang.NullPointerException</ns1:faultstring></ns1:XMLFault>

As additional info the Account is annotated as follows:

@XmlType(name="Account")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name="Account")
public class WSAccount {

with a class package-info.java annotated as follows:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://subscriber.ws.solegy.com/";, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)

The service implementation is annotated as follows:

@ConsumeMime("*/xml")
@ProduceMime("*/xml")
public class RestAccountService {
   @POST
   @Path("/")
   public int update(
           @Context HttpHeaders header,
           WSAccount account
           ) {
       return 1;
   }
}

The content is the same as captured by tcpmon, so that clears out the client api. I am however, unable to trace where the NPE happens. Is there something I should set to avoid the NPE?

Gabo

Reply via email to