Java - 客户端从服务器收到SOAP Fault:服务器无法处理请求。 --->对象引用未设置为对象的实例

时间:2018-02-21 16:03:23

标签: java web-services soap

我正在尝试从本地代码调用SOAP Web服务并成功查看响应。相同的代码部署到QA环境并收到以下错误:

com.sun.xml.internal.ws.fault.ServerSOAPFaultException:客户端从服务器收到SOAP Fault:服务器无法处理请求。 --->你调用的对象是空的。请参阅服务器日志以查找有关失败的确切原因的更多详细信息。         at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)         at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)         at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)         at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)         at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)         at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)         at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)         在com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)

1 个答案:

答案 0 :(得分:0)

看起来您的函数参数未被声明为WebParams。你必须将这些作为WebParams来宣传:

public String yourFunction(@WebParam(name = "YourObject") YourObject object){

    // Do some stuff

     return "done";
}

您的课程也必须被定义为WebParam。

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "YourObject", propOrder = { "thingOne", "thingTwo", "thingThree"})
@XmlRootElement
public class AutoQuoteRequest {

     @XmlElement
     private String thingOne;

     @XmlElement
     private String thingTwo;
}