PDA

View Full Version : Response from JAXB endpoint is missing root element


mskendrick
Jun 22nd, 2006, 04:14 PM
I created an endpoint by extending org.springframework.ws.endpoint.AbstractMarshallin gPayloadEndpoint with org.springframework.oxm.jaxb.Jaxb1Marshaller as the marshaller/unmarshaller. Within the invokeInternal(Object requestObject) method of the endpoint, I create a response object. When the response is rendered inside the <SOAP-ENV:Body> element, the root element of my response is missing.

Actual

<SOAP-ENV:Body>
<SearchResults xmlns="urn:FindClaims/1.0">
<Claim ICN="1" firstDateOfService="2006-06-22-04:00" lastDateOfService="2006-06-22-04:00" />
</SearchResults>
</SOAP-ENV:Body>


Expected

<SOAP-ENV:Body>
<FindClaimsResponse xmlns="urn:FindClaims/1.0">
<SearchResults>
<Claim ICN="1" firstDateOfService="2006-06-22-04:00" lastDateOfService="2006-06-22-04:00" />
</SearchResults>
</FindClaimsResponse>
</SOAP-ENV:Body>


Any idea what is happening to my root element (FindClaimsResponse) in the response?

res1st
Jun 23rd, 2006, 02:24 AM
I don't know what the problem is, maybe we can help you if you post your xml schema.

I also had some problems with JAXB1.6 and all is working fine with JAXB2.0. The big disadvantage is the annotations (and Java5) thing which i doesn't like very much, but i have no choice.

Cheers,

Ingo

mskendrick
Jun 23rd, 2006, 10:55 AM
I figured out what my problem is. First a little background. In my schema I have a xsd:complexType named "FindClaimsResponse" and an xsd:element named "FindClaimsResponse". When I generated the JAXB code, I used a bindings file to specify the element as "FindClaimsResponseElement", however I failed to use that class in my endpoint. Once I changed my endpoint to return FindClaimsResponseElement it worked!

Here is the actual schema. If you have an suggestions for improvements in my schema, I'd love to hear them:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="urn:FindClaims/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:FindClaims/1.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element name="FindClaims" type="tns:FindClaims"/>
<xsd:element name="FindClaimsResponse" type="tns:FindClaimsResponse"/>
<xsd:complexType name="FindClaims">
<xsd:annotation>
<xsd:documentation>Find Claims Request</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="SearchCriteria" type="tns:SearchCriteria"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="FindClaimsResponse">
<xsd:annotation>
<xsd:documentation>Find Claims Response</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="SearchResults" type="tns:SearchResults"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SearchCriteria">
<xsd:annotation>
<xsd:documentation>PCC Search Criteria</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="providerCode" type="xsd:string" use="required"/>
<xsd:attribute name="reasonCode" type="xsd:string" use="optional"/>
<xsd:attribute name="typeOfBill" type="xsd:string" use="optional"/>
<xsd:attribute name="typeOfService" type="xsd:string" use="optional"/>
<xsd:attribute name="dispositionIndicator" type="xsd:string" use="optional"/>
<xsd:attribute name="fromLastName" type="xsd:string" use="optional"/>
<xsd:attribute name="toLastName" type="xsd:string" use="optional"/>
<xsd:attribute name="patientControlNumber" type="xsd:integer" use="optional"/>
<xsd:attribute name="contractNumber" type="xsd:integer" use="optional"/>
<xsd:attribute name="fromDateOfService" type="xsd:date" use="optional"/>
<xsd:attribute name="toDateOfService" type="xsd:date" use="optional"/>
<xsd:attribute name="claimType" type="xsd:string" use="optional"/>
</xsd:complexType>
<xsd:complexType name="SearchResults">
<xsd:annotation>
<xsd:documentation>PCC Search Results</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Claim" type="tns:Claim" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Claim">
<xsd:annotation>
<xsd:documentation>Claim Summary</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="ICN" type="xsd:string" use="required"/>
<xsd:attribute name="firstDateOfService" type="xsd:date" use="required"/>
<xsd:attribute name="lastDateOfService" type="xsd:date" use="optional"/>
<xsd:attribute name="patientDateOfBirth" type="xsd:date" use="optional"/>
<xsd:attribute name="patientFirstName" type="xsd:string" use="optional"/>
<xsd:attribute name="patientLastName" type="xsd:string" use="optional"/>
<xsd:attribute name="patientMiddleInitial" type="xsd:string" use="optional"/>
<xsd:attribute name="providerName" type="xsd:string" use="optional"/>
<xsd:attribute name="providerNumber" type="xsd:string" use="optional"/>
<xsd:attribute name="status" type="xsd:string" use="optional"/>
<xsd:attribute name="subscriberLiability" type="xsd:double" use="optional"/>
<xsd:attribute name="totalAllowedAmount" type="xsd:double" use="optional"/>
<xsd:attribute name="totalChargeAmount" type="xsd:double" use="optional"/>
<xsd:attribute name="totalPaidAmount" type="xsd:double" use="optional"/>
</xsd:complexType>
</xsd:schema>

Shannon Kendrick