You need to sign in to do that
Don't have an account?
anuraj
XML load
Hi
I am trying to load xml into the salesforce but not getting value into the salesforce
my Vf page
<apex:page controller="testxmlCont"> <apex:form > <apex:commandButton value="{!runxml}" title="click"/> </apex:form> </apex:page>
Controller
public class testxmlCont { public String getRunxml() { String fakeSoapResponse = ''; fakeSoapResponse = '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">' + '<soap:Header>' + '<wsa:Action>http://www.right90.com/r90/v1/api/UpdateGenericForecastResponse</wsa:Action>' + '<wsa:MessageID>urn:uuid:2cee4a82-6492-4453-a42b-2c353ed0f630</wsa:MessageID>' + '<wsa:RelatesTo>urn:uuid:524e9e22-e97a-4e6f-9ed6-33049c22ebab</wsa:RelatesTo>' + '<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>' + '</soap:Header>' + '<soap:Body xmlns="http://www.right90.com/r90/v1/api">' + '<UpdateGenericForecastResponse xmlns="http://www.right90.com/r90/v1/api">' + '<UpdateGenericForecastResult xmlns="http://www.right90.com/r90/v1/api">' + '<ForecastResponse>' + '<StatusCode>Success</StatusCode>' + '<ErrorCode>0</ErrorCode>' + '<Message></Message>' + '<Element ExternalSystemId="00kS00000046XUIIA2" R90ElementId="107091"/>' + '<JudgmentResponses>' + '<JudgmentResponse>' + '<StatusCode>Success</StatusCode>' + '<ErrorCode>0</ErrorCode>' + '<Message>Successfully processed.</Message>' + '<Judgment MeasureName="FACTOR" Value="8" ForecastDate="2010-07-15T00:00:00" ModifiedByUserName="r90admin"/>' + '</JudgmentResponse>' + '</JudgmentResponses>' + '<JudgmentResponse>' + '<StatusCode>Error</StatusCode>' + '<ErrorCode>0</ErrorCode>' + '<Message>Time period specified is out of time horizon range.</Message>' + '<Judgment MeasureName="FACTOR" Value="0.58" ForecastDate="2013-05-15T00:00:00" ModifiedByUserName="r90admin" />' + '</JudgmentResponse>' + '</ForecastResponse>' + '</UpdateGenericForecastResult>' + '</UpdateGenericForecastResponse>' + '</soap:Body>' + '</soap:Envelope>' ; Dom.Document fakeDoc = new Dom.Document(); fakeDoc.load(fakeSoapResponse); // envelope = fakeDoc.getRootElement(); system.debug('++++++++++++++++++++++ '+fakeDoc); system.debug('+++++++++++++++++++++++++++++++Enve'); // system.debug(envelope); return null; } }
I am getting this in the debug log.
23:13:27.075 (75334000)|SYSTEM_METHOD_ENTRY|[45]|System.debug(ANY) 23:13:27.075 (75355000)|USER_DEBUG|[45]|DEBUG|++++++++++++++++++++++ Document[] 23:13:27.075 (75379000)|SYSTEM_METHOD_EXIT|[45]|System.debug(ANY) 23:13:27.075 (75415000)|SYSTEM_METHOD_ENTRY|[46]|System.debug(ANY) 23:13:27.075 (75481000)|USER_DEBUG|[46]|DEBUG|+++++++++++++++++++++++++++++++Enve 23:13:27.075 (75510000)|SYSTEM_METHOD_EXIT|[46]|System.debug(ANY) 23:13:27.075 (75535000)|CODE_UNIT_FINISHED|testxmlCont invoke(getrunxml)
Can you please help me to solve my problem.
Thanks
Anuraj
loading an XML means what u want to do exactly... whether r u getting the XML as string and then trying to identify the node values and storing in to an object or some thing like this....
Thanks for your reply
I am trying to identify the node values
once you got the xml as string u need to do some thing like this
string strXML = obj.GetCitiesByCountry(cname);
system.debug('************strXML**********'+strXML);
XmlStreamReader reader = new XmlStreamReader(strXML);
system.debug('************reader**********'+reader);
while(reader.hasNext()) {
wrapperrecords objrec = new wrapperrecords();
if (reader.getEventType() == XmlTag.START_ELEMENT) {
system.debug('************reader.getLocalName()**********'+reader.getLocalName());
if ('Country' == reader.getLocalName()) {
system.debug('************************reader.getEventType()*******************'+reader.getEventType());
while(reader.hasNext()) {
if (reader.getEventType() == XmlTag.END_ELEMENT) {
break;
} else if (reader.getEventType() == XmlTag.CHARACTERS) {objrec.strcountry = reader.getText();
}reader.next();
}
}
like country u need to identify every node in the XMl
thanks
kiran i am not able to get xml into