SOAP Fault:不满足安全要求,因为传入消息中不存在安全标头

时间:2015-06-12 07:51:34

标签: web-services soap wsdl

我正在尝试使用Exacttarget提供的SOAP wsdl将salesforce与exacttarget集成。

我能够生成apex类,但是在调用create请求时,我收到错误System.CalloutException:Web服务callout失败。

由于我是apex的新手,我不确定SOAP头请求是否只能通过http来完成?或者我可以通过我的课程来完成。

请在下面找到我正在使用的代码。

exacttargetComWsdlPartnerapi.Soap soapReq = new exacttargetComWsdlPartnerapi.Soap();
exacttargetComWsdlPartnerapi.UsernameAuthentication authentication = new exacttargetComWsdlPartnerapi.UsernameAuthentication();
authentication.UserName = '******'; 
authentication.PassWord = '*****';
soapReq.inputHttpHeaders_x = new Map<String, String>();
soapReq.outputHttpHeaders_x = new Map<String, String>();
//String myData = 'smruti.bhargava@accenture.com.etdev:smruti@123';
//authentication = EncodingUtil.base64Encode(Blob.valueOf(myData));
soapReq.inputHttpHeaders_x.put('Authorization','Basic ' + authentication );SALESFORCE STUB
exacttargetComWsdlPartnerapi.CreateOptions optList = new exacttargetComWsdlPartnerapi.CreateOptions();
exacttargetComWsdlPartnerapi.ContainerID contnr = new exacttargetComWsdlPartnerapi.ContainerID();
exacttargetComWsdlPartnerapi.APIObject apiObj = new exacttargetComWsdlPartnerapi.APIObject();
exacttargetComWsdlPartnerapi.APIProperty apiProp = new exacttargetComWsdlPartnerapi.APIProperty();
List<exacttargetComWsdlPartnerapi.APIProperty> propList = new List<exacttargetComWsdlPartnerapi.APIProperty>();
apiProp.Name='EmailAddress';
apiprop.Value='ash123@gmail.com';
propList.add(apiProp);
apiObj.PartnerProperties=propList;
contnr.APIObject = apiObj;
optList.Container = contnr;
List<exacttargetComWsdlPartnerapi.APIObject> objList = new List<exacttargetComWsdlPartnerapi.APIObject>();
objList.add(apiObj);
exacttargetComWsdlPartnerapi.CreateResponse_element response = soapReq.Create(optList,objList);
System.debug('** Result ==>' + response);

0 个答案:

没有答案