标签: soapheader

SOAP标头与HTTP标头

我正在使用Web服务开发一个程序,为此我需要将一些数据包装为消息的标题.

我想问一下,将这些数据作为SOAP标头或HTTP标头放置是否相同?

soap web-services soapheader http-headers

29
推荐指数
1
解决办法
3万
查看次数

将SOAP隐式标头添加到WSDL

我的问题与此类似.当WSDL没有定义它时,如何传递肥皂头?但是不同.

对于我使用的Web服务,所有方法都需要在SOAP标头内以明文形式发送的身份验证.但是,我的WSDL不包含任何soap标头信息.我有一个自定义平台工具,我必须使用它来从WSDL生成代码.由于标题信息不可用,我无法直接使用生成的类 - 我不想手动修改代码以适应标题.

我尝试在WSDL中指定SOAP标头但是我无法获得正确的名称空间.WSDL在这里https://stage.totalcheck.sensis.com.au/service/webservice?wsdl,SOAP标头如下:

    <soapenv:Header>
        <wsse:Security>
            <wsse:UsernameToken>
                <wsse:Username>username</wsse:Username>
                <wsse:Password>password</wsse:Password>
            </wsse:UsernameToken>
        </wsse:Security>
   </soapenv:Header>
Run Code Online (Sandbox Code Playgroud)

有人能帮我吗?谢谢!

soap wsdl soapheader

16
推荐指数
1
解决办法
5万
查看次数

如何将SOAP头传递给未在WSDL文件中定义的python SUDS

我的网络上有一个摄像头,我试图用肥皂水连接,但泡沫不会发送所需的所有信息.我需要在WSDL文件中放置未定义的额外soap标头,以便摄像头可以理解该消息.所有头文件都包含在SOAP信封中,然后suds命令应该在邮件正文中.

我已经检查了suds 网站 ,它说要像这样传入标题:(这会将元素作为标题传递,但我有一个信封,所以我不知道如何输入这个)

from suds.sax.element import Element
client = client(url)
ssnns = ('ssn', 'http://namespaces/sessionid')
ssn = Element('SessionID', ns=ssnns).setText('123')
client.set_options(soapheaders=ssn) 
result = client.service.addPerson(person)
Run Code Online (Sandbox Code Playgroud)

现在,我不确定如何实现这一点.比方说,我有以下标题:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP
ENC="http://www.w3.org/2003/05/soap-encoding"
<wsa:MessageID SOAP-ENV:mustUnderstand="true">urn:uuid:43268c01-f09c6</wsa:MessageID>
 <SOAP-ENV:Header>
Run Code Online (Sandbox Code Playgroud)

使用这个或类似的例子有谁知道如何将有效的SOAP消息传递给目标服务?

谢谢

python xml wsdl suds soapheader

14
推荐指数
1
解决办法
2万
查看次数

如何在java中添加soap标头

我有来自oracle的NO-.net webservice要访问我需要添加soap标头.如何在java中添加soap标头?

Authenticator.setDefault(new ProxyAuthenticator("username", "password"));
                System.getProperties().put("proxySet", "true");
                System.setProperty("http.proxyHost", "IP");
                System.setProperty("http.proxyPort", "port");




                proxy = new RegPresMed_Service(new URL("webservice")).getRegPresMed();
                ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "realwebservice");
                ((BindingProvider) proxy).getRequestContext().put("com.sun.xml.ws.request.timeout", new Integer(60000));
                ((BindingProvider) proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "webserviceUsername");
                ((BindingProvider) proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "webservicePassword");
Run Code Online (Sandbox Code Playgroud)

这有必要吗?

 ((BindingProvider) proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "webserviceUsername");
                    ((BindingProvider) proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "webservicePassword");
Run Code Online (Sandbox Code Playgroud)

我的肥皂标题是这样的:

<wsse:Security soapenv:mustUnderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken wsu:Id="UsernameToken-6"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:Username>username</wsse:Username>
        <wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
        <wsse:Nonce
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">randomnaumber==</wsse:Nonce>
        <wsu:Created>dateCreated</wsu:Created>
    </wsse:UsernameToken>
</wsse:Security>
Run Code Online (Sandbox Code Playgroud)

java ws-security web-services jax-ws soapheader

14
推荐指数
2
解决办法
10万
查看次数

SoapHeader子节点中的PHP命名空间

PHP SoapClient标头.我在子节点中获取命名空间时遇到问题.这是我正在使用的代码:

$security = new stdClass;
$security->UsernameToken->Password = 'MyPassword';
$security->UsernameToken->Username = 'MyUsername';
$header[] = new SOAPHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $security);
$client->__setSoapHeaders($header);
Run Code Online (Sandbox Code Playgroud)

这是它生成的XML:

<ns2:Security>
  <UsernameToken>
    <Password>MyPassword</Password>
    <Username>MyUsername</Username>
  </UsernameToken>
</ns2:Security>
Run Code Online (Sandbox Code Playgroud)

这是我希望它生成的XML:

<ns2:Security>
  <ns2:UsernameToken>
    <ns2:Password>MyPassword</ns2:Password>
    <ns2:Username>MyUsername</ns2:Username>
  </ns2:UsernameToken>
</ns2:Security>
Run Code Online (Sandbox Code Playgroud)

我需要将名称空间引用添加到UsernameToken,Password和Username节点中.任何帮助将非常感激.

谢谢.

php xml namespaces soapheader

14
推荐指数
2
解决办法
8104
查看次数

如何将SOAP标头添加到Spring Jax-WS客户端?

如何将SOAP标头添加到Spring Jax-WS客户端?

具体来说,我有一个Jaxb对象,我想添加到标题,但xml示例将不胜感激.

