Unmarshalling Error: unexpected element (uri:url, local:“objectname”). Expected elements are <{}objectname>

后端 未结 5 1436
梦谈多话
梦谈多话 2021-02-14 19:33

I\'m using jaxb2-marshaller to generate classes to communicate with a webservice. Java-classes are generated with use of some wsdl files.

Everything is okay now, but whe

5条回答
  •  不知归路
    2021-02-14 19:43

    This trace is generated because of the names of de request and response message are not de same in the WSDL and de java class:

    Reponse Message:

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "acceptMessageResponse", propOrder = {
        "acceptMessageReturn"
    })
    public class AcceptMessageResponse {
    
        @XmlElement(required = true)
        protected String acceptMessageReturn;
    
        public String getAcceptMessageReturn() {
            return acceptMessageReturn;
        }
        public void setAcceptMessageReturn(String value) {
            this.acceptMessageReturn = value;
        }
    }
    

    Accept Message:

    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "acceptMessage", propOrder = {
        "in0"
    })
    public class AcceptMessage {
    
        @XmlElement(required = true)
        protected String in0;
    
        public String getIn0() {
            return in0;
        }
        public void setIn0(String value) {
            this.in0 = value;
        }
    }
    

    In this example the WSDL must define: 1.

    
    
        
            
                
                    
                        
                            
                        
                    
                
                
                
                    
                
            
        
        
            
            
        
        
            
            
        
        
            
                
                
                
                
            
        
        
            
            
                
                
                    
                
                
                    
                
            
        
        
            
                
            
        
    
    

提交回复
热议问题