【发布时间】:2019-10-26 23:05:23
【问题描述】:
在尝试使用soap UI 时,即使我在req 对象中发送值,我也会在请求对象中获取空值。原因是什么?请帮忙
下面是我的端点
@Endpoint
public class SummaryEndPoint {
@PayloadRoot(namespace = "http://online.mysite.no", localPart ="getSummary")
public @ResponsePayload JAXBElement<EInvoicesObjects> getSummary(@RequestPayload SummaryObject summaryObject) {
//Here summaryObject.getzDocId() returns null.
return null;
}
}
肥皂请求:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:onl="http://online.mysite.no">
<soapenv:Header/>
<soapenv:Body>
<onl:getSummary soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="onl:SummaryObject">
<ZDocId xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">asdasdsa</ZDocId>
<amountDue xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">sadadsadsa</amountDue>
</in0>
</onl:getSummary>
</soapenv:Body>
</soapenv:Envelope>
请求有效负载对象:
package com.nets.online2adapter.endpoints;
import javax.xml.bind.annotation.*;
import org.xmlsoap.schemas.soap.encoding.String;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SummaryObject", propOrder = {
"zDocId",
"amountDue"
},namespace="http://online.mysite.no")
public class SummaryObject {
@XmlElement(name = "ZDocId", required = true, nillable = true)
protected String zDocId;
@XmlElement(required = true, nillable = true)
protected String amountDue;
/**
* Gets the value of the zDocId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getZDocId() {
return zDocId;
}
/**
* Sets the value of the zDocId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setZDocId(String value) {
this.zDocId = value;
}
/**
* Gets the value of the amountDue property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAmountDue() {
return amountDue;
}
/**
* Sets the value of the amountDue property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAmountDue(String value) {
this.amountDue = value;
}
}
【问题讨论】:
-
你是如何测试这个的?我建议为您的端点设置一个集成测试,因为它们通常可以更深入地了解您的应用程序的内部工作,并在那里寻找任何指针。 This guide 应该可以帮助您。
-
你能解决这个问题吗?我遇到了同样的问题。在我的 EndPoint 类中,具有字符串请求有效负载的方法在从 SOAPUI 调用时可以正常工作。但是在同一个类中,具有自定义类的请求有效负载的方法以空值传入。它被命名为customerStatusRequest。我也在这个页面上发布了它:stackoverflow.com/a/58452826/1456612
标签: soap soapui axis spring-ws