2012-06-27 701 views
2

我已经无法传送Matlab的SOAP请求 callSoapService(端点,的soapAction,消息)< --http://www.mathworks.com/help/techdoc/ref/callsoapservice.html发送SOAP请求用Matlab

比如我如何才能找到终点,soapAction属性和消息在http://www.webservicex.net/FedWire.asmx?WSDL

据我所知,有多个可能soapActions,端点,并在WSDL消息,但我只是在寻找任何SOAP请求的例子。

回答

2

这是您需要经历的过程。

首先,从WDSL定义创建一个类:

url = 'http://www.webservicex.net/FedWire.asmx?WSDL'; 
className = createClassFromWsdl(url); 

这将创建一个在当前目录下名为@FedWire目录。您可以DIR这个目录或使用以下方法来探索联邦资金转账提供的服务:

methods(FedWire) 

之前,您可以使用Web服务,创建联邦资金转账对象的实例:

fw = FedWire; 
classType = class(fw) % to confirm the class type. 

要使用服务,例如,GetParticipantByLocation,这需要一个城市和StateCode:

[Result, FedWireLists] = GetParticipantsByLocation(fw, 'New York', 'NY') 

结果应该是真实的和FedWireLists是包含数据保留一个深深嵌套结构urned。

打开@FedWire \ GetParticipantsByLocation.m显示了MATLAB生成的代码如何使用createSoapMessage和callSoapService。如果该服务不支持WSDL查询,那么使用这些低级函数就成为必需。

为createSoapMessage的参数填充像这样:

  • 命名空间: 'http://www.webservicex.net/'
  • 方法: 'GetParticipantsByLocation'
  • 值:{'纽约','NY'}
  • NAME:{'City','StateCode'}
  • 类型:{'{http://www.w3.org/2001/XMLSchema}string','{http:/ /www.w3.org/2001/XMLSchema}string'}
  • 风格: '文档'

和callSoapService:

  • ENDPOINT: 'http://www.webservicex.net/FedWire.asmx'
  • SOAPACTION:的“http:// WWW。 webservicex.net/GetParticipantsByLocation'
  • MESSAGE:createSoapMessage调用的结果。

下面的代码,使与低级别调用相同的查询:

% createSoapMessage(NAMESPACE,METHOD,VALUES,NAMES,TYPES,STYLE) creates a SOAP message. 
soapMessage = createSoapMessage(... 
    'http://www.webservicex.net/', ... 
    'GetParticipantsByLocation', ... 
    {'New York', 'NY'}, ... 
    {'City', 'StateCode'}, ... 
    {'{http://www.w3.org/2001/XMLSchema}string', ... 
    '{http://www.w3.org/2001/XMLSchema}string'}, ... 
    'document') 

% callSoapService(ENDPOINT,SOAPACTION,MESSAGE) sends the MESSAGE, 
response = callSoapService(... 
    'http://www.webservicex.net/FedWire.asmx', ... 
    'http://www.webservicex.net/GetParticipantsByLocation', ... 
    soapMessage); 

%parseSoapResponse Convert the response from a SOAP server into MATLAB types. 
[result, participants] = parseSoapResponse(response) 

我有很多的麻烦使得这些例子中工作,因为我是资本服务的域名这样www.webserviceX.NET我拿了从他们的示例XML。当我改为小写字母时,它就起作用了。

使用createClassFromWsdl的例子是 http://www.mathworks.co.uk/products/bioinfo/examples.html?file=/products/demos/shipping/bioinfo/connectkeggdemo.html

+0

适应这关系到我的问题http://stackoverflow.com/questions/11951661/what-is-wrong-with-the-way-i-am - 使用 - 皂在此结果specic-MATLAB的例子。 –