+ Start a Discussion
Eager-2-LearnEager-2-Learn 

Web Service / WSDL

Hi,

 

We are about to start an integration effort and IT shown me a Schema that has a header record.  The contract that we have on our team has said that because of the header information that is required we will have to actually build the XML SOAP format and send it.  I have always tried to be proactive in learning but I cannot find any concrete examples where I would build the XML Soap package and send it in an HTTP transmission.  The contractor said when we get to the point of developing he would show me somethings but I want to learn this stuff sooner rather than later.  Does anyone have any code examples that make sense based on what I have described.  This web service stuff is completely new for me.  He mentioned using XMLDom in this effort.

 

I need something that explains this stuff from the ground up and I really have not seen anything in SFDC's sight that demonstrates the method above.  I have imported a WSDL and made the call to the currency converter and that was a piece of cake but as the contractor stated since IT wants this header information we have to build the XML programmatically and that is where I have not been successful in getting examples from him at this point.  Again I like to be proactive so any help is appreciated.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
willardwillard

Here's some code:

 

// creates a new dom doc
DOM.Document blazeDoc = new DOM.Document();

// creates the root element
DOM.xmlNode blazeRoot = blazeDoc.createRootElement('TimeAd', null, null);

// creates a child element with a node value
blazeRoot.addChildElement('adType', null, null).addTextNode('A'); 
        
// creates a child element that will be used as a container for other elements 
DOM.xmlNode advertisements = blazeRoot.addChildElement('Advertisements', null, null);

 

This will give you xml of something like this:

<TimeAd>

<adType>A</adType>

<Advertisements/>

</TimeAd>

 

Take a look here for more info on how to use these types of classes.

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_classes_xml_dom_document.htm