r - Access webservices using RCurl CurlPerform: Getting HTTP 500 error -
i trying use webservice using rcurl package.
this webservice 'https://ngcsi.contigohosting.com/entrader_dev/wcfservices/tradingservice.svc' has lot of methods can accessed
authentication , hence passing user name , password in header.
h=basictextgatherer() headerfields = c(c(accept="text/xml", accept="multipart/*", 'content-type' = "text/xml; charset=utf-8"), soapaction = "https://ngcsi.contigohosting.com/entrader_dev/wcfservices/tradingservice.svc?wsdl") body = '<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://entrader.contigoenergy.com/contigo.entrader.service">\ <soapenv:header>\ <wsse:security soapenv:mustunderstand="1"\ xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">\ <wsse:usernametoken wsu:id="usernametoken-37"\ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">\ <wsse:username>username</wsse:username>\ <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passwordtext">password</wsse:password>\ </wsse:usernametoken>\ </wsse:security>\ </soapenv:header>\ <soapenv:body>\ </soapenv:body>\ </soapenv:envelope>\n' curlperform(url = "https://ngcsi.contigohosting.com/entrader_dev/wcfservices/tradingservice.svc", httpheader = headerfields, postfields = body, writefunction = h$update, verbose=true ) body=h$value()
i http/1.1 500 internal server error while executing above , below body content
<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><s:header><o:security s:mustunderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><u:timestamp u:id="_0"><u:created>2017-07-25t15:14:00.856z</u:created><u:expires>2017-07-25t15:19:00.856z</u:expires></u:timestamp></o:security></s:header><s:body><s:fault><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:actionnotsupported</faultcode><faultstring xml:lang="en-gb">the message action 'https://ngcsi.contigohosting.com/entrader_dev/wcfservices/tradingservice.svc?wsdl' cannot processed @ receiver, due contractfilter mismatch @ endpointdispatcher. may because of either contract mismatch (mismatched actions between sender , receiver) or binding/security mismatch between sender , receiver. check sender , receiver have same contract , same binding (including security requirements, e.g. message, transport, none).</faultstring></s:fault></s:body></s:envelope>
any appreciated. thank you.
the soapaction should have method , in instance of following per wsdl used above.
http://entrader.contigoenergy.com/contigo.entrader.service/tradingservice/gettrade
http://entrader.contigoenergy.com/contigo.entrader.service/tradingservice/getbyfiltertrade
so, new code should following
h=basictextgatherer() headerfields = c(c(accept="text/xml", accept="multipart/*", 'content-type' = "text/xml; charset=utf-8"), soapaction = "http://entrader.contigoenergy.com/contigo.entrader.service/tradingservice/gettrade") body = '<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:con="http://entrader.contigoenergy.com/contigo.entrader.service">\ <soapenv:header>\ <wsse:security soapenv:mustunderstand="1"\ xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">\ <wsse:usernametoken wsu:id="usernametoken-37"\ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">\ <wsse:username>username</wsse:username>\ <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passwordtext">password</wsse:password>\ </wsse:usernametoken>\ </wsse:security>\ </soapenv:header>\ <soapenv:body>\ </soapenv:body>\ </soapenv:envelope>\n' curlperform(url = "https://ngcsi.contigohosting.com/entrader_dev/wcfservices/tradingservice.svc", httpheader = headerfields, postfields = body, writefunction = h$update, verbose=true ) body=h$value()
the above code works , able appropriate response webservice although have not mentioned in body in example stated.
Comments
Post a Comment