You need to sign in to do that
Don't have an account?
Shekhar Dautpure
Unexpected element {} during simple type deserialization
I have inbound soap based ws. I am now trying to test it via postman.
However i am getting error
This is the request message
This is the response:
And this is the class :
I dont know what am i doing wrong in the request as class is now successfully saved (this mean no syntax errors).
Thus any help to debug it would be helpfull
However i am getting error
This is the request message
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ecc="http://soap.sforce.com/schemas/class/EccoInterfaceEntryPoint"> <soapenv:Header> <ecc:SessionHeader> <ecc:sessionId>iAO3qU9TwI5_ad4wZIa31cN3w9P9nUVULl1UlUE9cIEKKmdkBEkvWNyxJ5r.eyoRVa5r5qfGKq_aWkGfAmt</ecc:sessionId> </ecc:SessionHeader> </soapenv:Header> <soapenv:Body> <ecc:SentMessagetoSalesforce> <ecc:RequestMessage> <EccoMessage> <Header> <ServiceId>Brand_CRUD</ServiceId> <TypeCode>CreateBrand</TypeCode> <SentDate>19/03/2018</SentDate> <SourceSystem>SAP</SourceSystem> <DestinationSystem>SFDC</DestinationSystem> <RequestId>1234</RequestId> <Object>Brand</Object> <ObjectId>888</ObjectId> <langId>ENG</langId> </Header> <Body> <Payload> <BrandName>ELG1</BrandName> <BrandId>567</BrandId> <ActiveFlg>Y</ActiveFlg> <BrandOwnerEmail>shd@ecco.com</BrandOwnerEmail> </Payload> </Body> </EccoMessage> </ecc:RequestMessage> </ecc:SentMessagetoSalesforce> </soapenv:Body> </soapenv:Envelope>
This is the response:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <soapenv:Fault> <faultcode>soapenv:Client</faultcode> <faultstring>Unexpected element {}EccoMessage during simple type deserialization</faultstring> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
And this is the class :
/* * @Author : Chandrashekhar Dautpure (CSD) * @ Date : 19-03-2018 * @ Functionality : This is main class for Interface framework * @ version : * 1. 19-03-2018 -- Initial Draft -- CSD * */ global class EccoInterfaceEntryPoint { webservice static void SentMessagetoSalesforce(String RequestMessage) { XPath xp = new XPath(RequestMessage); Ecco_Interface_Log__c InterfaceMess = New Ecco_Interface_Log__c(); InterfaceMess.Ecco_Service__c = GetServiceId(xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ServiceId')); InterfaceMess.ActionCode__c = xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/TypeCode'); InterfaceMess.Destination__c = xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/DestinationSystem'); InterfaceMess.ParentId__c = xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ObjectId'); InterfaceMess.Source__c = xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/ObjectId'); InterfaceMess.RequestId__c = xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/RequestId'); InterfaceMess.ProcessFlg__c = false; InterfaceMess.ParentType__c = xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/Object'); InterfaceMess.LangID__c = xp.getText ('/soapenv:Envelope/soapenv:Body/EccoMessage/Header/langId'); Dom.Document doc = new Dom.Document(); doc.load(RequestMessage); Dom.XMLNode root = doc.getRootElement(); for(Dom.XMLNode firstlevelchild : root.getChildren()) { if(firstlevelchild.GetName()=='Body') { InterfaceMess.Payload__c = String.valueOf(firstlevelchild); } } insert InterfaceMess; } private static String GetServiceId(String ServiceName) { return [Select Id from Ecco_Service__c where Name =: ServiceName].Id; } }
I dont know what am i doing wrong in the request as class is now successfully saved (this mean no syntax errors).
Thus any help to debug it would be helpfull
Shekhar Dautpure
XP Xpath was inspired from https://github.com/JenniferSimonds/apex-xpath