Posting XML To HTTPS

3 次查看(过去 30 天)
Christopher Eirich
Christopher Eirich 2015-3-19
回答: Guillaume 2015-3-19
Good afternoon,
I am looking to query a private web server by uploading an XML request and reading the XML response. In VBA I use code similar to this:
Dim oWinhttp As WinHttpRequest
Set oWinhttp = New WinHttpRequest
Dim result As Variant
With oWinhttp
Call .SetTimeouts(300000, 300000, 300000, 300000)
Call .Open("POST", "https://xml.service.com/comm/xml/submit")
Call .SetCredentials("username", "password", 0)
Call .SetRequestHeader("POST", "/comm/xml/submit HTTP/1.1")
Call .SetRequestHeader("HOST", "xmltrn.xml.com")
Call .SetRequestHeader("Content-Type", "text/xml")
Call .SetRequestHeader("Content-Length", Len(sXML))
Call .SetRequestHeader("SOAPAction", "/comm/xml/submit")
Call .Send(sXML)
'Wait for the response asynchronously.
Call .WaitForResponse
result = .ResponseText
Where sXML contains the XML file to be submitted.
Is there any way to perform this operation easily from MatLab?

回答(1 个)

Guillaume
Guillaume 2015-3-19
If you're on the latest version of matlab (2015a), then I believe webwrite will do exactly the same.
In older versions of matlab, I don't believe there's anything, but you could always delegate to java or .Net

类别

Help CenterFile Exchange 中查找有关 Call Web Services from MATLAB Using HTTP 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by