0

我有一个 jax-ws webservice 类,其操作具有两个 web 参数。我正在尝试向它发送请求,但它抛出了未收到预期 JAXB 元素的异常,我正在使用 SOAP UI 发送请求。

网络服务类

    @MTOM
    @WebService(endpointInterface = "com.carecentrix.service.ClaimService")
    public class ClaimServiceImpl implements ClaimService {

        @Resource
        public WebServiceContext context;

        private static Map<String, Object> dataMap = new HashMap<String, Object>();

        public String saveClaim(CCXClaim claim, CCXAttachment ccxAttachment) {
            String claimId = String.valueOf(dataMap.size()+1);
            if (!dataMap.containsKey(claimId)) {
                claim.getClaim().getHeaderInfo().get(0).getClaims().setClaimId(Long.valueOf(claimId));
                dataMap.put(claimId, claim);
            }
            System.out.println("claim object AppTransID" + dataMap);

            return claimId;
        }
    }

SOAP UI 请求

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.carecentrix.com/" xmlns:cla="http://www.carecentrix.com/claim" xmlns:cla1="http://www.carecentrix.com/claimattachment">
       <soapenv:Header/>
       <soapenv:Body>
          <ser:saveClaim>
             <!--Optional:-->

             <cla:CCXClaim schemaVersion="1.0">
                <cla:Claim>
                   <cla:AppTransID>12233</cla:AppTransID>
                   <cla:ClaimType>I</cla:ClaimType>

                   <cla:CreatedDate>2013-05-07</cla:CreatedDate>
                   <cla:CreatedBy>rrchapp</cla:CreatedBy>
                   <cla:CreatedByProcess>rrchapp</cla:CreatedByProcess>

                   <cla:HeaderInfo>
                      <cla:Claims>

                         <cla:ClaimHeaderId>1234444</cla:ClaimHeaderId>
                         <!--Optional:-->
                         <cla:ClaimSubmitionId>1</cla:ClaimSubmitionId>
                         <cla:CreatedBy>rrchapp</cla:CreatedBy>
                         <cla:CreatedDate>2013-05-27</cla:CreatedDate>
                         <!--Optional:-->
                         <cla:CreatedProcess>biztalk</cla:CreatedProcess>
                         <!--Optional:-->
                         <cla:SubmissionVersion>1</cla:SubmissionVersion>
                         <cla:UpdatedProcess>rrchapp</cla:UpdatedProcess>
                         <cla:UpdatedBy>rrchapp</cla:UpdatedBy>
                         <cla:UpdatedDate>2013-05-27</cla:UpdatedDate>
                         <cla:ClaimId>12344444555</cla:ClaimId>
                      </cla:Claims>

                   </cla:HeaderInfo>
                   <!--Optional:-->
                   <cla:TransactionId>233</cla:TransactionId>
                   <cla:TSCreateDate>2013-05-27</cla:TSCreateDate>
                   <!--Optional:-->
                   <cla:TSPurposeCode>899</cla:TSPurposeCode>
                   <cla:UpdatedDate>2013-05-27</cla:UpdatedDate>
                   <cla:UpdatedBy>rrchapp</cla:UpdatedBy>
                   <cla:UpdatedProcess>rrchapp</cla:UpdatedProcess>

                </cla:Claim>

               <cla:DocIdentifier>
                   <cla:SourceSystem>ABCD</cla:SourceSystem>
                   <cla:SourceApplication>ABCC</cla:SourceApplication>
                   <cla:DocCreateDate>2013-05-27</cla:DocCreateDate> 
                </cla:DocIdentifier>
             </cla:CCXClaim>


             <cla1:CCXAttachment>
                <cla1:ClaimAttachment>
                   <cla1:AttachmentContent>cid:821808624369</cla1:AttachmentContent>
                </cla1:ClaimAttachment>
             </cla1:CCXAttachment>

          </ser:saveClaim>
       </soapenv:Body>
    </soapenv:Envelope>

错误

    <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.carecentrix.com/claim", local:"CCXClaim"). Expected elements are &lt;{}CCXClaim>,&lt;{}CCXAttachment></faultstring>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>

上面是webservice方法,类。要求。我有两个参数,但不知何故服务正在抛出错误异常。
请帮助为什么会发生这种情况,请求是使用正确的命名空间发送的。

4

1 回答 1

0

错误消息说需要一个<CCXClaim>没有命名空间的元素。但是,在您的请求中显然是通过前缀<cla:CCXClaim>与命名空间 URI 关联的。http://www.carecentrix.com/claimcla

由于您没有发布您的WSDLXSD即使有),所以很难弄清楚。尝试删除请求中的claandcla1前缀。

于 2013-05-31T19:22:09.503 回答