我正在使用这里描述的Spring的JaxWsPortProxyFactoryBean .此外,我正在生成我的客户端,如此处所述,它减少了我需要添加的标头.

谢谢.

java spring jax-ws soapheader

13
推荐指数
3
解决办法
2万
查看次数

在C#中为Web服务调用添加自定义SOAPHeader

我想在调用Web服务之前在c#中添加自定义soap头信息.我正在使用SOAP Header类来完成这项工作.我可以部分地这样做但不完全按我需要的方式完成.这是我需要肥皂头看起来像

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Header>
      <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <UsernameToken>
         <Username>USERID</Username>
         <Password>PASSWORD</Password>
        </UsernameToken>    
      </Security>
   </soap:Header>
   <soap:Body>
   ...
Run Code Online (Sandbox Code Playgroud)

我可以添加soap header如下

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Header>
      <UsernameToken xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <Username>UserID</Username>
         <Password>Test</Password>
      </UsernameToken>
   </soap:Header>
   <soap:Body>
Run Code Online (Sandbox Code Playgroud)

我无法做的是添加包含"UsernameToken"的"Security"元素,如第一个示例中所示.任何帮助,将不胜感激.

c# soapheader

10
推荐指数
1
解决办法
3万
查看次数

如何使用Delphi XE发送WCF的ClientCredentials

我已经开发了一个UserNamePasswordValidator带有basicHttpBinding使用HTTPS 的自定义的WCF服务.它适用于.Net客户端,使用ClientCredentials发送用于身份验证的用户名和密码.

但是,我需要从Delphi XE客户端调用它.如何使用Delphi发送等效的.Net ClientCredentials?那可能吗?如果是的话,怎么样?如果不是,还有其他选择吗?

TKS

编辑

下面是.Net中的客户端代码:

EndpointAddress oTransac = new EndpointAddress(GetAddress());
using (WebServiceClient oClient = new WebServiceClient ("httpbasic", oTransac))
{
  oClient.ClientCredentials.UserName.UserName = "username";
  oClient.ClientCredentials.UserName.Password = "password";
  oClient.DoStuff();
}
Run Code Online (Sandbox Code Playgroud)

编辑

我一直在做一些研究,并且我已经能够使用SOAP Hearders在Delphi和旧的asmx Web服务之间进行身份验证.我在下面找到了这篇文章.我是否能够[WebMethod] [System.Web.Services.Protocols.SoapHeader("SoapHeader")]使用文章的技术实现旧的相同行为?

http://weblogs.asp.net/paolopia/archive/2008/02/25/handling-custom-soap-headers-via-wcf-behaviors.aspx

编辑BOUNTY

获得标记为赏金的正确答案,我希望能够UserNamePasswordValidator在服务器端使用WCF服务从Delphi调用Web服务.

delphi authentication wcf soapheader

8
推荐指数
1
解决办法
2881
查看次数

WebService标头身份验证

现在,我得到了我的webservice身份验证,但我已经在WebMethod中调用了一个方法,如下所示:

[WebMethod]
[SoapHeader("LoginSoapHeader")]
public int findNumberByCPF(string cpf)
        {
            try
            {
                LoginAuthentication();
                var retRamal = DadosSmp_Manager.RetornaRamalPorCPF(cpf);
                var searchContent= String.Format("CPF[{0}]", cpf);
                DadosSmp_Manager.insertCallHistory(retRamal, searchContent);

                return retRamal.Ramal;
            }
            catch (Exception ex)
            {
                Log.InsertQueueLog(Log.LogType.Error, ex);
                throw getException(ex.TargetSite.Name, cpf);
            }
        }
Run Code Online (Sandbox Code Playgroud)

我现在想要在不调用"LoginAuthentication()"方法的情况下对此WebMethod进行身份验证,只使用SOAP Header - SoapHeader("LoginSoapHeader") - 位于代码内部.

那么,我的问题是如何只使用标题来验证我的WebMethod?

提前致谢.

.net c# authentication web-services soapheader

7
推荐指数
1
解决办法
3万
查看次数

Soap Header(序言中的意外 EOF)

我必须将 Soap 标头添加到 Web 服务响应中。

我尝试通过几种方式来做,首先是:

public SendFileToAlfaOutParms sendFileToAlfa(SendFileToAlfaInParms inParms)
            throws MsgWSException {
        logger.trace(LogMarkers.IN, "sendFileToAlfa(\ninParms={})", inParms);

        List<Header> headers = (List<Header>) wsContext.getMessageContext().get(Header.HEADER_LIST);
        headers.add(new Header(new QName("http://WSBigFilesWEBService.WEB.ws.bf.sbrf.ru", "SendFileToAlfaAntiVirusStatus"), "TEST"));
        wsContext.getMessageContext().put(Header.HEADER_LIST, headers);

        try {
            InputStream fileContent = fileService.download(inParms.getTransferJobGUID(), inParms.getChunkIdx());
            SendFileToAlfaOutParms outParms = new SendFileToAlfaOutParms();
            outParms.setFileContent(new DataHandler(new InputStreamDataSource(fileContent)));
            logger.trace(LogMarkers.OUT, "sendFileToAlfa\n{}", outParms);
            return outParms;
        } catch (Exception e) {
            logger.error("Exception in sendFileToAlfa", e);
            throw new MsgWSException(e.getMessage(), ExceptionHandlingHelper.convertToExceptionInfo(e));
        }
    }
Run Code Online (Sandbox Code Playgroud)

第二个是通过 cxf OutInteceptor:

public void handleMessage(SoapMessage message) throws Fault {
    List<Header> list = message.getHeaders();
    QName q = …
Run Code Online (Sandbox Code Playgroud)

java soap web-services soapheader

6
推荐指数
1
解决办法
4万
查看次数