我的問題是,當通過SOAP UI(JAX-WS客戶端)從Java生成代碼發送請求時,空SOAP參數包含在SOAP生成的請求中。SOAP請求中不包含JAX-WS空參數
我從第三方WSDL生成soap客戶端,因此不需要對WSDL修改進行任何控制。
來自Java生成客戶端的消息,不包含具有空值的參數。我必須有空元素,它們是從SOAPUI,其具有其值null元素<authId>
& <reserved>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<BillPayment xmlns="http://action.one.worldnet.org">
<userName>test</userName>
<password>testing2</password>
<AccountNumber>10385699</AccountNumber>
<amount>0000000002300</amount>
<tranDate>20130311</tranDate>
<tranTime>064536</tranTime>
<bankMnemonic>TIMEPAY</bankMnemonic>
</BillPayment>
</S:Body>
</S:Envelope>
消息。
<soap:Body>
<soap:Envelope>"
<act:BillPayment>
<act:userName>test</act:userName>
<act:password>testing2</act:password>
<act:AccountNumber>9132388</act:AccountNumber>
<act:authId></act:authId>
<act:amount>0000000010000</act:amount>
<act:tranDate>20130311</act:tranDate>
<act:tranTime>172345</act:tranTime>
<act:bankMnemonic>THIRDParty</act:bankMnemonic>
<act:reserved></act:reserved>
</act:BillPayment>
</soap:Body>
</soap:Envelope>"
以下是我產生BillPayment類
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(名稱= 「」,propOrder = { 「username」 的 「密碼」, 「使用accountNumber」, 「驗證ID」, 「量」 「TRANDATE」, 「tranTime」, 「bankMnemonic」, 「保留」}) @XmlRootElement(名稱= 「BillPayment」) 公共類BillPayment {
@XmlElementRef(name = "userName", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> userName;
@XmlElementRef(name = "password", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> password;
@XmlElementRef(name = "AccountNumber", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> accountNumber;
@XmlElementRef(name = "authId", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> authId;
@XmlElementRef(name = "amount", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> amount;
@XmlElementRef(name = "tranDate", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> tranDate;
@XmlElementRef(name = "tranTime", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> tranTime;
@XmlElementRef(name = "bankMnemonic", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> bankMnemonic;
@XmlElementRef(name = "reserved", namespace = "http://action.wirelessnet.org", type = JAXBElement.class)
protected JAXBElement<String> reserved;
/**
* Gets the value of the userName property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getUserName() {
return userName;
}
/**
* Sets the value of the userName property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setUserName(JAXBElement<String> value) {
this.userName = ((JAXBElement<String>) value);
}
/**
* Gets the value of the password property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getPassword() {
return password;
}
/**
* Sets the value of the password property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setPassword(JAXBElement<String> value) {
this.password = ((JAXBElement<String>) value);
}
/**
* Gets the value of the accountNumber property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getAccountNumber() {
return accountNumber;
}
/**
* Sets the value of the accountNumber property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setAccountNumber(JAXBElement<String> value) {
this.accountNumber = ((JAXBElement<String>) value);
}
/**
* Gets the value of the authId property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getAuthId() {
return authId;
}
/**
* Sets the value of the authId property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setAuthId(JAXBElement<String> value) {
this.authId = ((JAXBElement<String>) value);
}
/**
* Gets the value of the amount property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getAmount() {
return amount;
}
/**
* Sets the value of the amount property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setAmount(JAXBElement<String> value) {
this.amount = ((JAXBElement<String>) value);
}
/**
* Gets the value of the tranDate property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getTranDate() {
return tranDate;
}
/**
* Sets the value of the tranDate property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setTranDate(JAXBElement<String> value) {
this.tranDate = ((JAXBElement<String>) value);
}
/**
* Gets the value of the tranTime property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getTranTime() {
return tranTime;
}
/**
* Sets the value of the tranTime property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setTranTime(JAXBElement<String> value) {
this.tranTime = ((JAXBElement<String>) value);
}
/**
* Gets the value of the bankMnemonic property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getBankMnemonic() {
return bankMnemonic;
}
/**
* Sets the value of the bankMnemonic property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setBankMnemonic(JAXBElement<String> value) {
this.bankMnemonic = ((JAXBElement<String>) value);
}
/**
* Gets the value of the reserved property.
*
* @return possible object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public JAXBElement<String> getReserved() {
return reserved;
}
/**
* Sets the value of the reserved property.
*
* @param value
* allowed object is {@link JAXBElement }{@code <}{@link String }
* {@code >}
*
*/
public void setReserved(JAXBElement<String> value) {
this.reserved = ((JAXBElement<String>) value);
}
}
尋求專家意見。提前致謝。
添加上述註釋後,我發現了以下異常 – 2013-03-11 19:26:42
產生的原因:com.sun.xml.bind.v2.runtime.IllegalAnnotationsException:IllegalAnnotationExceptions的2個計數 com.integration.wireless.BillPayment#AUTHID擁有互斥annotations @ javax.xml.bind.annotation.XmlElement和[at] javax.xml.bind.annotation.XmlElementRef \t此問題與以下位置有關: \t \t at [at] javax.xml.bind.annotation。 XmlElement(nillable = true,name = ## default,required = true,defaultValue = – 2013-03-11 19:29:35
正如我所說的,註解需要包含JAXB 2.2的metro 2.0。您使用了什麼Web服務運行時?它支持JAXB 2.2嗎? – Lan 2013-03-11 21:23:07