标签: soap

在 servlet 中模拟/生成 SocketTimeoutException


我正在使用一个网络项目:
- Java
- Jetty
- Fitnesse 工具
- 等等。

我很难模拟/生成 SocketTimeoutException,更多信息如下:


用例简化:
我编写了一个 API 来调用主机(WebServer)。在源代码中,如果我收到RemoteException并且是SocketTimeoutException,我需要在其他主机上重试。
一切都很好!

我们如何测试:
是一个 TDD 项目,所以我们有一堆 UT。对于“真实”测试,我们使用上面提到的工具。(健身)

问题”:
我必须模拟服务器中可能发生的许多问题。为此,我编写了一个简单的 servlet 来模拟我的 WebServer。
但是对于这个用例,我需要在我的模拟器中模拟一个 SocketTimeoutException。我想在模拟器中休眠,但我认为这可能会导致客户端请求超时。


如果有人有任何想法或好的提示将非常高兴知道!

提前致谢

java tdd agile soap

0
推荐指数
1
解决办法
5299
查看次数

PHP 解析 SOAP 响应

我正在尝试解析以下 SOAP 响应,需要一些指导:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header/>

    <env:Body>
        <ns2:LookupResponse xmlns:ns2="http://path-to/schemas">
        <ns2:Name>My Name</ns2:Name>
        <ns2:Address1>test</ns2:Address1>
        <ns2:Address2>test</ns2:Address2>
        ...
        </ns2:LookupResponse>
    </env:Body>
</env:Envelope>
Run Code Online (Sandbox Code Playgroud)

我通过 cURL 检索响应:

$url        = 'https://path-to-service';
$success    = FALSE;
$ch         = curl_init();

curl_setopt($ch, CURLOPT_URL,           $url);                                                                
curl_setopt($ch, CURLOPT_RETURNTRANSFER,    true);  
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,    false);
curl_setopt($ch, CURLOPT_SSLVERSION,        3);
curl_setopt($ch, CURLOPT_POST,          true);
curl_setopt($ch, CURLOPT_POSTFIELDS,        $request);
curl_setopt($ch, CURLOPT_HTTPHEADER,        array(
                                                    'Content-Type: text/xml; charset=utf-8', 
                                                    'Content-Length: ' . strlen($request) 
                                                ));

$ch_result  = curl_exec($ch);
$ch_error   = curl_error($ch);

curl_close($ch);
Run Code Online (Sandbox Code Playgroud)

我是这一切的新手,所以请原谅明显的错误,但我随后尝试将响应作为对象进行迭代,正如 simpleXML 扩展所解析的那样,在此处引用 SO 答案并使用simplexml_debug插件来回显对象内容。

