Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SpringBoot将SOAP头和主体一起发送到SOAP服务器_Spring_Spring Boot_Soap_Soap Client - Fatal编程技术网

使用SpringBoot将SOAP头和主体一起发送到SOAP服务器

使用SpringBoot将SOAP头和主体一起发送到SOAP服务器,spring,spring-boot,soap,soap-client,Spring,Spring Boot,Soap,Soap Client,作为一名SOAP新手,我遵循中给出的相同教程。教程可以在中找到 目前,我能够发送带有所需请求的SOAP负载。服务器响应说我没有进行身份验证 因此,我尝试将带有身份验证详细信息的SOAP头与此SOAP负载一起发送。参见下面的示例 首先,我成功地完成了教程。请求随SOAP操作一起发送,并收到响应 已发送请求[SaajSoapMessage{}CheckDeedsOfficeStatus] 回答是我没有正确地验证/发送验证详细信息。因此,我创建了具有所有必要细节的身份验证对象,以便整理并成为SOAP消

作为一名SOAP新手,我遵循中给出的相同教程。教程可以在中找到

目前,我能够发送带有所需请求的SOAP负载。服务器响应说我没有进行身份验证

因此,我尝试将带有身份验证详细信息的SOAP头与此SOAP负载一起发送。参见下面的示例

首先,我成功地完成了教程。请求随SOAP操作一起发送,并收到响应

已发送请求[SaajSoapMessage{}CheckDeedsOfficeStatus]

回答是我没有正确地验证/发送验证详细信息。因此,我创建了具有所有必要细节的身份验证对象,以便整理并成为SOAP消息的一部分

我尝试了以下方法:

ObjectFactory of = new ObjectFactory();
WinDeedCredentials cred = of.createWinDeedCredentials();

cred.setUsername("Test");
cred.setPassword("Test123");
cred.setCompany("COMPANY");
cred.setRequester("SOAP");
CheckDeedsOfficeStatus cdo = of.createCheckDeedsOfficeStatus();
CheckDeedsOfficeStatusResponse dr = (CheckDeedsOfficeStatusResponse)sc.callWebService(cdo,"http://server.windeed.co.za/windeedengine/CheckDeedsOfficeStatus");
目标是实现这一点:

POST /windeedengine3/client.asmx HTTP/1.1
Host: server.windeed.co.za
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://server.windeed.co.za/windeedengine/CheckDeedsOfficeStatus"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <WinDeedCredentials xmlns="http://server.windeed.co.za/windeedengine/">
      <Username>string</Username>
      <Password>string</Password>
      <Company>string</Company>
      <Requester>string</Requester>
    </WinDeedCredentials>
  </soap:Header>
  <soap:Body>
    <CheckDeedsOfficeStatus xmlns="http://server.windeed.co.za/windeedengine/" />
  </soap:Body>
</soap:Envelope>
POST/windeedengine3/client.asmx HTTP/1.1
主机:server.windeed.co.za
内容类型:text/xml;字符集=utf-8
内容长度:长度
SOAPAction:“http://server.windeed.co.za/windeedengine/CheckDeedsOfficeStatus"
一串
一串
一串
一串
目前,由于缺少身份验证详细信息,我被告知身份验证不正确


预期结果是来自服务器的正确响应:联机或脱机。正确的方法是什么?

我甚至忘了重温这个话题。问题已经解决,但我没有立即获得详细信息,需要旅行才能访问这些信息

在进行webservice调用=>sc.callWebService之前,重要的是注入SOAP头细节。我将soapui中的xml头注入到代码中。中提琴!成功了。以前,MarshallSendadReceive方法仅与SoapActionCallback方法一起使用。如果我还记得的话,我修改了它,在进行webservice调用之前使用WebServiceMessageCallback和xml头的显式定义