2013-04-15 4 views
0
이 클래스는

설정 널 (null) 문자열 : 전무 = 사실은

package com.ni.schemas.provider_framework._1.providers; 

import java.math.BigInteger; 
import javax.xml.bind.annotation.XmlAccessType; 
import javax.xml.bind.annotation.XmlAccessorType; 
import javax.xml.bind.annotation.XmlElement; 
import javax.xml.bind.annotation.XmlType; 


/** 
* 
*     This is the top-level for a Request. 
*     Providers may extend this type if needed, but may not restrict it by blocking the pre-defined elements 
*    
* 
* <p>Clase Java para RequestErrorType complex type. 
* 
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase. 
* 
* <pre> 
* &lt;complexType name="RequestErrorType"> 
* &lt;complexContent> 
*  &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> 
*  &lt;sequence> 
*   &lt;element name="httpResponseCode" type="{http://www.w3.org/2001/XMLSchema}integer"/> 
*   &lt;group ref="{http://www.ni.com/schemas/provider-framework/1/providers}ErrorElementGroup"/> 
*  &lt;/sequence> 
*  &lt;/restriction> 
* &lt;/complexContent> 
* &lt;/complexType> 
* </pre> 
* 
* 
*/ 
@XmlAccessorType(XmlAccessType.FIELD) 
@XmlType(name = "RequestErrorType", propOrder = { 
    "httpResponseCode", 
    "summary", 
    "userMessage", 
    "detail" 
}) 
public class RequestErrorType { 

    @XmlElement(required = true) 
    protected BigInteger httpResponseCode; 
    protected String summary; 
    protected String userMessage; 
    protected String detail; 

    /** 
    * Obtiene el valor de la propiedad httpResponseCode. 
    * 
    * @return 
    *  possible object is 
    *  {@link BigInteger } 
    *  
    */ 
    public BigInteger getHttpResponseCode() { 
     return httpResponseCode; 
    } 

    /** 
    * Define el valor de la propiedad httpResponseCode. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link BigInteger } 
    *  
    */ 
    public void setHttpResponseCode(BigInteger value) { 
     this.httpResponseCode = value; 
    } 

    /** 
    * Obtiene el valor de la propiedad summary. 
    * 
    * @return 
    *  possible object is 
    *  {@link String } 
    *  
    */ 
    public String getSummary() { 
     return summary; 
    } 

    /** 
    * Define el valor de la propiedad summary. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link String } 
    *  
    */ 
    public void setSummary(String value) { 
     this.summary = value; 
    } 

    /** 
    * Obtiene el valor de la propiedad userMessage. 
    * 
    * @return 
    *  possible object is 
    *  {@link String } 
    *  
    */ 
    public String getUserMessage() { 
     return userMessage; 
    } 

    /** 
    * Define el valor de la propiedad userMessage. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link String } 
    *  
    */ 
    public void setUserMessage(String value) { 
     this.userMessage = value; 
    } 

    /** 
    * Obtiene el valor de la propiedad detail. 
    * 
    * @return 
    *  possible object is 
    *  {@link String } 
    *  
    */ 
    public String getDetail() { 
     return detail; 
    } 

    /** 
    * Define el valor de la propiedad detail. 
    * 
    * @param value 
    *  allowed object is 
    *  {@link String } 
    *  
    */ 
    public void setDetail(String value) { 
     this.detail = value; 
    } 

} 

내가 디스플레이 시간, null로 userMessage 변수를 설정하려면, 그냥이

<userMessage /> 

보여줍니다

내가 한 표시해야합니다

<userMessage xsi:nil="true" /> 

어떻게하면됩니까?

+0

여러분이 원하는 모든 요소를 ​​쓸모 없게 만들려면 WSDL/XSD에서 JAXB 객체를 생성하면 생성자에게'XmlElement (nillable = true) '를 추가하도록 알릴 수 있습니다. –

+0

발전기에게 무엇을 말하고 싶습니까? 어떻게해야합니까? – Nacho321

답변

1

@XmlElement(nillable = true) 
protected String userMessage; 

는 WSDL/XSD가 defind로 nillable로 요소가있는 경우

을 정렬 화시 전무로 널을 처리합니다 다음을 사용하여, 다음 코드 생성은 다음

protected JaxbElement<String> userMessage; 

I를 생성합니다 javadoc에서 생성 된 코드가 현재 사용중인 코드가 아니라는 것을 알 수 있습니다. 만약 당신이 다른 webservice에 맞으면 나는 그들의 wsdl에서 올바른 dto 객체를 생성하는 것이 좋습니다. jdk/bin 디렉토리에있는 xjc.exe 및 wsdl.exe에 대한 설명서를 볼 수 있습니다.