if(empty($ch_error))
{
    $xml    = simplexml_load_string($ch_result, NULL, …
Run Code Online (Sandbox Code Playgroud)

php xml soap

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

如何以编程方式设置 Axis 客户端的 SSL 上下文?

在一个非常古老的项目中,我们使用使用 Axis 1.4 开发的客户端来调用 SOAP Web 服务。此 Web 服务使用相互身份验证机制,因此我们在密钥库中安装了私有证书,在信任库中安装了公钥。

SOAP 客户端在 BPM 流程的任务中使用。我们不能也不想使用 JVM 全局信任库和密钥库。那么我们就无法以编程方式配置 JVM 全局信任库和密钥库:

// Keystore
System.setProperty("javax.net.ssl.keyStore", fileKeystore);
System.setProperty("javax.net.ssl.keyStorePassword", pwdKeystore);
System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
// Truststore
System.setProperty("javax.net.ssl.trustStore", fileTruststore);
System.setProperty("javax.net.ssl.trustStorePassword", pwdTruststore);
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
Run Code Online (Sandbox Code Playgroud)

这样的方法将迫使我们在 JVM 属性上同步进程,我们不想这样做。此外,机器上还有其他java进程在运行。

我的问题是:Axis 1.4 是否提供了一些 API 来指定用于特定 Web 服务调用的密钥库和信任库?

java ssl axis soap

0
推荐指数
1
解决办法
8699
查看次数

更改NuSOAP的传出IP

我用专用IP地址托管了cPanel,

但是,传出IP仍然是主机提供者的共享IP(应该是)。

我需要使用带有该专用IP的nusoap进行一些传出呼叫:

$nusoap = new nusoap_client("https://URL/");
$call   = $nusoap->call(...);
Run Code Online (Sandbox Code Playgroud)

如何在此处使用NuSOAP更改传出IP?

我知道如何使用cURL(curl_setopt($ch, CURLOPT_INTERFACE, $website_ip);),但是如何使用此方法实现相同的目的。已经在服务器端和php端工作了几个小时,但仍然无法弄清楚。

php ip curl soap nusoap

0
推荐指数
1
解决办法
411
查看次数

使用自定义 X509KeyManager Java 时无法确定 SSL 握手的匹配密码套件

我正在使用 Java7 和 JAX-WS 2.2。

对于 SOAP Web 服务,我需要创建一个自定义X509KeyManager,以便为 JKS 密钥库中的每个连接客户端找到正确的证书。

但是,我已经在努力让我的自定义密钥管理器运行。到目前为止,我使用的是默认的(从初始化的 中检索KeyManagerFactory)并且它基本上可以工作 - 但当然它没有选择正确的证书。所以第一个想法是创建一个自定义X509KeyManager来保存原始密钥管理器,只写出一些日志消息,但通常使用默认行为。

出于某种原因,这根本不起作用。无法建立 SSL 握手。在ClientHello 之后,日志显示以下错误:

Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
Thread-3, READ: TLSv1 Handshake, length = 149
*** ClientHello, TLSv1
RandomCookie:  GMT: 1476877930 bytes = { 207, 226, 8, 128, 40, 207, 47, 180, 146, 211, 157, 64, 239, 13, 201, 92, 158, 111, 108, 44, …
Run Code Online (Sandbox Code Playgroud)

java ssl soap jax-ws

0
推荐指数
1
解决办法
5034
查看次数

Rabbit MQ是否提供SOAP API?

RabbitMQ是否提供SOAP Api?

我知道它提供了Restful API

我尝试搜索它,但没有任何成果。

提前致谢

soap rabbitmq

0
推荐指数
1
解决办法
613
查看次数

无法指定"Any"类型的值来键入"String?"

我收到Cannot assign value of type 'Any' to type 'String?' 的时候我传递posts的价值cell.textLabel?.text,我已经收到了来自SOAP服务响应和我添加到职位posts.add(elements).而且我想把它传递Posts给我的请求secondViewController帮助,谢谢你

import UIKit

class ViewController: UIViewController ,XMLParserDelegate,UITextFieldDelegate, NSURLConnectionDelegate, UITableViewDelegate , UITableViewDataSource {

    @IBOutlet var firstName: UITextField!

    @IBOutlet var lastName: UITextField!

    @IBOutlet var tableView: UITableView!

    var parser = XMLParser()

    var posts = NSMutableArray()

    var elements = NSMutableDictionary()
    var element = NSString()
    var title1 = NSMutableString()
    var date = NSMutableString()

     var xmlData = NSMutableData()

    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.dataSource = self …
Run Code Online (Sandbox Code Playgroud)

soap ios swift

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

使用C#进行工作日Web服务身份验证

我正在使用Workday WebService v30.0

https://community.workday.com/sites/default/files/file-hosting/productionapi/Human_Resources/v30.0/Human_Resources.html

我正在尝试复制示例https://community.workday.com/node/191970 ,但我不断收到“无效的用户名和密码”。我知道用户名和密码是正确的,因为它可以在SOAP UI中使用。

这是我的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;

using GetWorkerSample.HumanResources;

namespace GetWorkerSample
{
    class Program
    {
        static void Main(string[] args)
        {
            //Instantiate an instance of WCF generated proxy and set the Endpoint
            Human_ResourcesPortClient hr = new Human_ResourcesPortClient();
            hr.Endpoint.Address = new EndpointAddress(args[0]);


            //Configure Port
            hr.ClientCredentials.UserName.UserName = "user@tenant";
            hr.ClientCredentials.UserName.Password = "password";

            //Instantiate Header for the request
            //Confiure Header
            Workday_Common_HeaderType header = new Workday_Common_HeaderType();
            header.Include_Reference_Descriptors_In_Response = false;
            header.Include_Reference_Descriptors_In_ResponseSpecified = false; …
Run Code Online (Sandbox Code Playgroud)

c# soap web-services workday-api

0
推荐指数
1
解决办法
2337
查看次数

XML Key值paire C#

这是我的XDocument

   <grantitem adnidtype="306" xmlns="http://tempuri.org/">
      <attribute key="AccountNumber" value="1111" />
      <attribute key="DateofMeterRead" value="20161226" />
      <attribute key="Arrears" value="11.11" />
      <attribute key="MeterRead" value="11111" />
    </grantitem>
Run Code Online (Sandbox Code Playgroud)

我试图通过使用来阅读这个

var q = from b in doc.Descendants("grantitem")
        select new
               {
                key= (string)b.Element("attribute key") ?? tring.Empty,
                value= (string)b.Element("value") ?? String.Empty
               };
Run Code Online (Sandbox Code Playgroud)

但是ist返回一个空值.有谁能看到一些失踪?

c# xml soap

0
推荐指数
1
解决办法
53
查看次数

NodeJS NPM soap-如何链接不带回调的异步方法(即使用异步或Promise)?

我已经使用nodejs / javascript成功调用了一系列肥皂网络服务方法,但是使用了回调...现在看起来像这样:

soap.createClient(wsdlUrl, function (err, soapClient) {
    console.log("soap.createClient();");
    if (err) {
        console.log("error", err);
    }
    soapClient.method1(soaprequest1, function (err, result, raw, headers) {
        if (err) {
            console.log("Security_Authenticate error", err);
        }
        soapClient.method2(soaprequest2, function (err, result, raw, headers) {
                if (err) {
                    console.log("Air_MultiAvailability error", err);
                }
                //etc... 
        });
    });

});
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用Promise或async来达到更清洁的效果,类似于(基于https://www.npmjs.com/package/soap此处文档中的示例):

var soap = require('soap');

soap.createClientAsync(wsdlURL)
    .then((client) => {
        return client.method1(soaprequest1);
    })
    .then((response) => {
        return client.method2(soaprequest2);
    });//... etc
Run Code Online (Sandbox Code Playgroud)

我的问题是,在后一个示例中,肥皂客户端在第一次调用后将不再可访问,并且通常会返回“未定义”错误...

是否有一种“干净”的方式通过这种链接携带物体以在随后的调用中使用/访问?

javascript soap node.js

0
推荐指数
1
解决办法
66
查看次数

标签 统计

soap ×10

java ×3

c# ×2

php ×2

ssl ×2

xml ×2

agile ×1

axis ×1

curl ×1

ios ×1

ip ×1

javascript ×1

jax-ws ×1

node.js ×1

nusoap ×1

rabbitmq ×1

swift ×1

tdd ×1

web-services ×1

workday-api ×1