我有这种情况....客户端发起的一个服务器之间的SOAP 1.1通信,比方说,成千上万的客户端.客户端是外部的,通过我们的防火墙进入,通过证书,https等进行身份验证.它们可以在任何地方,通常有自己的防火墙,NAT路由器等......它们真的是外部的,而不仅仅是远程公司办公室.他们可能在企业/校园网络,DSL /电缆,甚至拨号.
客户端使用Delphi(2005年+ 2007年的SOAP修复),服务器是C#,但从架构/设计的角度来看,这无关紧要.
目前,客户端将新数据推送到服务器,并在15分钟的轮询循环中从服务器提取新数据.服务器当前不推送数据 - 客户端点击"messagecount"方法,以查看是否有新数据要提取.如果为0,则再睡15分钟并再次检查.
我们试图将其降低到7秒.
如果这是一个内部应用程序,只有一个或几个客户端,我们会写一个无声的"监听器"肥皂服务,并将数据推送到它.但由于它们是外部的,所以坐在自己的防火墙后面,有时甚至是NAT路由器后面的专用网络,这是不切实际的.
所以我们在更快的循环中进行轮询.每10秒检查一次消息数量的10K客户端将是1000 /秒的消息,这些消息大多只会浪费带宽,服务器,防火墙和身份验证器资源.
所以我试图设计一些比自我造成的DoS攻击更好的东西.
我认为让服务器向客户端发送soap消息(推送)是不切实际的,因为这需要在客户端配置太多配置.但我认为还有其他我不了解的选择.如:
1)客户端是否有办法通过Soap 1.1发出GetMessageCount()请求,并获得响应,然后可能"保持在线"大约5-10分钟以获得额外响应以防新数据到达?即服务器显示"0",然后一分钟后响应一些SQL触发器(服务器是Sql Server上的C#,顺便说一句),知道该客户端仍然"在线"并发送更新的消息计数为"5" "?
2)是否有一些其他协议可以用来"ping"客户端,使用从他们上一次GetMessageCount()请求收集的信息?
3)我甚至都不知道.我想我正在寻找一些魔术协议,其中客户端可以发送一个GetMessageCount()请求,其中包括"哦顺便说一句,如果答案在下一个小时内发生变化,请在此地址ping我... ".
此外,我假设任何这些"保持线路开放"方案都会严重影响服务器规模,因为它需要同时保持数千个连接打开.我认为这也可能会影响防火墙.
那里有什么东西吗?还是我几乎坚持投票?
TIA,
克里斯
更新2010年4月30日:
已经证明拥有7秒通知既不容易也不便宜,特别是在没有超出HTTPS/SOAP /防火墙的企业标准的情况下,我们可能会推出一个两阶段的解决方案.Phase1将让客户端轮询"按需",GetMessageCount通过SOAP执行,这里没什么特别的.将有一个"刷新"按钮来提取新数据(这在这里是合理的,因为用户通常有理由怀疑新数据已准备就绪,即他们只是改变了在线系统中的结构颜色,因此他们知道点击在查看桌面上的运输清单之前刷新,现在他们看到描述中的颜色.)(这不是一个服装/时尚应用程序,但你明白了).使用此处讨论的技术,使用两个aps始终保持同步的概念,从主机推送的实时更新仍然在桌面上.但我希望它能够推出另一个版本,因为我们可以提供85%的功能,而无需这样做.但是,我希望我们能够做一个概念证明,并证明它可以工作.我会回来发布未来的更新.感谢大家对此的帮助.
我正在尝试学习如何使用PHP和SOAP在客户端和服务器之间传输文件(.zip文件).目前我的设置看起来像这样:
require('libraries/nusoap/nusoap.php');
$server = new nusoap_server;
$server->configureWSDL('server', 'urn:server');
$server->wsdl->schemaTargetNamespace = 'urn:server';
$server->register('sendFile',
array('value' => 'xsd:string'),
array('return' => 'xsd:string'),
'urn:server',
'urn:server#sendFile');
Run Code Online (Sandbox Code Playgroud)
但我不确定如果不是字符串,返回类型应该是什么?我正在考虑使用base64_encode.
我是Web服务的新手,我一直试图在Internet上找到一个简单的Java SOAP客户端程序.
我想做的就是发送一条SOAP消息并收到一些响应.
有一个网站提供免费的网络服务.
http://www.webservicex.net/ws/WSDetails.aspx?WSID=17&CATID=7
您输入国家/地区名称,它会为您提供国家/地区的ISD代码.就这么简单.
我想将国家名称发送到Web服务,并仅使用Java而不使用任何外部jar来获取其ISD代码.
使用SoapClent调用Web服务时,以下哪项更容易发现错误?
try {
$response = $client->SomeSoapRequest();
}
catch(SoapFault $e){
}
Run Code Online (Sandbox Code Playgroud)
要么:
try {
$response = $client->SomeSoapRequest();
}
catch(SoapFault $e){
}
catch(Exception $e){
}
Run Code Online (Sandbox Code Playgroud)
另外,我想捕获套接字超时; 这是一个SoapFault还是一个Exception?
谢谢!
我正在编写一个基于PHP的SOAP客户端应用程序,该应用程序使用PHP5本机的SOAP库.我需要发送一个HTTP cookie和一个额外的HTTP头作为请求的一部分.cookie部分没问题:
码:
$client = new SoapClient($webServiceURI, array("exceptions" => 0, "trace" => 1, "encoding" => $phpInternalEncoding));
$client->__setCookie($kkey, $vvalue);
Run Code Online (Sandbox Code Playgroud)
我的问题是HTTP标头.我希望有一个名为的函数
__setHeader
要么
__setHttpHeader
在SOAP库中.但没有这样的运气.
还有其他人处理过吗?有解决方法吗?不同的SOAP库是否更容易使用?谢谢.
(我在这里找到了这个未提出的问题http://www.phpfreaks.com/forums/index.php?topic=125387.0,我复制了它b/c我也有同样的问题)
在PHP中,如果您尝试实例化一个新的SoapClient,并且无法访问WSDL(服务器关闭或其他),则会抛出PHP致命错误:
致命错误:SOAP-ERROR:解析WSDL:无法从" http://example.com/servlet/app/SomeService?wsdl "加载:无法加载外部实体" http://example.com/servlet/app/SomeService?wsdl "
据我所知,PHP中的致命错误无法恢复.
有什么方法可以退缩吗?这种致命错误能否以某种方式避免?
编辑:我应该说我在PHP 5.2上运行,如果它有任何区别.
我需要在我的SOAP请求中使用此节点(使用1.1):
<CredentialsHeader xmlns="http://www.url.com/Services/P24ListingService11"
<EMail>ricky@email.net</EMail>
<Password>password</Password>
</CredentialsHeader>
Run Code Online (Sandbox Code Playgroud)
所以我有以下PHP:
$client = new SoapClient("https://exdev.www.example.com/Services/example.asmx?WSDL",
array(
"trace" => 1,
"exceptions" => 0,
"cache_wsdl" => 0,
'soap_version' => SOAP_1_1
)
);
$CredentialObject = new SoapVar(array('EMail' => 'ricky@email.net', 'Password' => 'password'), SOAP_ENC_OBJECT);
Run Code Online (Sandbox Code Playgroud)
哪个产生:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.com/Services/Example">
<SOAP-ENV:Header>
<ns1:CredentialsHeader>
<EMail>ricky@email.net</EMail>
<Password>password</Password>
</ns1:CredentialsHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:EchoAuthenticated/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Run Code Online (Sandbox Code Playgroud)
我需要做的就是阻止它使用ns1并xmlns在节点中实际定义如下:
<CredentialsHeader xmlns="http://www.example.com/Services/Example">
<EMail>ricky@email.net</EMail>
<Password>password</Password>
</CredentialsHeader>
Run Code Online (Sandbox Code Playgroud)
我已经在Firefox海报中对此进行了测试,并且知道更改可以解决问题.
我试图在PHP中发出SOAP请求.我有我的服务URL,当我在SOAP UI中检查它时,我可以看到以下内容
<application xmlns="http://somenamespace.com">
<doc xml:lang="en" title="https://someurl.com"/>
<resources base="https://someurl.com">
<resource path="sdk/user/session/logon/" id="Logon">
<doc xml:lang="en" title="Logon"/>
<param name="ApiKey" type="xs:string" required="false" default="" style="query" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
<param name="ApiSecret" type="xs:string" required="false" default="" style="query" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
<method name="POST" id="Logon">
<doc xml:lang="en" title="Logon"/>
<request>
<param name="method" type="xs:string" required="true" default="" style="query" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
<representation mediaType="application/json"/>
<representation mediaType="application/xml"/>
<representation mediaType="text/xml"/>
<representation mediaType="application/x-www-form-urlencoded"/>
</request>
<response status="404 500">
<representation mediaType="text/html; charset=utf-8" element="html"/>
</response>
<response status="">
<representation mediaType="application/json"/>
<representation mediaType="application/xml"/>
<representation mediaType="text/xml"/>
<representation mediaType="application/x-www-form-urlencoded"/>
</response>
<response status="500">
<representation mediaType="application/vnd.marg.bcsocial.result-v1.9+json; charset=utf-8" element="log:Fault" xmlns:log="https://someurl.com/sdk/user/session/logon"/>
<representation mediaType="application/vnd.marg.bcsocial.result-v1.9+xml; …Run Code Online (Sandbox Code Playgroud) 面临下一个问题:
我在.net web应用程序下运行.NET Framework 4.5.2.应用程序使用以下方式与SalesForce通信:
SOAP APIREST API(https://github.com/developerforce/Force.com-Toolkit-for-NET/).SalesForce于2017年3月4日宣布禁用TLS 1.0加密协议.我是否需要进行一些调整才能迁移到TLS 1.2?
System.Net.ServicePointManager.SecurityProtocol.NET 4.5中的默认值是SecurityProtocolType.Tls|SecurityProtocolType.Ssl3,.NET 4.5最多支持TLS 1.2
我需要更新System.Net.ServicePointManager.SecurityProtocol吗?如果是这样,它是否会影响与其他api的通信?
我将不胜感激任何帮助.
嗨,我创建消费SOAP服务的代码,
对于Authentication Header,我使用Wss4jSecurityInterceptor来设置Header信息.
我收到如下的失败回应
Exception in thread "main" org.springframework.ws.soap.client.SoapFaultClientException: Required element {http://www.w3.org/2005/08/addressing}Action is missing
Run Code Online (Sandbox Code Playgroud)
我的配置代码如下
@Configuration
public class SoapClientConfig {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("com.xyz.client");
marshaller.setCheckForXmlRootElement(false);
return marshaller;
}
@Bean
public MyClient myClient(Jaxb2Marshaller marshaller) throws Exception {
MyClient client = new MyClient();
client.setDefaultUri("https://localhost:8080/ws/service");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
ClientInterceptor[] interceptors = new ClientInterceptor[] {securityInterceptor()};
client.setInterceptors(interceptors);
return client;
}
@Bean
public Wss4jSecurityInterceptor securityInterceptor() {
Wss4jSecurityInterceptor wss4jSecurityInterceptor = new Wss4jSecurityInterceptor();
wss4jSecurityInterceptor.setSecurementActions("UsernameToken");
wss4jSecurityInterceptor.setSecurementMustUnderstand(true);
wss4jSecurityInterceptor.setSecurementPasswordType("PasswordText");
wss4jSecurityInterceptor.setSecurementUsername("XXXXXXXXXXX");
wss4jSecurityInterceptor.setSecurementPassword("XXXXXXXX");
return wss4jSecurityInterceptor;
}
} …Run Code Online (Sandbox Code Playgroud) soap-client ×10
soap ×7
php ×6
java ×2
delphi ×1
https ×1
namespaces ×1
php-5.2 ×1
protocols ×1
ssl ×1
web-services ×1