gpt4 book ai didi

Soap 请求对象为 null - spring ws

转载 作者:行者123 更新时间:2023-12-05 06:25:58 26 4
gpt4 key购买 nike

从 soap UI 尝试时,我在请求对象中得到空值,即使我在请求对象中发送值也是如此。会是什么原因呢?请帮忙

下面是我的端点

     @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;

}
}

SOAP 请求:

<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;
}

}

最佳答案

我遇到了同样的问题。在深入分析我的代码后,我发现这是因为命名空间。 (参见 https://www.baeldung.com/spring-boot-soap-web-service 中的示例)。在您的示例中,参数 <ZDocID> and <amountDue>应该包含在它们父级的命名空间中,例如:<onl:ZDocId> and <onl:amountDue> .

关于Soap 请求对象为 null - spring ws,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56562101/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com