responseXML.xml empty string after POSTing to WCF Service -
i calling wcf service in following way:
dim soapresponse, soaprequest, serviceurl, strresult serviceurl = "https://api.mydomain/services/myapiservice.svc" set soaprequest = server.createobject("msxml2.serverxmlhttp.6.0") soaprequest = "this xml gets built" dim oxmlhttp : set oxmlhttp = createobject("msxml2.serverxmlhttp.6.0") oxmlhttp.setoption 2, 13056 oxmlhttp.open "post", serviceurl, false oxmlhttp.setrequestheader "content-type", "application/soap+xml; charset=utf-8; action=""http://tempuri.org/imyapiservice/insertperson""" oxmlhttp.setrequestheader "content-length", len(soaprequest) oxmlhttp.setrequestheader "soapaction", "http://tempuri.org/imyapiservice/insertperson" oxmlhttp.send soaprequest
the soaprequest builds valid soap envelope, , posts server. issue when post service, xmlhttp.responsetext valid , contains soap reply, xmlhttp.responsexml.xml empty string.
the responsetext returned example below:
--uuid:17c8815c-33cd-4ccd-aaab-f0246cc26f65+id=2 content-id: <http://tempuri.org/0> content-transfer-encoding: 8bit content-type: application/xop+xml;charset=utf-8;type="application/soap+xml" <s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> <s:header> <a:action s:mustunderstand="1"> http://tempuri.org/imyapiservice/insertpersonresponse </a:action> </s:header> <s:body> <insertpersonresponse xmlns="http://tempuri.org/"> <insertpersonresult xmlns:b="http://schemas.datacontract.org/2004/07/myapi.models.response" xmlns:i="http://www.w3.org/2001/xmlschema-instance"> <errordetails i:nil="true" xmlns="http://schemas.datacontract.org/2004/07/myapi.models.response.base"/> <issuccessful xmlns="http://schemas.datacontract.org/2004/07/myapi.models.response.base">false</issuccessful> <b:id>0</b:id> </insertpersonresult> </insertpersonresponse> </s:body> </s:envelope> --uuid:17c8815c-33cd-4ccd-aaab-f0246cc26f65+id=2--
i guessing because xml isn't valid content type application/soap+xml, --uuid bit , other soap related info not valid xml.
if change content type text/xml, service rejects request content type incorrect.
basically need grab issuccessful , id values response proceed function, thoughts on how can amend either service or vbscript can use responsexml.xml , interrogate needed?
i rather able interrogate xml rather messy routine searching through responsetext string.
Comments
Post a Comment