2012-06-27 327 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的例子。 –