I am trying to consume one of the strikeiron web services which take an input
soap header and return an output soap header.  When I execute a request that
has an input soap header and an output soap header I get a null pointer
exception.  The request is sent successfully and the response is recieved
but it cannot be unmarshalled.  The null pointer exception is misleading
because it occurs when handling another exception.  This is the null pointer
exception:
Caused by: java.lang.NullPointerException
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:592)
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:498)
        at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:40)
        at
org.apache.cxf.binding.soap.interceptor.SoapHeaderInterceptor.handleMessage(SoapHeaderInterceptor.java:101)

This is the actual exception (unfortunately no stack trace):
javax.xml.bind.UnmarshalException: unexpected element
(uri:"http://ws.strikeiron.com";, local:"SubscriptionInfo"). Expected
elements are
<{http://www.strikeiron.com}GetAllStatuses>,<{http://www.strikeiron.com}GetAllStatusesResponse>,<{http://www.strikeiron.com}GetAllTeamNicknames>,<{http://www.strikeiron.com}GetAllTeamNicknamesResponse>,<{http://www.strikeiron.com}GetRemainingHits>,<{http://www.strikeiron.com}GetRemainingHitsResponse>,<{http://www.strikeiron.com}GetServiceInfo>,<{http://www.strikeiron.com}GetServiceInfoResponse>,<{http://www.strikeiron.com}GetTeamInfoByCity>,<{http://www.strikeiron.com}GetTeamInfoByCityResponse>,<{http://www.strikeiron.com}GetTeamInfoByNickname>,<{http://www.strikeiron.com}GetTeamInfoByNicknameResponse>

I have traced through the code and it looks like cxf is trying to unmarshal
a Node without a class.  
Snippet of code from JAXBEncoderDecoder (unmarshalWithClass is false):
            if (source instanceof Node) {
                obj = unmarshalWithClass ? u.unmarshal((Node)source, clazz)
: u.unmarshal((Node)source);
            } else if (source instanceof XMLStreamReader) {


And that is because the MessagePartInfo.getTypeClass() method returns null. 
I cannot find a place where the type class is set for the MessagePartInfo
for the output soap header.

I have included a snippet of my interface if that helps - I'm thinking I
must have something annotated incorrectly.
        @ResponseWrapper(className =
"data.footballws.sdpnflteamssoap.com.strikeiron.www.GetAllTeamNicknamesResponse",
targetNamespace = "http://www.strikeiron.com";, localName =
"GetAllTeamNicknamesResponse")
        @RequestWrapper(className =
"data.footballws.sdpnflteamssoap.com.strikeiron.www.GetAllTeamNicknames",
targetNamespace = "http://www.strikeiron.com";, localName =
"GetAllTeamNicknames")
        @WebMethod(action = "http://www.strikeiron.com/GetAllTeamNicknames";,
operationName = "GetAllTeamNicknames")
        public void _GetAllTeamNicknames(@WebParam(partName = "LicenseInfoPart",
header = true, mode = WebParam.Mode.IN, targetNamespace =
"http://www.strikeiron.com";, name = "LicenseInfo")
        LicenseInfo LicenseInfo, @WebParam(partName =
"GetAllTeamNicknamesResultPart", mode = WebParam.Mode.OUT, targetNamespace =
"http://www.strikeiron.com";, name = "GetAllTeamNicknamesResult")
        Holder<NFLTeamOutput> GetAllTeamNicknamesResult, @WebParam(partName =
"SubscriptionInfoPart", header = true, mode = WebParam.Mode.OUT,
targetNamespace = "http://www.strikeiron.com";, name = "SubscriptionInfo")
        Holder<SubscriptionInfo> SubscriptionInfo);

Does anybody have an idea what I might be doing wrong?

BTW - I am using 2.0.5.
-- 
View this message in context: 
http://www.nabble.com/NullPointerException-decoding-response-with-SOAP-header-tp17239110p17239110.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to